当前位置: 首页>>代码示例>>Java>>正文


Java IntArray.get方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.IntArray.get方法的典型用法代码示例。如果您正苦于以下问题:Java IntArray.get方法的具体用法?Java IntArray.get怎么用?Java IntArray.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.IntArray的用法示例。


在下文中一共展示了IntArray.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillTable

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
@Override
protected void fillTable (final Table table) {
	final IntArray rowSizes = getRowSizes();
	final int widgetsInRow = getLowestCommonMultiple(rowSizes);

	for (int rowIndex = 0, widgetIndex = 0; rowIndex < rowSizes.size; rowIndex++) {
		final int rowSize = rowSizes.get(rowIndex);
		final int currentWidgetColspan = widgetsInRow / rowSize;
		boolean isFirst = shouldExpand(rowSize);

		for (final int totalWidgetsBeforeRowEnd = widgetIndex + rowSize; widgetIndex < totalWidgetsBeforeRowEnd; widgetIndex++) {
			final Cell<?> cell =
					getWidget(widgetIndex).buildCell(table, getDefaultWidgetPadding()).colspan(
							currentWidgetColspan);
			// Keeping widgets together - expanding X for first and last widget, setting alignments:
			if (isFirst) {
				isFirst = false;
				cell.expandX().right();
			} else if (isLast(widgetIndex, rowSize, totalWidgetsBeforeRowEnd)) {
				cell.expandX().left();
			}
		}
		table.row();
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:26,代码来源:CenteredTableBuilder.java

示例2: allocate

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
public static int allocate (IntArray ifree, ObjectArrayList<sStkNPS> stock, sStkNPS value) {
	int i;
	if (ifree.size > 0) {
		i = ifree.get(ifree.size - 1);
		ifree.removeIndex(ifree.size - 1);
		stock.getQuick(i).set(value);
	} else {
		i = stock.size();
		stock.add(value);
	}
	return (i);
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:13,代码来源:Dbvt.java

示例3: maxdirfiltered

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
private static int maxdirfiltered (ObjectArrayList<Vector3> p, int count, Vector3 dir, IntArray allow) {
	assert (count != 0);
	int m = -1;
	for (int i = 0; i < count; i++) {
		if (allow.get(i) != 0) {
			if (m == -1 || p.getQuick(i).dot(dir) > p.getQuick(m).dot(dir)) {
				m = i;
			}
		}
	}
	assert (m != -1);
	return m;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:14,代码来源:HullLibrary.java

示例4: draw

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
public void draw (Batch spriteBatch, int start, int end) {
	if (pageVertices.length == 1) { // 1 page.
		spriteBatch.draw(font.getRegion().getTexture(), pageVertices[0], start * 20, (end - start) * 20);
		return;
	}

	// Determine vertex offset and count to render for each page. Some pages might not need to be rendered at all.
	Array<TextureRegion> regions = font.getRegions();
	for (int i = 0, pageCount = pageVertices.length; i < pageCount; i++) {
		int offset = -1, count = 0;

		// For each set of glyph indices, determine where to begin within the start/end bounds.
		IntArray glyphIndices = pageGlyphIndices[i];
		for (int ii = 0, n = glyphIndices.size; ii < n; ii++) {
			int glyphIndex = glyphIndices.get(ii);

			// Break early if the glyph is out of bounds.
			if (glyphIndex >= end) break;

			// Determine if this glyph is within bounds. Use the first match of that for the offset.
			if (offset == -1 && glyphIndex >= start) offset = ii;

			// Determine the vertex count by counting glyphs within bounds.
			if (glyphIndex >= start) // && gInd < end
				count++;
		}

		// Page doesn't need to be rendered.
		if (offset == -1 || count == 0) continue;

		// Render the page vertex data with the offset and count.
		spriteBatch.draw(regions.get(i).getTexture(), pageVertices[i], offset * 20, count * 20);
	}
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:35,代码来源:BitmapFontCache.java

示例5: highlight

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
private void highlight(IntArray indices) {
    for (int i = 0; i < indices.size; i++) {
        Vector2 pos = iconPositions[indices.get(i)];
        Image image = new Image(Config.skin, "ui/dice-window/net-selection-selected");
        image.setPosition(pos.x - 2, pos.y - 2);
        addActor(image);
        image.toBack();
        image.getColor().a = 0f;
        blink(image);
        highlights.add(image);
    }
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:13,代码来源:DieNet.java

示例6: getLast

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
/** @param intArray can be null.
 * @return last stored int in the array if it is not empty or 0. */
public static int getLast(final IntArray intArray) {
    if (isEmpty(intArray)) {
        return 0;
    }
    return intArray.get(intArray.size - 1);
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:9,代码来源:GdxArrays.java

示例7: AnimatedTiledMapTile

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
/** Creates an animated tile with the given animation intervals and frame tiles.
 *
 * @param intervals The intervals between each individual frame tile in milliseconds.
 * @param frameTiles An array of {@link StaticTiledMapTile}s that make up the animation. */
public AnimatedTiledMapTile (IntArray intervals, Array<StaticTiledMapTile> frameTiles) {
	this.frameTiles = new StaticTiledMapTile[frameTiles.size];
	this.frameCount = frameTiles.size;

	this.animationIntervals = intervals.toArray();
	this.loopDuration = 0;

	for (int i = 0; i < intervals.size; ++i){
		this.frameTiles[i] = frameTiles.get(i);
		this.loopDuration += intervals.get(i);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:17,代码来源:AnimatedTiledMapTile.java

示例8: fillTable

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
@Override
protected void fillTable (final Table table) {
	final IntArray rowSizes = getRowSizes();
	final int widgetsInRow = getLowestCommonMultiple(rowSizes);
	for (int rowIndex = 0, widgetIndex = 0; rowIndex < rowSizes.size; rowIndex++) {
		final int rowSize = rowSizes.get(rowIndex);
		final int currentWidgetColspan = widgetsInRow / rowSize;
		for (final int totalWidgets = widgetIndex + rowSize; widgetIndex < totalWidgets; widgetIndex++) {
			getWidget(widgetIndex).buildCell(table, getDefaultWidgetPadding()).colspan(
					currentWidgetColspan);
		}
		table.row();
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:15,代码来源:StandardTableBuilder.java

示例9: getGroupIdBefore

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
public int getGroupIdBefore (int gid) {
	IntArray groupIds = getGroupComponent().groupIds;
	int index = groupIds.indexOf(gid) - 1;
	if (gid == -1) return groupIds.peek();

	if (index < 0)
		return -1;
	else
		return groupIds.get(index);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:11,代码来源:EntityProxy.java

示例10: getGroupIdAfter

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
public int getGroupIdAfter (int gid) {
	IntArray groupIds = getGroupComponent().groupIds;
	int index = groupIds.indexOf(gid) + 1;
	if (gid == -1) return groupIds.peek();

	if (index >= groupIds.size)
		return -1;
	else
		return groupIds.get(index);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:11,代码来源:EntityProxy.java

示例11: addToTree

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
private int addToTree (Tree displayTree, TaskNode parentNode, Task<E> task, IntArray taskSteps, int taskStepIndex) {
	TaskNode node = new TaskNode(task, this, taskSteps == null ? step - 1 : taskSteps.get(taskStepIndex), getSkin());
	taskNodes.put(task, node);
	if (parentNode == null) {
		displayTree.add(node);
	} else {
		parentNode.add(node);
	}
	taskStepIndex++;
	for (int i = 0; i < task.getChildCount(); i++) {
		Task<E> child = task.getChild(i);
		taskStepIndex = addToTree(displayTree, node, child, taskSteps, taskStepIndex);
	}
	return taskStepIndex;
}
 
开发者ID:libgdx,项目名称:gdx-ai,代码行数:16,代码来源:BehaviorTreeViewer.java

示例12: onCast

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
@Override
protected void onCast(int abilityInd) {
    switch (abilityInd) {
        /**
         * Spawns a linear moving projectile.
         */
        case ABILITY_1:
            StatComponent stats = getComponent(entityID, StatComponent.class);
            EntityArguments arguments = getArguments("superghost_auto.json");
            PositionComponent.PositionTemplate pos = arguments.get(PositionComponent.class.getSimpleName(), PositionComponent.PositionTemplate.class);
            AIComponent aiComponent = getComponent(entityID, AIComponent.class);

            Vector2 enemyPos = getComponent(aiComponent.target, PositionComponent.class).position;
            Vector2 charPos = getCharacterPosition();

            Vector2 dir = new Vector2(enemyPos).sub(charPos).nor();
            pos.x = charPos.x;
            pos.y = charPos.y;
            int entity = spawn(Entities.Bullet, arguments);
            BulletComponent bCon = getComponent(entity, BulletComponent.class);
            bCon.speed = 10;
            bCon.move.set(dir);
            bCon.old.set(pos.x, pos.y);
            bCon.target = -1;
            bCon.maxDistance = 5;
            final float damage = stats.getCurrentStat(StatComponent.BaseStat.attackDamage) * 1.1f;
            final int caster1 = entityID;
            bCon.collisionCallback = (bullet, hit, bFix, hFix, contact) -> {
                if (hit == caster1 || hit != aiComponent.target)
                    return;
                BulletComponent bulletComponent = getComponent(bullet, BulletComponent.class);
                StatComponent hitStat = getComponent(hit, StatComponent.class);
                if (hitStat != null) {
                    bulletComponent.delete = true;
                    hitStat.damages.add(new Damage(Damage.DamageType.Physical, damage, 0));
                }
            };
            break;
        /**
         * Slams the ground around {@link SuperGhost}, dealing massive damage to all entities.
         */
        case ABILITY_4:
            IntArray entities = getEntitiesInArea(new Vector2(-2, -2), new Vector2(2, 2));
            for (int i = 0; i < entities.size; i++) {
                int enemy = entities.get(i);
                if (enemy == entityID)
                    continue;
                StatComponent statComponent = getComponent(enemy, StatComponent.class);
                if (statComponent != null) {
                    statComponent.damages.add(new Damage(Damage.DamageType.Magic, 150, 0));
                }
            }
            break;
    }
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:56,代码来源:SuperGhost.java

示例13: bringOutYourDead

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
private void bringOutYourDead (ObjectArrayList<Vector3> verts, int vcount, ObjectArrayList<Vector3> overts, int[] ocount,
	IntArray indices, int indexcount) {
	IntArray tmpIndices = new IntArray();
	for (int i = 0; i < vertexIndexMapping.size; i++) {
		tmpIndices.add(vertexIndexMapping.size);
	}

	IntArray usedIndices = new IntArray();
	MiscUtil.resize(usedIndices, vcount, 0);
	/*
	 * JAVA NOTE: redudant for (int i=0; i<vcount; i++) { usedIndices.set(i, 0); }
	 */

	ocount[0] = 0;

	for (int i = 0; i < indexcount; i++) {
		int v = indices.get(i); // original array index

		assert (v >= 0 && v < vcount);

		if (usedIndices.get(v) != 0) { // if already remapped
			indices.set(i, usedIndices.get(v) - 1); // index to new array
		} else {
			indices.set(i, ocount[0]); // new index mapping

			overts.getQuick(ocount[0]).set(verts.getQuick(v)); // copy old vert to new vert array

			for (int k = 0; k < vertexIndexMapping.size; k++) {
				if (tmpIndices.get(k) == v) {
					vertexIndexMapping.set(k, ocount[0]);
				}
			}

			ocount[0]++; // increment output vert count

			assert (ocount[0] >= 0 && ocount[0] <= vcount);

			usedIndices.set(v, ocount[0]); // assign new index remapping
		}
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:42,代码来源:HullLibrary.java

示例14: maxdirsterid

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
private static int maxdirsterid (ObjectArrayList<Vector3> p, int count, Vector3 dir, IntArray allow) {
	Stack stack = Stack.enter();
	Vector3 tmp = stack.allocVector3();
	Vector3 tmp1 = stack.allocVector3();
	Vector3 tmp2 = stack.allocVector3();
	Vector3 u = stack.allocVector3();
	Vector3 v = stack.allocVector3();

	int m = -1;
	while (m == -1) {
		m = maxdirfiltered(p, count, dir, allow);
		if (allow.get(m) == 3) {
			return m;
		}
		orth(dir, u);
		v.set(u).crs(dir);
		int ma = -1;
		for (float x = 0f; x <= 360f; x += 45f) {
			float s = (float)Math.sin(BulletGlobals.SIMD_RADS_PER_DEG * (x));
			float c = (float)Math.cos(BulletGlobals.SIMD_RADS_PER_DEG * (x));

			tmp1.set(u).scl(s);
			tmp2.set(v).scl(c);
			tmp.set(tmp1).add(tmp2);
			tmp.scl(0.025f);
			tmp.add(dir);
			int mb = maxdirfiltered(p, count, tmp, allow);
			if (ma == m && mb == m) {
				allow.set(m, 3);
				stack.leave();
				return m;
			}
			if (ma != -1 && ma != mb) { // Yuck - this is really ugly
				int mc = ma;
				for (float xx = x - 40f; xx <= x; xx += 5f) {
					s = (float)Math.sin(BulletGlobals.SIMD_RADS_PER_DEG * (xx));
					c = (float)Math.cos(BulletGlobals.SIMD_RADS_PER_DEG * (xx));

					tmp1.set(u).scl(s);
					tmp2.set(v).scl(c);
					tmp.set(tmp1).add(tmp2);
					tmp.scl(0.025f);
					tmp.add(dir);

					int md = maxdirfiltered(p, count, tmp, allow);
					if (mc == m && md == m) {
						allow.set(m, 3);
						stack.leave();
						return m;
					}
					mc = md;
				}
			}
			ma = mb;
		}
		allow.set(m, 0);
		m = -1;
	}
	assert (false);
	stack.leave();
	return m;
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:63,代码来源:HullLibrary.java

示例15: drain

import com.badlogic.gdx.utils.IntArray; //导入方法依赖的package包/类
public void drain () {
	IntArray q = processingQueue;
	synchronized (this) {
		if (processor == null) {
			queue.clear();
			return;
		}
		q.addAll(queue);
		queue.clear();
	}
	for (int i = 0, n = q.size; i < n;) {
		currentEventTime = (long)q.get(i++) << 32 | q.get(i++) & 0xFFFFFFFFL;
		switch (q.get(i++)) {
		case KEY_DOWN:
			processor.keyDown(q.get(i++));
			break;
		case KEY_UP:
			processor.keyUp(q.get(i++));
			break;
		case KEY_TYPED:
			processor.keyTyped((char)q.get(i++));
			break;
		case TOUCH_DOWN:
			processor.touchDown(q.get(i++), q.get(i++), q.get(i++), q.get(i++));
			break;
		case TOUCH_UP:
			processor.touchUp(q.get(i++), q.get(i++), q.get(i++), q.get(i++));
			break;
		case TOUCH_DRAGGED:
			processor.touchDragged(q.get(i++), q.get(i++), q.get(i++));
			break;
		case MOUSE_MOVED:
			processor.mouseMoved(q.get(i++), q.get(i++));
			break;
		case SCROLLED:
			processor.scrolled(q.get(i++));
			break;
		}
	}
	q.clear();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:42,代码来源:InputProcessorQueue.java


注:本文中的com.badlogic.gdx.utils.IntArray.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。