This is a big commit. Added mouse cursors and a load bar. Started whit the game. and many many other things
This commit is contained in:
parent
448fca2fdf
commit
4e7722fedb
34 changed files with 597 additions and 95 deletions
54
src/ei/game/input/InGameMouseInput.java
Normal file
54
src/ei/game/input/InGameMouseInput.java
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package ei.game.input;
|
||||
|
||||
import ei.engine.LWJGLGameWindow;
|
||||
import ei.engine.input.MouseInput;
|
||||
import ei.engine.scene.Sprite;
|
||||
|
||||
public class InGameMouseInput extends MouseInput{
|
||||
private static final int CAMERA_MOVE_BORDER = 40;
|
||||
private static final float CAMERA_MOVE_SPEED = 6.0f;
|
||||
|
||||
public InGameMouseInput() {
|
||||
super("InGameMouseInput","data/cursor.png");
|
||||
Sprite s = getSprite();
|
||||
s.getTexture().setTextureWidth(50);
|
||||
s.getTexture().setTextureHeight(50);
|
||||
s.getTexture().setWidth(50);
|
||||
s.getTexture().setHeight(50);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUpdate(int x, int y, int w) {
|
||||
// mov cam to the left
|
||||
if(x < CAMERA_MOVE_BORDER){
|
||||
LWJGLGameWindow.getCamera().getLocation().add(-CAMERA_MOVE_SPEED,0,0);
|
||||
}
|
||||
// mov cam to the right
|
||||
if(x > LWJGLGameWindow.getWidth()-CAMERA_MOVE_BORDER){
|
||||
LWJGLGameWindow.getCamera().getLocation().add(CAMERA_MOVE_SPEED,0,0);
|
||||
}
|
||||
// mov cam upp
|
||||
if(y < CAMERA_MOVE_BORDER){
|
||||
LWJGLGameWindow.getCamera().getLocation().add(0,CAMERA_MOVE_SPEED,0);
|
||||
}
|
||||
// mov cam down
|
||||
if(y > LWJGLGameWindow.getHeight()-CAMERA_MOVE_BORDER){
|
||||
LWJGLGameWindow.getCamera().getLocation().add(0,-CAMERA_MOVE_SPEED,0);
|
||||
}
|
||||
//System.out.println(x+"-"+y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDown(int event,int x, int y) {
|
||||
System.out.println("DOWN("+event+"): "+x+"-"+y);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(int event,int x, int y) {
|
||||
System.out.println("UP("+event+"): "+x+"-"+y);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue