GLFW.agda 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {-- GLFW.agda - some bindings to Graphics.GPipe.Context.GLFW
  2. -- Copyright (C) 2018 caryoscelus
  3. --
  4. -- This program is free software: you can redistribute it and/or modify
  5. -- it under the terms of the GNU General Public License as published by
  6. -- the Free Software Foundation, either version 3 of the License, or
  7. -- (at your option) any later version.
  8. --
  9. -- This program is distributed in the hope that it will be useful,
  10. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. -- GNU General Public License for more details.
  13. --
  14. -- You should have received a copy of the GNU General Public License
  15. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. --}
  17. {-# OPTIONS --without-K #-}
  18. module GLFW where
  19. open import Data.Bool
  20. open import Hask
  21. import GLFW.Types as Types′
  22. module Types = Types′
  23. open Types
  24. {-# FOREIGN GHC import Graphics.GPipe.Context.GLFW #-}
  25. postulate
  26. ModifierKeys : Set
  27. {-# COMPILE GHC ModifierKeys = type ModifierKeys #-}
  28. MouseCallback : Set → Set
  29. MouseCallback App =
  30. (button : MouseButton)
  31. (state : MouseButtonState)
  32. (mods : ModifierKeys)
  33. → App → App
  34. MouseCallback′ : {M : Set} → Set → Set
  35. MouseCallback′ {M} App =
  36. (modApp : (App → App) → M)
  37. (button : MouseButton)
  38. (state : MouseButtonState)
  39. (mods : ModifierKeys)
  40. → M
  41. mouseCallbackWrap :
  42. ∀ {M App} → MouseCallback App → MouseCallback′ {M} App
  43. mouseCallbackWrap f modApp button state mods =
  44. modApp (f button state mods)
  45. CursorCallback : Set → Set
  46. CursorCallback App =
  47. (x y : Double)
  48. → App → App
  49. CursorCallback′ : {M : Set} → Set → Set
  50. CursorCallback′ {M} App =
  51. (modApp : (App → App) → M)
  52. (x y : Double)
  53. → M
  54. cursorCallbackWrap :
  55. ∀ {M App} → CursorCallback App → CursorCallback′ {M} App
  56. cursorCallbackWrap f modApp x y = modApp (f x y)
  57. KeyCallback : Set → Set
  58. KeyCallback App =
  59. (key : Key)
  60. (scancode : Int)
  61. (state : KeyState)
  62. (mods : ModifierKeys)
  63. → App → App
  64. KeyCallback′ : {M : Set} → Set → Set
  65. KeyCallback′ {M} App =
  66. (modApp : (App → App) → M)
  67. (key : Key)
  68. (scancode : Int)
  69. (state : KeyState)
  70. (mods : ModifierKeys)
  71. → M
  72. keyCallbackWrap :
  73. ∀ {M App} → KeyCallback App → KeyCallback′ {M} App
  74. keyCallbackWrap f modApp key scancode state mods = modApp
  75. (f key scancode state mods)