v0.7.5e: added scroll wheel support
This commit is contained in:
@@ -23,12 +23,14 @@ package com.watabou.input;
|
||||
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.utils.PointF;
|
||||
|
||||
public class InputHandler extends InputAdapter {
|
||||
|
||||
public void processAllEvents(){
|
||||
PointerEvent.processPointerEvents();
|
||||
KeyEvent.processKeyEvents();
|
||||
ScrollEvent.processScrollEvents();
|
||||
}
|
||||
|
||||
// *********************
|
||||
@@ -59,6 +61,18 @@ public class InputHandler extends InputAdapter {
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO tracking this should probably be in PointerEvent
|
||||
private static PointF pointerHoverPos = new PointF();
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
screenX /= (Game.dispWidth / (float)Game.width);
|
||||
screenY /= (Game.dispHeight / (float)Game.height);
|
||||
pointerHoverPos.x = screenX;
|
||||
pointerHoverPos.y = screenY;
|
||||
return true;
|
||||
}
|
||||
|
||||
// *****************
|
||||
// *** Key Input ***
|
||||
// *****************
|
||||
@@ -85,4 +99,13 @@ public class InputHandler extends InputAdapter {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ********************
|
||||
// *** Scroll Input ***
|
||||
// ********************
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
ScrollEvent.addScrollEvent( new ScrollEvent(pointerHoverPos, amount));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user