aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-11-26 06:36:48 +0100
committerMattias Andrée <maandree@operamail.com>2013-11-26 06:36:53 +0100
commit45f87a24d576fb484361e62183d2d2283ec55707 (patch)
treefe00c62ccdb50092dc62c410199f842b40afa445
parentfirst commit (diff)
downloadrotation3d-45f87a24d576fb484361e62183d2d2283ec55707.tar.gz
rotation3d-45f87a24d576fb484361e62183d2d2283ec55707.tar.bz2
rotation3d-45f87a24d576fb484361e62183d2d2283ec55707.tar.xz
add global speed modifier
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/v/D3.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/v/D3.java b/src/v/D3.java
index 0ba9815..3b918a8 100644
--- a/src/v/D3.java
+++ b/src/v/D3.java
@@ -51,6 +51,7 @@ public class D3
static int rx = 0;
static int ry = 0;
static int rxy = 0;
+ static int rg = 0;
public static void main(String... args) throws InterruptedException
{
@@ -196,6 +197,8 @@ public class D3
case KeyEvent.VK_S: ry = 0; break;
case KeyEvent.VK_E: rxy = 0; break;
case KeyEvent.VK_Q: rxy = 0; break;
+ case KeyEvent.VK_F: rg = 0; break;
+ case KeyEvent.VK_C: rg = 0; break;
}
}
@@ -209,6 +212,8 @@ public class D3
case KeyEvent.VK_S: ry = -1; break;
case KeyEvent.VK_E: rxy = +1; break;
case KeyEvent.VK_Q: rxy = -1; break;
+ case KeyEvent.VK_F: rg = +1; break;
+ case KeyEvent.VK_C: rg = -1; break;
case KeyEvent.VK_R:
rotation_speed = 0;
@@ -245,6 +250,11 @@ public class D3
rotation = normalise(v);
}
+ if (rg == 1)
+ rotation_speed *= 1.1f;
+ else if (rg == -1)
+ rotation_speed /= 1.1f;
+
if (rotation_speed != 0)
transform(createRotation(rotation, rotation_speed));