aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Demos/Pong/Main.hs34
-rw-r--r--Demos/Pong/Pong.hs16
-rw-r--r--Spear/App.hs10
-rw-r--r--Spear/Step.hs42
-rw-r--r--Spear/Window.hs246
5 files changed, 171 insertions, 177 deletions
diff --git a/Demos/Pong/Main.hs b/Demos/Pong/Main.hs
index 4dbe0a3..ee0f8d8 100644
--- a/Demos/Pong/Main.hs
+++ b/Demos/Pong/Main.hs
@@ -2,20 +2,20 @@
2 2
3module Main where 3module Main where
4 4
5import Data.Maybe (mapMaybe) 5import Data.Maybe (mapMaybe)
6import Graphics.Rendering.OpenGL.GL (($=)) 6import Graphics.Rendering.OpenGL.GL (($=))
7import Graphics.Rendering.OpenGL.GL qualified as GL 7import qualified Graphics.Rendering.OpenGL.GL as GL
8import Pong 8import Pong
9import Spear.App 9import Spear.App
10import Spear.Game 10import Spear.Game
11import Spear.Math.AABB 11import Spear.Math.AABB
12import Spear.Math.Spatial2 12import Spear.Math.Spatial2
13import Spear.Math.Vector 13import Spear.Math.Vector
14import Spear.Window 14import Spear.Window
15 15
16data GameState = GameState 16data GameState = GameState
17 { window :: Window, 17 { window :: Window,
18 world :: [GameObject] 18 world :: [GameObject]
19 } 19 }
20 20
21main = 21main =
@@ -53,7 +53,7 @@ renderGO go = do
53 (xmin, ymin, xmax, ymax) = (f2d xmin', f2d ymin', f2d xmax', f2d ymax') 53 (xmin, ymin, xmax, ymax) = (f2d xmin', f2d ymin', f2d xmax', f2d ymax')
54 GL.preservingMatrix $ do 54 GL.preservingMatrix $ do
55 GL.translate (GL.Vector3 (f2d xcenter) (f2d ycenter) 0) 55 GL.translate (GL.Vector3 (f2d xcenter) (f2d ycenter) 0)
56 GL.renderPrimitive (GL.TriangleStrip) $ do 56 GL.renderPrimitive GL.TriangleStrip $ do
57 GL.vertex (GL.Vertex2 xmin ymax) 57 GL.vertex (GL.Vertex2 xmin ymax)
58 GL.vertex (GL.Vertex2 xmin ymin) 58 GL.vertex (GL.Vertex2 xmin ymin)
59 GL.vertex (GL.Vertex2 xmax ymax) 59 GL.vertex (GL.Vertex2 xmax ymax)
@@ -71,13 +71,13 @@ procEvent _ = return ()
71 71
72translate = mapMaybe translate' 72translate = mapMaybe translate'
73 73
74translate' (KeyDown KEY_LEFT) = Just MoveLeft 74translate' (KeyDown KEY_LEFT) = Just MoveLeft
75translate' (KeyDown KEY_RIGHT) = Just MoveRight 75translate' (KeyDown KEY_RIGHT) = Just MoveRight
76translate' (KeyUp KEY_LEFT) = Just StopLeft 76translate' (KeyUp KEY_LEFT) = Just StopLeft
77translate' (KeyUp KEY_RIGHT) = Just StopRight 77translate' (KeyUp KEY_RIGHT) = Just StopRight
78translate' _ = Nothing 78translate' _ = Nothing
79 79
80exitRequested = any (== (KeyDown KEY_ESC)) 80exitRequested = elem (KeyDown KEY_ESC)
81 81
82f2d :: Float -> GL.GLdouble 82f2d :: Float -> GL.GLdouble
83f2d = realToFrac 83f2d = realToFrac
diff --git a/Demos/Pong/Pong.hs b/Demos/Pong/Pong.hs
index b048bbc..fd7fbeb 100644
--- a/Demos/Pong/Pong.hs
+++ b/Demos/Pong/Pong.hs
@@ -7,12 +7,12 @@ module Pong
7 ) 7 )
8where 8where
9 9
10import Data.Monoid (mconcat) 10import Data.Monoid (mconcat)
11import GHC.Float (double2Float) 11import GHC.Float (double2Float)
12import Spear.Math.AABB 12import Spear.Math.AABB
13import Spear.Math.Spatial2 13import Spear.Math.Spatial2
14import Spear.Math.Vector 14import Spear.Math.Vector
15import Spear.Step 15import Spear.Step
16 16
17-- Configuration 17-- Configuration
18 18
@@ -42,8 +42,8 @@ data GameEvent
42-- Game objects 42-- Game objects
43 43
44data GameObject = GameObject 44data GameObject = GameObject
45 { aabb :: AABB2, 45 { aabb :: AABB2,
46 obj :: Obj2, 46 obj :: Obj2,
47 gostep :: Step [GameObject] [GameEvent] GameObject GameObject 47 gostep :: Step [GameObject] [GameEvent] GameObject GameObject
48 } 48 }
49 49
diff --git a/Spear/App.hs b/Spear/App.hs
index dc17dec..ca9a355 100644
--- a/Spear/App.hs
+++ b/Spear/App.hs
@@ -6,11 +6,11 @@ module Spear.App
6 ) 6 )
7where 7where
8 8
9import Control.Monad 9import Control.Monad
10import GHC.Float 10import GHC.Float
11import Spear.Game 11import Spear.Game
12import Spear.Sys.Timer as Timer 12import Spear.Sys.Timer as Timer
13import Spear.Window 13import Spear.Window
14 14
15maxFPS = 60 15maxFPS = 60
16 16
diff --git a/Spear/Step.hs b/Spear/Step.hs
index 7419d9e..609f387 100644
--- a/Spear/Step.hs
+++ b/Spear/Step.hs
@@ -26,10 +26,10 @@ module Spear.Step
26 ) 26 )
27where 27where
28 28
29import Data.List (foldl') 29import Data.List (foldl')
30import Data.Map (Map) 30import Data.Map (Map)
31import qualified Data.Map as Map 31import qualified Data.Map as Map
32import Data.Monoid 32import Data.Monoid
33 33
34type Elapsed = Double 34type Elapsed = Double
35 35
@@ -51,11 +51,6 @@ instance Semigroup (Step s e a a) where
51instance Monoid (Step s e a a) where 51instance Monoid (Step s e a a) where
52 mempty = sid 52 mempty = sid
53 53
54 mappend (Step s1) (Step s2) = Step $ \elapsed dt g e a ->
55 let (b, s1') = s1 elapsed dt g e a
56 (c, s2') = s2 elapsed dt g e b
57 in (c, mappend s1' s2')
58
59-- | Construct a step from a function. 54-- | Construct a step from a function.
60step :: (Elapsed -> Dt -> s -> e -> a -> (b, Step s e a b)) -> Step s e a b 55step :: (Elapsed -> Dt -> s -> e -> a -> (b, Step s e a b)) -> Step s e a b
61step = Step 56step = Step
@@ -70,11 +65,11 @@ spure f = Step $ \_ _ _ _ x -> (f x, spure f)
70 65
71-- | The step that returns the first component in the tuple. 66-- | The step that returns the first component in the tuple.
72sfst :: Step s e (a, b) a 67sfst :: Step s e (a, b) a
73sfst = spure $ \(a, _) -> a 68sfst = spure fst
74 69
75-- | The step that returns the second component in the tuple. 70-- | The step that returns the second component in the tuple.
76ssnd :: Step s e (a, b) b 71ssnd :: Step s e (a, b) b
77ssnd = spure $ \(_, b) -> b 72ssnd = spure snd
78 73
79-- | Construct a step that folds a given list of inputs. 74-- | Construct a step that folds a given list of inputs.
80-- 75--
@@ -97,7 +92,7 @@ sfold' ::
97 a -> 92 a ->
98 [e] -> 93 [e] ->
99 (a, Step s (Maybe e) a a) 94 (a, Step s (Maybe e) a a)
100sfold' elapsed dt g s a es = foldl' f (a', s') es 95sfold' elapsed dt g s a = foldl' f (a', s')
101 where 96 where
102 f (a, s) e = runStep s elapsed dt g (Just e) a 97 f (a, s) e = runStep s elapsed dt g (Just e) a
103 (a', s') = runStep s elapsed dt g Nothing a 98 (a', s') = runStep s elapsed dt g Nothing a
@@ -128,19 +123,19 @@ szip f (Step s1) (Step s2) = Step $ \elapsed dt g e d ->
128switch :: 123switch ::
129 Eq e => 124 Eq e =>
130 e -> 125 e ->
131 (Step s (Maybe e) a a) -> 126 Step s (Maybe e) a a ->
132 e -> 127 e ->
133 (Step s (Maybe e) a a) -> 128 Step s (Maybe e) a a ->
134 Step s (Maybe e) a a 129 Step s (Maybe e) a a
135switch flag1 s1 flag2 s2 = switch' s1 flag1 s1 flag2 s2 130switch flag1 s1 flag2 s2 = switch' s1 flag1 s1 flag2 s2
136 131
137switch' :: 132switch' ::
138 Eq e => 133 Eq e =>
139 (Step s (Maybe e) a a) -> 134 Step s (Maybe e) a a ->
140 e -> 135 e ->
141 (Step s (Maybe e) a a) -> 136 Step s (Maybe e) a a ->
142 e -> 137 e ->
143 (Step s (Maybe e) a a) -> 138 Step s (Maybe e) a a ->
144 Step s (Maybe e) a a 139 Step s (Maybe e) a a
145switch' cur flag1 s1 flag2 s2 = Step $ \elapsed dt g e a -> 140switch' cur flag1 s1 flag2 s2 = Step $ \elapsed dt g e a ->
146 case e of 141 case e of
@@ -148,13 +143,10 @@ switch' cur flag1 s1 flag2 s2 = Step $ \elapsed dt g e a ->
148 let (a', s') = runStep cur elapsed dt g Nothing a 143 let (a', s') = runStep cur elapsed dt g Nothing a
149 in (a', switch' s' flag1 s1 flag2 s2) 144 in (a', switch' s' flag1 s1 flag2 s2)
150 Just e' -> 145 Just e' ->
151 let next = 146 let next
152 if e' == flag1 147 | e' == flag1 = s1
153 then s1 148 | e' == flag2 = s2
154 else 149 | otherwise = cur
155 if e' == flag2
156 then s2
157 else cur
158 (a', s') = runStep next elapsed dt g e a 150 (a', s') = runStep next elapsed dt g e a
159 in (a', switch' s' flag1 s1 flag2 s2) 151 in (a', switch' s' flag1 s1 flag2 s2)
160 152
@@ -179,6 +171,6 @@ multiSwitch' curKey cur m = Step $ \elapsed dt g e a ->
179 Just s -> 171 Just s ->
180 let (a', s') = runStep s elapsed dt g e a 172 let (a', s') = runStep s elapsed dt g e a
181 m' = case curKey of 173 m' = case curKey of
182 Nothing -> m 174 Nothing -> m
183 Just key -> Map.insert key cur m 175 Just key -> Map.insert key cur m
184 in (a', multiSwitch' e s' m') 176 in (a', multiSwitch' e s' m')
diff --git a/Spear/Window.hs b/Spear/Window.hs
index a6471b0..ec90a2f 100644
--- a/Spear/Window.hs
+++ b/Spear/Window.hs
@@ -28,12 +28,12 @@ module Spear.Window
28 ) 28 )
29where 29where
30 30
31import Control.Concurrent.MVar 31import Control.Concurrent.MVar
32import Control.Exception 32import Control.Exception
33import Control.Monad (foldM, unless, void, when) 33import Control.Monad (foldM, unless, void, when)
34import Data.Maybe (fromJust, fromMaybe, isJust) 34import Data.Maybe (fromJust, fromMaybe, isJust)
35import qualified Graphics.UI.GLFW as GLFW 35import qualified Graphics.UI.GLFW as GLFW
36import Spear.Game 36import Spear.Game
37 37
38type Width = Int 38type Width = Int
39 39
@@ -59,9 +59,9 @@ instance Exception WindowException
59 59
60-- | A window. 60-- | A window.
61data Window = Window 61data Window = Window
62 { glfwWindow :: GLFW.Window, 62 { glfwWindow :: GLFW.Window,
63 closeRequest :: CloseRequest, 63 closeRequest :: CloseRequest,
64 inputEvents :: MVar [InputEvent] 64 inputEvents :: MVar [InputEvent]
65 } 65 }
66 66
67withWindow :: 67withWindow ::
@@ -118,7 +118,7 @@ pollEvents window = do
118 GLFW.pollEvents 118 GLFW.pollEvents
119 events <- 119 events <-
120 tryTakeMVar (inputEvents window) >>= \xs -> case xs of 120 tryTakeMVar (inputEvents window) >>= \xs -> case xs of
121 Nothing -> return [] 121 Nothing -> return []
122 Just events -> return events 122 Just events -> return events
123 putMVar (inputEvents window) [] 123 putMVar (inputEvents window) []
124 return events 124 return events
@@ -154,14 +154,14 @@ onMouseButton events window button GLFW.MouseButtonState'Pressed _ = addEvent ev
154onMouseButton events window button GLFW.MouseButtonState'Released _ = addEvent events $ MouseUp (fromGLFWbutton button) 154onMouseButton events window button GLFW.MouseButtonState'Released _ = addEvent events $ MouseUp (fromGLFWbutton button)
155 155
156onMouseMove :: MVar [InputEvent] -> IO GLFW.CursorPosCallback 156onMouseMove :: MVar [InputEvent] -> IO GLFW.CursorPosCallback
157onMouseMove events = newEmptyMVar >>= return . flip onMouseMove' events 157onMouseMove events = newEmptyMVar <&> flip onMouseMove' events
158 158
159onMouseMove' :: MVar MousePos -> MVar [InputEvent] -> GLFW.CursorPosCallback 159onMouseMove' :: MVar MousePos -> MVar [InputEvent] -> GLFW.CursorPosCallback
160onMouseMove' oldPos events window x y = do 160onMouseMove' oldPos events window x y = do
161 (old_x, old_y) <- 161 (old_x, old_y) <-
162 tryTakeMVar oldPos >>= \old -> case old of 162 tryTakeMVar oldPos >>= \old -> case old of
163 Nothing -> return (x, y) 163 Nothing -> return (x, y)
164 Just p -> return p 164 Just p -> return p
165 let delta = (x - old_x, y - old_y) 165 let delta = (x - old_x, y - old_y)
166 putMVar oldPos (x, y) 166 putMVar oldPos (x, y)
167 addEvent events $ MouseMove (x, y) delta 167 addEvent events $ MouseMove (x, y) delta
@@ -172,7 +172,7 @@ replaceMVar mvar val = tryTakeMVar mvar >> putMVar mvar val
172addEvent :: MVar [a] -> a -> IO () 172addEvent :: MVar [a] -> a -> IO ()
173addEvent mvar val = 173addEvent mvar val =
174 tryTakeMVar mvar >>= \xs -> case xs of 174 tryTakeMVar mvar >>= \xs -> case xs of
175 Nothing -> putMVar mvar [val] 175 Nothing -> putMVar mvar [val]
176 Just events -> putMVar mvar (val : events) 176 Just events -> putMVar mvar (val : events)
177 177
178-- Input 178-- Input
@@ -198,7 +198,8 @@ processKeys window = foldM f []
198 f acc (key, result) = do 198 f acc (key, result) = do
199 isDown <- 199 isDown <-
200 fmap (== GLFW.KeyState'Pressed) $ 200 fmap (== GLFW.KeyState'Pressed) $
201 gameIO . GLFW.getKey window . toGLFWkey $ key 201 gameIO . GLFW.getKey window . toGLFWkey $
202 key
202 return $ if isDown then result : acc else acc 203 return $ if isDown then result : acc else acc
203 204
204-- | Process the mouse buttons, returning those values for which their 205-- | Process the mouse buttons, returning those values for which their
@@ -209,7 +210,8 @@ processButtons window = foldM f []
209 f acc (button, result) = do 210 f acc (button, result) = do
210 isDown <- 211 isDown <-
211 fmap (== GLFW.MouseButtonState'Pressed) $ 212 fmap (== GLFW.MouseButtonState'Pressed) $
212 gameIO . GLFW.getMouseButton window . toGLFWbutton $ button 213 gameIO . GLFW.getMouseButton window . toGLFWbutton $
214 button
213 return $ if isDown then result : acc else acc 215 return $ if isDown then result : acc else acc
214 216
215data InputEvent 217data InputEvent
@@ -290,61 +292,61 @@ type MousePos = (Double, Double)
290type MouseDelta = (Double, Double) 292type MouseDelta = (Double, Double)
291 293
292fromGLFWkey :: GLFW.Key -> Key 294fromGLFWkey :: GLFW.Key -> Key
293fromGLFWkey GLFW.Key'A = KEY_A 295fromGLFWkey GLFW.Key'A = KEY_A
294fromGLFWkey GLFW.Key'B = KEY_B 296fromGLFWkey GLFW.Key'B = KEY_B
295fromGLFWkey GLFW.Key'C = KEY_C 297fromGLFWkey GLFW.Key'C = KEY_C
296fromGLFWkey GLFW.Key'D = KEY_D 298fromGLFWkey GLFW.Key'D = KEY_D
297fromGLFWkey GLFW.Key'E = KEY_E 299fromGLFWkey GLFW.Key'E = KEY_E
298fromGLFWkey GLFW.Key'F = KEY_F 300fromGLFWkey GLFW.Key'F = KEY_F
299fromGLFWkey GLFW.Key'G = KEY_G 301fromGLFWkey GLFW.Key'G = KEY_G
300fromGLFWkey GLFW.Key'H = KEY_H 302fromGLFWkey GLFW.Key'H = KEY_H
301fromGLFWkey GLFW.Key'I = KEY_I 303fromGLFWkey GLFW.Key'I = KEY_I
302fromGLFWkey GLFW.Key'J = KEY_J 304fromGLFWkey GLFW.Key'J = KEY_J
303fromGLFWkey GLFW.Key'K = KEY_K 305fromGLFWkey GLFW.Key'K = KEY_K
304fromGLFWkey GLFW.Key'L = KEY_L 306fromGLFWkey GLFW.Key'L = KEY_L
305fromGLFWkey GLFW.Key'M = KEY_M 307fromGLFWkey GLFW.Key'M = KEY_M
306fromGLFWkey GLFW.Key'N = KEY_N 308fromGLFWkey GLFW.Key'N = KEY_N
307fromGLFWkey GLFW.Key'O = KEY_O 309fromGLFWkey GLFW.Key'O = KEY_O
308fromGLFWkey GLFW.Key'P = KEY_P 310fromGLFWkey GLFW.Key'P = KEY_P
309fromGLFWkey GLFW.Key'Q = KEY_Q 311fromGLFWkey GLFW.Key'Q = KEY_Q
310fromGLFWkey GLFW.Key'R = KEY_R 312fromGLFWkey GLFW.Key'R = KEY_R
311fromGLFWkey GLFW.Key'S = KEY_S 313fromGLFWkey GLFW.Key'S = KEY_S
312fromGLFWkey GLFW.Key'T = KEY_T 314fromGLFWkey GLFW.Key'T = KEY_T
313fromGLFWkey GLFW.Key'U = KEY_U 315fromGLFWkey GLFW.Key'U = KEY_U
314fromGLFWkey GLFW.Key'V = KEY_V 316fromGLFWkey GLFW.Key'V = KEY_V
315fromGLFWkey GLFW.Key'W = KEY_W 317fromGLFWkey GLFW.Key'W = KEY_W
316fromGLFWkey GLFW.Key'X = KEY_X 318fromGLFWkey GLFW.Key'X = KEY_X
317fromGLFWkey GLFW.Key'Y = KEY_Y 319fromGLFWkey GLFW.Key'Y = KEY_Y
318fromGLFWkey GLFW.Key'Z = KEY_Z 320fromGLFWkey GLFW.Key'Z = KEY_Z
319fromGLFWkey GLFW.Key'0 = KEY_0 321fromGLFWkey GLFW.Key'0 = KEY_0
320fromGLFWkey GLFW.Key'1 = KEY_1 322fromGLFWkey GLFW.Key'1 = KEY_1
321fromGLFWkey GLFW.Key'2 = KEY_2 323fromGLFWkey GLFW.Key'2 = KEY_2
322fromGLFWkey GLFW.Key'3 = KEY_3 324fromGLFWkey GLFW.Key'3 = KEY_3
323fromGLFWkey GLFW.Key'4 = KEY_4 325fromGLFWkey GLFW.Key'4 = KEY_4
324fromGLFWkey GLFW.Key'5 = KEY_5 326fromGLFWkey GLFW.Key'5 = KEY_5
325fromGLFWkey GLFW.Key'6 = KEY_6 327fromGLFWkey GLFW.Key'6 = KEY_6
326fromGLFWkey GLFW.Key'7 = KEY_7 328fromGLFWkey GLFW.Key'7 = KEY_7
327fromGLFWkey GLFW.Key'8 = KEY_8 329fromGLFWkey GLFW.Key'8 = KEY_8
328fromGLFWkey GLFW.Key'9 = KEY_9 330fromGLFWkey GLFW.Key'9 = KEY_9
329fromGLFWkey GLFW.Key'Space = KEY_SPACE 331fromGLFWkey GLFW.Key'Space = KEY_SPACE
330fromGLFWkey GLFW.Key'F1 = KEY_F1 332fromGLFWkey GLFW.Key'F1 = KEY_F1
331fromGLFWkey GLFW.Key'F2 = KEY_F2 333fromGLFWkey GLFW.Key'F2 = KEY_F2
332fromGLFWkey GLFW.Key'F3 = KEY_F3 334fromGLFWkey GLFW.Key'F3 = KEY_F3
333fromGLFWkey GLFW.Key'F4 = KEY_F4 335fromGLFWkey GLFW.Key'F4 = KEY_F4
334fromGLFWkey GLFW.Key'F5 = KEY_F5 336fromGLFWkey GLFW.Key'F5 = KEY_F5
335fromGLFWkey GLFW.Key'F6 = KEY_F6 337fromGLFWkey GLFW.Key'F6 = KEY_F6
336fromGLFWkey GLFW.Key'F7 = KEY_F7 338fromGLFWkey GLFW.Key'F7 = KEY_F7
337fromGLFWkey GLFW.Key'F8 = KEY_F8 339fromGLFWkey GLFW.Key'F8 = KEY_F8
338fromGLFWkey GLFW.Key'F9 = KEY_F9 340fromGLFWkey GLFW.Key'F9 = KEY_F9
339fromGLFWkey GLFW.Key'F10 = KEY_F10 341fromGLFWkey GLFW.Key'F10 = KEY_F10
340fromGLFWkey GLFW.Key'F11 = KEY_F11 342fromGLFWkey GLFW.Key'F11 = KEY_F11
341fromGLFWkey GLFW.Key'F12 = KEY_F12 343fromGLFWkey GLFW.Key'F12 = KEY_F12
342fromGLFWkey GLFW.Key'Escape = KEY_ESC 344fromGLFWkey GLFW.Key'Escape = KEY_ESC
343fromGLFWkey GLFW.Key'Up = KEY_UP 345fromGLFWkey GLFW.Key'Up = KEY_UP
344fromGLFWkey GLFW.Key'Down = KEY_DOWN 346fromGLFWkey GLFW.Key'Down = KEY_DOWN
345fromGLFWkey GLFW.Key'Left = KEY_LEFT 347fromGLFWkey GLFW.Key'Left = KEY_LEFT
346fromGLFWkey GLFW.Key'Right = KEY_RIGHT 348fromGLFWkey GLFW.Key'Right = KEY_RIGHT
347fromGLFWkey _ = KEY_UNKNOWN 349fromGLFWkey _ = KEY_UNKNOWN
348 350
349-- https://www.glfw.org/docs/3.3/group__buttons.html 351-- https://www.glfw.org/docs/3.3/group__buttons.html
350fromGLFWbutton :: GLFW.MouseButton -> MouseButton 352fromGLFWbutton :: GLFW.MouseButton -> MouseButton
@@ -353,60 +355,60 @@ fromGLFWbutton GLFW.MouseButton'2 = RMB
353fromGLFWbutton GLFW.MouseButton'3 = MMB 355fromGLFWbutton GLFW.MouseButton'3 = MMB
354 356
355toGLFWkey :: Key -> GLFW.Key 357toGLFWkey :: Key -> GLFW.Key
356toGLFWkey KEY_A = GLFW.Key'A 358toGLFWkey KEY_A = GLFW.Key'A
357toGLFWkey KEY_B = GLFW.Key'B 359toGLFWkey KEY_B = GLFW.Key'B
358toGLFWkey KEY_C = GLFW.Key'C 360toGLFWkey KEY_C = GLFW.Key'C
359toGLFWkey KEY_D = GLFW.Key'D 361toGLFWkey KEY_D = GLFW.Key'D
360toGLFWkey KEY_E = GLFW.Key'E 362toGLFWkey KEY_E = GLFW.Key'E
361toGLFWkey KEY_F = GLFW.Key'F 363toGLFWkey KEY_F = GLFW.Key'F
362toGLFWkey KEY_G = GLFW.Key'G 364toGLFWkey KEY_G = GLFW.Key'G
363toGLFWkey KEY_H = GLFW.Key'H 365toGLFWkey KEY_H = GLFW.Key'H
364toGLFWkey KEY_I = GLFW.Key'I 366toGLFWkey KEY_I = GLFW.Key'I
365toGLFWkey KEY_J = GLFW.Key'J 367toGLFWkey KEY_J = GLFW.Key'J
366toGLFWkey KEY_K = GLFW.Key'K 368toGLFWkey KEY_K = GLFW.Key'K
367toGLFWkey KEY_L = GLFW.Key'L 369toGLFWkey KEY_L = GLFW.Key'L
368toGLFWkey KEY_M = GLFW.Key'M 370toGLFWkey KEY_M = GLFW.Key'M
369toGLFWkey KEY_N = GLFW.Key'N 371toGLFWkey KEY_N = GLFW.Key'N
370toGLFWkey KEY_O = GLFW.Key'O 372toGLFWkey KEY_O = GLFW.Key'O
371toGLFWkey KEY_P = GLFW.Key'P 373toGLFWkey KEY_P = GLFW.Key'P
372toGLFWkey KEY_Q = GLFW.Key'Q 374toGLFWkey KEY_Q = GLFW.Key'Q
373toGLFWkey KEY_R = GLFW.Key'R 375toGLFWkey KEY_R = GLFW.Key'R
374toGLFWkey KEY_S = GLFW.Key'S 376toGLFWkey KEY_S = GLFW.Key'S
375toGLFWkey KEY_T = GLFW.Key'T 377toGLFWkey KEY_T = GLFW.Key'T
376toGLFWkey KEY_U = GLFW.Key'U 378toGLFWkey KEY_U = GLFW.Key'U
377toGLFWkey KEY_V = GLFW.Key'V 379toGLFWkey KEY_V = GLFW.Key'V
378toGLFWkey KEY_W = GLFW.Key'W 380toGLFWkey KEY_W = GLFW.Key'W
379toGLFWkey KEY_X = GLFW.Key'X 381toGLFWkey KEY_X = GLFW.Key'X
380toGLFWkey KEY_Y = GLFW.Key'Y 382toGLFWkey KEY_Y = GLFW.Key'Y
381toGLFWkey KEY_Z = GLFW.Key'Z 383toGLFWkey KEY_Z = GLFW.Key'Z
382toGLFWkey KEY_0 = GLFW.Key'0 384toGLFWkey KEY_0 = GLFW.Key'0
383toGLFWkey KEY_1 = GLFW.Key'1 385toGLFWkey KEY_1 = GLFW.Key'1
384toGLFWkey KEY_2 = GLFW.Key'2 386toGLFWkey KEY_2 = GLFW.Key'2
385toGLFWkey KEY_3 = GLFW.Key'3 387toGLFWkey KEY_3 = GLFW.Key'3
386toGLFWkey KEY_4 = GLFW.Key'4 388toGLFWkey KEY_4 = GLFW.Key'4
387toGLFWkey KEY_5 = GLFW.Key'5 389toGLFWkey KEY_5 = GLFW.Key'5
388toGLFWkey KEY_6 = GLFW.Key'6 390toGLFWkey KEY_6 = GLFW.Key'6
389toGLFWkey KEY_7 = GLFW.Key'7 391toGLFWkey KEY_7 = GLFW.Key'7
390toGLFWkey KEY_8 = GLFW.Key'8 392toGLFWkey KEY_8 = GLFW.Key'8
391toGLFWkey KEY_9 = GLFW.Key'9 393toGLFWkey KEY_9 = GLFW.Key'9
392toGLFWkey KEY_SPACE = GLFW.Key'Space 394toGLFWkey KEY_SPACE = GLFW.Key'Space
393toGLFWkey KEY_F1 = GLFW.Key'F1 395toGLFWkey KEY_F1 = GLFW.Key'F1
394toGLFWkey KEY_F2 = GLFW.Key'F2 396toGLFWkey KEY_F2 = GLFW.Key'F2
395toGLFWkey KEY_F3 = GLFW.Key'F3 397toGLFWkey KEY_F3 = GLFW.Key'F3
396toGLFWkey KEY_F4 = GLFW.Key'F4 398toGLFWkey KEY_F4 = GLFW.Key'F4
397toGLFWkey KEY_F5 = GLFW.Key'F5 399toGLFWkey KEY_F5 = GLFW.Key'F5
398toGLFWkey KEY_F6 = GLFW.Key'F6 400toGLFWkey KEY_F6 = GLFW.Key'F6
399toGLFWkey KEY_F7 = GLFW.Key'F7 401toGLFWkey KEY_F7 = GLFW.Key'F7
400toGLFWkey KEY_F8 = GLFW.Key'F8 402toGLFWkey KEY_F8 = GLFW.Key'F8
401toGLFWkey KEY_F9 = GLFW.Key'F9 403toGLFWkey KEY_F9 = GLFW.Key'F9
402toGLFWkey KEY_F10 = GLFW.Key'F10 404toGLFWkey KEY_F10 = GLFW.Key'F10
403toGLFWkey KEY_F11 = GLFW.Key'F11 405toGLFWkey KEY_F11 = GLFW.Key'F11
404toGLFWkey KEY_F12 = GLFW.Key'F12 406toGLFWkey KEY_F12 = GLFW.Key'F12
405toGLFWkey KEY_ESC = GLFW.Key'Escape 407toGLFWkey KEY_ESC = GLFW.Key'Escape
406toGLFWkey KEY_UP = GLFW.Key'Up 408toGLFWkey KEY_UP = GLFW.Key'Up
407toGLFWkey KEY_DOWN = GLFW.Key'Down 409toGLFWkey KEY_DOWN = GLFW.Key'Down
408toGLFWkey KEY_LEFT = GLFW.Key'Left 410toGLFWkey KEY_LEFT = GLFW.Key'Left
409toGLFWkey KEY_RIGHT = GLFW.Key'Right 411toGLFWkey KEY_RIGHT = GLFW.Key'Right
410toGLFWkey KEY_UNKNOWN = GLFW.Key'Unknown 412toGLFWkey KEY_UNKNOWN = GLFW.Key'Unknown
411 413
412-- https://www.glfw.org/docs/3.3/group__buttons.html 414-- https://www.glfw.org/docs/3.3/group__buttons.html