Java Code Examples for com.badlogic.gdx.utils.Array#addAll()

The following examples show how to use com.badlogic.gdx.utils.Array#addAll() . 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: TeleportVisualizer.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
private Array<TextureAtlas.AtlasRegion> compose(String name) {
    Array<TextureAtlas.AtlasRegion> result = composes.get(name);
    if (result == null) {
        result = new Array<TextureAtlas.AtlasRegion>(Config.findRegions(name));
        Array<TextureAtlas.AtlasRegion> rev = new Array<TextureAtlas.AtlasRegion>(result);
        rev.pop();
        rev.reverse();
        for (int i = 0; i < 1; i++) {
            result.add(result.get(result.size - 2));
            result.add(result.get(result.size - 2));
        }
        result.addAll(rev);
        composes.put(name, result);
    }
    return result;
}
 
Example 2
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public ExitPortalAssets(TextureAtlas atlas) {
    final AtlasRegion exitPortal1 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_1);
    final AtlasRegion exitPortal2 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_2);
    final AtlasRegion exitPortal3 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_3);
    final AtlasRegion exitPortal4 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_4);
    final AtlasRegion exitPortal5 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_5);
    final AtlasRegion exitPortal6 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_6);

    Array<AtlasRegion> exitPortalFrames = new Array<AtlasRegion>();

    // TODO: Add the frames to the exitPortalFrames array
    exitPortalFrames.addAll(exitPortal1, exitPortal2, exitPortal3, exitPortal4, exitPortal5, exitPortal6);

    // TODO: Package the frames into an animation, using the frame duration constant
    // Go define that constant in Constants.java if you haven't already
    exitPortal = new Animation(Constants.EXIT_PORTAL_FRAME_DURATION, exitPortalFrames);
}
 
Example 3
Source File: UpdateChildrenValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test
public void validate2() {
    // Given
    UpdateChildrenValidator validator = new UpdateChildrenValidator();
    Array arguments = new Array();
    arguments.addAll(Mockito.mock(Map.class), Mockito.mock(FuturePromise.class));

    // When
    validator.validate(arguments);

    // Then
    // no exception
}
 
Example 4
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public ExitPortalAssets(TextureAtlas atlas) {
    final AtlasRegion exitPortal1 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_1);
    final AtlasRegion exitPortal2 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_2);
    final AtlasRegion exitPortal3 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_3);
    final AtlasRegion exitPortal4 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_4);
    final AtlasRegion exitPortal5 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_5);
    final AtlasRegion exitPortal6 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_6);

    Array<AtlasRegion> exitPortalFrames = new Array<AtlasRegion>();
    exitPortalFrames.addAll(exitPortal1, exitPortal2, exitPortal3, exitPortal4, exitPortal5, exitPortal6);

    exitPortal = new Animation(Constants.EXIT_PORTAL_FRAME_DURATION, exitPortalFrames);
}
 
Example 5
Source File: AnimationDrawable.java    From TerraLegion with MIT License 5 votes vote down vote up
private static void addMiddleReversed(Array<TextureRegion> frames, boolean keepFirst) {
    if (frames.size < 3) {
        return;
    }
    Array<TextureRegion> middleReversed = new Array<TextureRegion>(frames);
    if (!keepFirst) {
        middleReversed.removeIndex(0);
    }
    middleReversed.removeIndex(middleReversed.size - 1);
    middleReversed.reverse();
    frames.addAll(middleReversed);
}
 
Example 6
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public ExitPortalAssets(TextureAtlas atlas) {
    final AtlasRegion exitPortal1 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_1);
    final AtlasRegion exitPortal2 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_2);
    final AtlasRegion exitPortal3 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_3);
    final AtlasRegion exitPortal4 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_4);
    final AtlasRegion exitPortal5 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_5);
    final AtlasRegion exitPortal6 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_6);

    Array<AtlasRegion> exitPortalFrames = new Array<AtlasRegion>();
    exitPortalFrames.addAll(exitPortal1, exitPortal2, exitPortal3, exitPortal4, exitPortal5, exitPortal6);

    exitPortal = new Animation(Constants.EXIT_PORTAL_FRAME_DURATION, exitPortalFrames);
}
 
Example 7
Source File: ReadValueValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void validate_error4() {
    // Given
    ReadValueValidator validator = new ReadValueValidator();
    Array arguments = new Array();
    arguments.addAll(String.class, String.class, String.class);

    // When
    validator.validate(arguments);

    // Then
    Assert.fail();
}
 
Example 8
Source File: ReadValueValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void validate_error3() {
    // Given
    ReadValueValidator validator = new ReadValueValidator();
    Array arguments = new Array();
    arguments.addAll(String.class, String.class);

    // When
    validator.validate(arguments);

    // Then
    Assert.fail();
}
 
Example 9
Source File: ReadValueValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test
public void validate() {
    // Given
    ReadValueValidator validator = new ReadValueValidator();
    Array arguments = new Array();
    arguments.addAll(String.class);

    // When
    validator.validate(arguments);

    // Then
    // no exception
}
 
Example 10
Source File: UpdateChildrenValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test
public void validate() {
    // Given
    UpdateChildrenValidator validator = new UpdateChildrenValidator();
    Array arguments = new Array();
    arguments.addAll(Mockito.mock(Map.class));

    // When
    validator.validate(arguments);

    // Then
    // no exception
}
 
Example 11
Source File: OnDataValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void validate_error2() {
    // Given
    OnDataValidator validator = new OnDataValidator();
    Array arguments = new Array();
    arguments.addAll(String.class, String.class);

    // When
    validator.validate(arguments);

    // Then
    Assert.fail();
}
 
