fixed displaymode
using grabbed mouse mode empty mouse buffer
This commit is contained in:
parent
5a01a1313a
commit
47200a16c7
|
@ -50,9 +50,6 @@ public class MouseCreationTest {
|
||||||
/** position of quad to draw */
|
/** position of quad to draw */
|
||||||
private Vector2f position = new Vector2f(320.0f, 240.0f);
|
private Vector2f position = new Vector2f(320.0f, 240.0f);
|
||||||
|
|
||||||
/** Display mode selected */
|
|
||||||
private DisplayMode displayMode;
|
|
||||||
|
|
||||||
/** Creates a new instance of MouseTest */
|
/** Creates a new instance of MouseTest */
|
||||||
public MouseCreationTest() {
|
public MouseCreationTest() {
|
||||||
}
|
}
|
||||||
|
@ -62,6 +59,7 @@ public class MouseCreationTest {
|
||||||
setDisplayMode();
|
setDisplayMode();
|
||||||
Display.setFullscreen(fullscreen);
|
Display.setFullscreen(fullscreen);
|
||||||
Display.create();
|
Display.create();
|
||||||
|
Mouse.setGrabbed(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
|
@ -118,7 +116,6 @@ public class MouseCreationTest {
|
||||||
try {
|
try {
|
||||||
Display.destroy();
|
Display.destroy();
|
||||||
initialize(true);
|
initialize(true);
|
||||||
Display.setDisplayMode(displayMode);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -148,6 +145,9 @@ public class MouseCreationTest {
|
||||||
while (Sys.getTime() < endtime) {
|
while (Sys.getTime() < endtime) {
|
||||||
Display.update();
|
Display.update();
|
||||||
|
|
||||||
|
// empty mouse buffer
|
||||||
|
while(Mouse.next());
|
||||||
|
|
||||||
position.x += Mouse.getDX();
|
position.x += Mouse.getDX();
|
||||||
position.y += Mouse.getDY();
|
position.y += Mouse.getDY();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue