diff --git a/core/src/netwerkprog/game/client/MainGame.java b/core/src/netwerkprog/game/client/MainGame.java index 0f280b8..16a53ad 100644 --- a/core/src/netwerkprog/game/client/MainGame.java +++ b/core/src/netwerkprog/game/client/MainGame.java @@ -17,7 +17,7 @@ import netwerkprog.game.client.game.map.MapRenderer; import netwerkprog.game.client.map.GameInputProcessor; import netwerkprog.game.util.graphics.FrameRate; -public class MainGame extends ApplicationAdapter { +public class MainGame extends ApplicationAdapter{ SpriteBatch batch; float screenWidth; float screenHeight; @@ -148,4 +148,6 @@ public class MainGame extends ApplicationAdapter { public int getHorizontalTileAmount() { return map.getWidth(); } + + } diff --git a/core/src/netwerkprog/game/util/application/InputTransform.java b/core/src/netwerkprog/game/util/application/InputTransform.java new file mode 100644 index 0000000..1faad11 --- /dev/null +++ b/core/src/netwerkprog/game/util/application/InputTransform.java @@ -0,0 +1,12 @@ +package netwerkprog.game.util.application; + +public class InputTransform { + + public static float getCursorToModelX(int screenwidth, int screenX, int cursorX) { + return (((float) cursorX) * screenwidth) / ((float) screenX); + } + + public static float getCursorToModelY(int screenHeight, int screenY, int cursorY) { + return ((float) (screenY - cursorY)) * screenHeight / ((float) screenY); + } +} \ No newline at end of file