about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <git@lukasepple.de>2019-05-20 13:00:08 +0200
committersternenseemann <git@lukasepple.de>2019-05-20 13:20:41 +0200
commitec0e3ce7b690c7b5ade831e2992492c5ea12470e (patch)
tree1e64e0ba044411257ebb9b3912a8262a65b217da
parent860e7370aa50d20f85709f62406ea115ea06bc62 (diff)
rotate in steps that have pi as multiple
-rw-r--r--src/Main.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs
index fcbf244..b4e4742 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -64,11 +64,13 @@ eventHandler (EventKey key Down _ _) state = state
   , graphics = (graphics state) { glossCenterView = centerView }
   }
     where f = Just . f' . fromMaybe (0, 0)
+          accStep = 1
+          rotStep = pi / 10
           f' = case key of
-                SpecialKey KeyUp -> \(rot, acc) -> (rot, acc + 1)
-                SpecialKey KeyDown -> \(rot, acc) -> (rot, acc - 1)
-                SpecialKey KeyLeft -> \(rot, acc) -> (rot + 0.1, acc)
-                SpecialKey KeyRight -> \(rot, acc) -> (rot - 0.1, acc)
+                SpecialKey KeyUp -> \(rot, acc) -> (rot, acc + accStep)
+                SpecialKey KeyDown -> \(rot, acc) -> (rot, acc - accStep)
+                SpecialKey KeyLeft -> \(rot, acc) -> (rot + rotStep, acc)
+                SpecialKey KeyRight -> \(rot, acc) -> (rot - rotStep, acc)
                 _                   -> id
           centerView = (if key == (Char 'c') then not else id)
             . glossCenterView . graphics $ state