diff options
-rw-r--r-- | MeshSketch.hs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/MeshSketch.hs b/MeshSketch.hs index 571cffe..331d435 100644 --- a/MeshSketch.hs +++ b/MeshSketch.hs | |||
@@ -5,6 +5,7 @@ module MeshSketch where | |||
5 | 5 | ||
6 | import Control.Monad | 6 | import Control.Monad |
7 | import Data.Coerce | 7 | import Data.Coerce |
8 | import Data.Functor | ||
8 | import Data.IORef | 9 | import Data.IORef |
9 | import Foreign.C.Types | 10 | import Foreign.C.Types |
10 | import GI.Gdk | 11 | import GI.Gdk |
@@ -131,16 +132,17 @@ onEvent w st ev = do | |||
131 | 132 | ||
132 | EventTypeKeyPress -> do | 133 | EventTypeKeyPress -> do |
133 | kev <- get ev #key | 134 | kev <- get ev #key |
134 | val <- get kev #keyval | 135 | val <- get kev #keyval <&> \k -> if k > 0x5A then k - 0x20 else k |
135 | if (val `elem` [KEY_N,KEY_n]) then do | 136 | case val of |
136 | modifyIORef' (stSkybox st) $ \n -> (n + 1) `mod` (skyboxCount $ stSkyboxes st) | 137 | KEY_N -> do |
137 | idx <- readIORef (stSkybox st) | 138 | modifyIORef' (stSkybox st) $ \n -> (n + 1) `mod` (skyboxCount $ stSkyboxes st) |
138 | put (skyboxNames (stSkyboxes st) !! idx) | 139 | idx <- readIORef (stSkybox st) |
139 | return () | 140 | put (skyboxNames (stSkyboxes st) !! idx) |
140 | else when (val `elem` [KEY_F,KEY_f]) $ do | 141 | return () |
141 | put 'F' | 142 | KEY_F -> do |
142 | stFullscreen st | 143 | put 'F' |
143 | return () | 144 | stFullscreen st |
145 | _ -> return () | ||
144 | 146 | ||
145 | e -> return () | 147 | e -> return () |
146 | 148 | ||
@@ -153,4 +155,3 @@ mkFullscreenToggle w = do | |||
153 | b <- atomicModifyIORef' full $ \b -> (not b, not b) | 155 | b <- atomicModifyIORef' full $ \b -> (not b, not b) |
154 | if b then windowFullscreen w | 156 | if b then windowFullscreen w |
155 | else windowUnfullscreen w | 157 | else windowUnfullscreen w |
156 | |||