Example 12
Source File: OnDataValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test
public void validate() {
    // Given
    OnDataValidator validator = new OnDataValidator();
    Array arguments = new Array();
    arguments.addAll(String.class);

    // When
    validator.validate(arguments);

    // Then
    // no exception
}
 
Example 13
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public ExitPortalAssets(TextureAtlas atlas) {
    final AtlasRegion exitPortal1 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_1);
    final AtlasRegion exitPortal2 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_2);
    final AtlasRegion exitPortal3 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_3);
    final AtlasRegion exitPortal4 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_4);
    final AtlasRegion exitPortal5 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_5);
    final AtlasRegion exitPortal6 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_6);

    Array<AtlasRegion> exitPortalFrames = new Array<AtlasRegion>();
    exitPortalFrames.addAll(exitPortal1, exitPortal2, exitPortal3, exitPortal4, exitPortal5, exitPortal6);

    exitPortal = new Animation(Constants.EXIT_PORTAL_FRAME_DURATION, exitPortalFrames);
}
 
Example 14
Source File: RunTransactionValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void validate_error2() {
    // Given
    RunTransactionValidator validator = new RunTransactionValidator();
    Array arguments = new Array();
    arguments.addAll(String.class);

    // When
    validator.validate(arguments);

    // Then
    Assert.fail();
}
 
Example 15
Source File: RunTransactionValidatorTest.java    From gdx-fireapp with Apache License 2.0 5 votes vote down vote up
@Test
public void validate() {
    // Given
    RunTransactionValidator validator = new RunTransactionValidator();
    Array arguments = new Array();
    arguments.addAll(String.class, Mockito.mock(Function.class));

    // When
    validator.validate(arguments);

    // Then
    // no exception
}
 
Example 16
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public ExitPortalAssets(TextureAtlas atlas) {
    final AtlasRegion exitPortal1 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_1);
    final AtlasRegion exitPortal2 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_2);
    final AtlasRegion exitPortal3 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_3);
    final AtlasRegion exitPortal4 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_4);
    final AtlasRegion exitPortal5 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_5);
    final AtlasRegion exitPortal6 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_6);

    Array<AtlasRegion> exitPortalFrames = new Array<AtlasRegion>();
    exitPortalFrames.addAll(exitPortal1, exitPortal2, exitPortal3, exitPortal4, exitPortal5, exitPortal6);

    exitPortal = new Animation(Constants.EXIT_PORTAL_FRAME_DURATION, exitPortalFrames);
}
 
Example 17
Source File: Moveset.java    From Unlucky with MIT License 5 votes vote down vote up
/**
 * Returns a Move array with 4 unique moves chosen from all possible Moves
 *
 * @return
 */
private Move[] getRandomMoves() {
    Array<Move> all = new Array<Move>();
    all.addAll(rm.accurateMoves);
    all.addAll(rm.wideMoves);
    all.addAll(rm.critMoves);
    all.addAll(rm.healMoves);

    Move[] ret = new Move[4];

    int index;
    for (int i = 0; i < ret.length; i++) {
        index = MathUtils.random(all.size - 1);
        Move randMove = all.get(index);
        Move temp = null;

        if (randMove.type < 2)
            temp = new Move(randMove.type, randMove.name, randMove.minDamage, randMove.maxDamage);
        else if (randMove.type == 2)
            temp = new Move(randMove.name, randMove.minDamage, randMove.crit);
        else if (randMove.type == 3)
            temp = new Move(randMove.name, randMove.minHeal, randMove.maxHeal, randMove.dmgReduction);

        ret[i] = temp;
        all.removeIndex(index);
    }

    return ret;
}
 
Example 18
Source File: SkinLoader.java    From gdx-gltf with Apache License 2.0 5 votes vote down vote up
private void load(GLTFSkin glSkin, GLTFNode glNode, Node node, NodeResolver nodeResolver, DataResolver dataResolver){
	
	Array<Matrix4> ibms = new Array<Matrix4>();
	Array<Integer> joints = new Array<Integer>();
	
	int bonesCount = glSkin.joints.size;
	
	FloatBuffer floatBuffer = dataResolver.getBufferFloat(glSkin.inverseBindMatrices);
	
	for(int i=0 ; i<bonesCount ; i++){
		float [] matrixData = new float[16];
		floatBuffer.get(matrixData);
		ibms.add(new Matrix4(matrixData));
	}
	joints.addAll(glSkin.joints);
	
	if(ibms.size > 0){
		for(NodePart nodePart : node.parts){
			nodePart.bones = new Matrix4[ibms.size];
			nodePart.invBoneBindTransforms = new ArrayMap<Node, Matrix4>();
			for(int n=0 ; n<joints.size ; n++){
				nodePart.bones[n] = new Matrix4().idt();
				int nodeIndex = joints.get(n);
				Node key = nodeResolver.get(nodeIndex);
				if(key == null) throw new GLTFIllegalException("node not found for bone: " + nodeIndex);
				nodePart.invBoneBindTransforms.put(key, ibms.get(n));
			}
		}
	}
}
 
Example 19
Source File: CustomList.java    From talos with Apache License 2.0 4 votes vote down vote up
public void addAll(Array<T> items) {
    items.addAll(items);
    rebuild();
}
 
Example 20
Source File: Map.java    From riiablo with Apache License 2.0 4 votes vote down vote up
public Array<AssetDescriptor> getDependencies() {
  Array<AssetDescriptor> dependencies = new Array<>();
  for (Zone zone : zones) dependencies.addAll(zone.getDependencies());
  return dependencies;
}