I also have a question about mouse input.
I can't seem to get the correct relative mouse position.
if I use event queue for the mouse it almost works, but when I hold my mouse still I still get realtive movemnt of atleast 1.0f;
if I use this approatch:
1 2 3
| m_mouse.poll(); m_deltaMouse.x = m_mouse.getX().getPollData() m_deltaMouse.y = m_mouse.getY().getPollData() |
the values are constant 0.0 in both X and Y.
I use windows xp.
my test app looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| public static void main( String[]args) { JFrame f = new JFrame("This is a test"); f.setSize(1024, 768); Container content = f.getContentPane(); content.setBackground(Color.white); f.addWindowListener(new ExitListener()); f.setVisible(true); while( true ) { Input.getInstance().capture(); if( Input.getInstance().getKeyboard().isKeyDown(Identifier.Key.Q)) { System.exit(0); break; } System.out.println("delta mouse x : "+Input.getInstance().getMouse().getDelta().x ); System.out.println("delta mouse y : "+Input.getInstance().getMouse().getDelta().y ); System.out.println("\ndead zone x : "+Input.getInstance().getMouse().getDeadZone().x ); System.out.println("\ndead zone y : "+Input.getInstance().getMouse().getDeadZone().y ); } }
} class ExitListener extends WindowAdapter { public void windowClosing(WindowEvent event) { System.exit(0); } } |
btw: I don't check mouse and keyboard poll in the same loop, does the getEventQueue() "steal events", feels likt that's not the case
