private void androidInput() { left.width = 75; right.width = 75; shoot.width = 75; jump.width = 75; start.width = 75; leftSt.width = Game.res.getWidth("small", "Left", 0, Align.bottomLeft, false); rightSt.width = Game.res.getWidth("small", "Right", 0, Align.bottomLeft, false); shootSt.width = Game.res.getWidth("small", "Shoot", 0, Align.bottomLeft, false); ; jumpSt.width = Game.res.getWidth("small", "Jump", 0, Align.bottomLeft, false); startSt.width = Game.res.getWidth("small", "Start", 0, Align.bottomLeft, false); leftSt.height = Game.res.getHeight("small", "Up", 0, Align.bottomLeft, false); rightSt.height = Game.res.getHeight("small", "Down", 0, Align.bottomLeft, false); shootSt.height = Game.res.getHeight("small", "Shoot", 0, Align.bottomLeft, false); jumpSt.height = Game.res.getHeight("small", "Jump", 0, Align.bottomLeft, false); startSt.height = Game.res.getHeight("small", "Start", 0, Align.bottomLeft, false); left.height = 75; right.height = 75; shoot.height = 75; jump.height = 75; start.height = 50; start.x = 10; start.y = MyConstants.WORLD_HEIGHT - start.height - 10; startSt.x = (start.x + (start.width * .5f)) - (startSt.width * .5f); startSt.y = (start.y + (start.height * .5f)) + (startSt.height * .5f); jump.x = (MyConstants.WOLRD_WIDTH) - (jump.width * .5f) - 10; jump.y = (jump.height * .5f) + 10; jumpSt.x = jump.x - (jumpSt.width * .5f); jumpSt.y = jump.y + (jumpSt.height * .5f); shoot.x = (jump.x) - jump.width - 15; shoot.y = (shoot.height * .5f) + 10; shootSt.x = shoot.x - (shootSt.width * .5f); shootSt.y = shoot.y + (shootSt.height * .5f); left.x = 10; left.y = 10; rightSt.x = (right.x + (right.width * .5f)) - (rightSt.width * .5f); rightSt.y = (right.y + (right.height * .5f)) + (rightSt.height * .5f); right.x = 10 + left.width + 10; right.y = 10; leftSt.x = (left.x + (left.width * .5f)) - (leftSt.width * .5f); leftSt.y = (left.y + (left.height * .5f)) + (leftSt.height * .5f); for (int i = 0; i < MyConstants.NUM_TOUCHES; i++) { if (Gdx.input.isTouched(i)) { if (left.contains( Gdx.input.getX(i) * (MyConstants.WOLRD_WIDTH / Game.SIZE.x), MyConstants.WORLD_HEIGHT - (Gdx.input.getY(i) * (MyConstants.WORLD_HEIGHT / Game.SIZE.y)))) { lefts[i] = true; } else { lefts[i] = false; } if (right.contains( Gdx.input.getX(i) * (MyConstants.WOLRD_WIDTH / Game.SIZE.x), MyConstants.WORLD_HEIGHT - (Gdx.input.getY(i) * (MyConstants.WORLD_HEIGHT / Game.SIZE.y)))) { rights[i] = true; } else { rights[i] = false; } if (shoot.contains( Gdx.input.getX(i) * (MyConstants.WOLRD_WIDTH / Game.SIZE.x), MyConstants.WORLD_HEIGHT - (Gdx.input.getY(i) * (MyConstants.WORLD_HEIGHT / Game.SIZE.y)))) { shoots[i] = true; } else { shoots[i] = false; } if (jump.contains( Gdx.input.getX(i) * (MyConstants.WOLRD_WIDTH / Game.SIZE.x), MyConstants.WORLD_HEIGHT - (Gdx.input.getY(i) * (MyConstants.WORLD_HEIGHT / Game.SIZE.y)))) { jumps[i] = true; } else { jumps[i] = false; } if (start.contains( Gdx.input.getX(i) * (MyConstants.WOLRD_WIDTH / Game.SIZE.x), MyConstants.WORLD_HEIGHT - (Gdx.input.getY(i) * (MyConstants.WORLD_HEIGHT / Game.SIZE.y)))) { starts[i] = true; } else { starts[i] = false; } } else { lefts[i] = false; rights[i] = false; shoots[i] = false; jumps[i] = false; starts[i] = false; } } MyInput.setKey(MyConstants.booleanArrayContains(true, lefts), MyInput.LEFT); MyInput.setKey(MyConstants.booleanArrayContains(true, rights), MyInput.RIGHT); MyInput.setKey(MyConstants.booleanArrayContains(true, shoots), MyInput.SHOOT); MyInput.setKey(MyConstants.booleanArrayContains(true, jumps), MyInput.JUMP); MyInput.setKey(MyConstants.booleanArrayContains(true, starts), MyInput.START); }