X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=sidebyside;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2FGameProc.java;h=b100ddc77251572ddee3e4e54d8cde36ce5e2542;hb=792296717939ac50df33865ae3acbb010e812ad1;hp=7ded79faf697495940d013d2092fb44857ad2dde;hpb=385255cc7b49fbfd3290497367cbc69919b24d4f;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java index 7ded79f..b100ddc 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java @@ -2,7 +2,6 @@ package ru.deadsoftware.cavecraft.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; -import com.badlogic.gdx.math.RandomXS128; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.TimeUtils; import ru.deadsoftware.cavecraft.*; @@ -26,25 +25,37 @@ public class GameProc { public int invSlot; public int ctrlMode; - public boolean isTouchDown = false; - public int touchDownX, touchDownY; + public boolean isTouchDown, isKeyDown; + public int touchDownX, touchDownY, keyDownCode; public int touchDownButton; public long touchDownTime; public GameProc() { world = new GameWorld(1024,256); - renderer = new GameRenderer(this); + if (CaveGame.TOUCH) { + renderer = new GameRenderer(this,320, + 320*((float)GameScreen.getHeight()/GameScreen.getWidth())); + } else { + renderer = new GameRenderer(this,480, + 480*((float)GameScreen.getHeight()/GameScreen.getWidth())); + } physics = new GamePhysics(this); player = new Player(world.getSpawnPoint()); mobs = new Array(); - for (int i=0; i<1024/64; i++) { - mobs.add(new Pig(i*16*64, 0, world)); + for (int i=0; i= world.getWidth()) cursorX = world.getWidth()-1; if (cursorY < 0) cursorY = 0; if (cursorY >= world.getHeight()) cursorY = world.getHeight()-1; - if (cursorX<(player.position.x+player.texWidth/2)/16) - player.dir=0; - if (cursorX>(player.position.x+player.texWidth/2)/16) - player.dir=1; + if (ctrlMode==1) { + if (cursorX*16+8player.position.x+player.texWidth/2) + player.dir=1; + } } public void update(float delta) {