Java Code Examples for com.badlogic.gdx.utils.IntArray#get()

The following examples show how to use com.badlogic.gdx.utils.IntArray#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: G3dtLoader.java    From uracer-kotd with Apache License 2.0 6 votes vote down vote up
private static IntArray readFaces (BufferedReader in) throws NumberFormatException, IOException {
	int numFaces = readInt(in);
	IntArray faceIndices = new IntArray();
	IntArray triangles = new IntArray();
	IntArray indices = new IntArray();

	for (int face = 0; face < numFaces; face++) {
		readIntArray(in, faceIndices);
		int numIndices = faceIndices.get(0);
		triangles.clear();
		int baseIndex = faceIndices.get(1);
		for (int i = 2; i < numIndices; i++) {
			triangles.add(baseIndex);
			triangles.add(faceIndices.items[i]);
			triangles.add(faceIndices.items[i + 1]);
		}
		indices.addAll(triangles);
	}

	indices.shrink();
	return indices;
}
 
Example 2
Source File: CenteredTableBuilder.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
@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();
	}
}
 
Example 3
Source File: DieNet.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
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);
    }
}
 
Example 4
Source File: StandardTableBuilder.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
@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();
	}
}
 
Example 5
Source File: BehaviorTreeViewer.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
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;
}