|
From: <tre...@us...> - 2007-12-04 17:00:49
|
Revision: 619
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=619&view=rev
Author: trevorolio
Date: 2007-12-04 09:00:52 -0800 (Tue, 04 Dec 2007)
Log Message:
-----------
Added a fix for the sad case where the viewer does not get a message that it lost focus so it loses keyboard state, causing people to continue on whatever motion they were on. Now when we press a key for motion in one direction it negates the oposite motion, so if you do start spinning out of control and you try to spin in the oposite direction then the right thing happens.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/MotionInputHandler.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/MotionInputHandler.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/MotionInputHandler.java 2007-12-04 16:58:14 UTC (rev 618)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/MotionInputHandler.java 2007-12-04 17:00:52 UTC (rev 619)
@@ -143,41 +143,55 @@
if (moveForward == false) {
dirty = true;
moveForward = true;
+ moveBackward = false;
}
} else if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_S) {
if (moveBackward == false) {
dirty = true;
+ moveForward = false;
moveBackward = true;
}
} else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_Q) {
if (turnLeft == false) {
dirty = true;
turnLeft = true;
+ turnRight = false;
}
} else if (e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_E) {
if (turnRight == false) {
dirty = true;
+ turnLeft = false;
turnRight = true;
}
} else if (e.getKeyCode() == KeyEvent.VK_A) {
if (strafeLeft == false) {
dirty = true;
strafeLeft = true;
+ strafeRight = false;
}
} else if (e.getKeyCode() == KeyEvent.VK_D) {
if (strafeRight == false) {
dirty = true;
+ strafeLeft = false;
strafeRight = true;
}
} else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
cameraDirty = true;
cameraReset = true;
cameraZoom = 0;
+ moveForward = false;
+ moveBackward = false;
+ turnLeft = false;
+ turnRight = false;
+ strafeLeft = false;
+ strafeRight = false;
} else if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_SLASH) {
if (moveBackward || moveForward || strafeLeft || strafeRight) {
dirty = true;
+ moveForward = false;
moveBackward = false;
- moveForward = false;
+ turnLeft = false;
+ turnRight = false;
strafeLeft = false;
strafeRight = false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|