add inputProcesser
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user