1 object Glfw = 2 val no_api : int = 0 3 val false : int = 0 4 val client_api : int = 0x00022001 5 val resizable : int = 0x00020003 6 val true "GLFW_TRUE" : int 7 val context_version_major "GLFW_CONTEXT_VERSION_MAJOR" : int 8 val context_version_minor "GLFW_CONTEXT_VERSION_MINOR" : int 9 val opengl_forward_compat "GLFW_OPENGL_FORWARD_COMPAT" : int 10 val opengl_profile "GLFW_OPENGL_PROFILE" : int 11 val opengl_core_profile "GLFW_OPENGL_CORE_PROFILE" : int 12 val stencil_bits "GLFW_STENCIL_BITS" : int 13 val alpha_bits "GLFW_ALPHA_BITS" : int 14 val depth_bits "GLFW_DEPTH_BITS" : int 15 val dont_care "GLFW_DONT_CARE" : int 16 val floating "GLFW_FLOATING" : int 17 18 type MouseButton = 19 | Left = 0 20 | Right = 1 21 | Middle = 2 22 | Button4 = 3 23 | Button5 = 4 24 | Button6 = 5 25 | Button7 = 6 26 | Button8 = 7 27 28 type MouseAction = 29 | Release = 0 30 | Press = 1 31 32 def is_press = self == Press 33 def is_release = self == Release 34 35 type KeyState = 36 | Release = 0 37 | Press = 1 38 39 type GLFWwindow @c 40 type GlfwWindow = MutPtr<GLFWwindow> 41 type GLFWmonitor @c 42 type GlfwMonitor = MutPtr<GLFWmonitor> 43 44 typealias KeyFun = fn 45 (window : GlfwWindow) * (key : Key) * (scancode : int) 46 * (action : KeyAction) * (mods : KeyModifiers) -> Unit 47 48 typealias CharFun = fn (window : GlfwWindow) * (codepoint : uint) -> Unit 49 typealias CursorPosFun = fn (window : GlfwWindow) * (x : f64) * (y : f64) -> Unit 50 typealias ScrollFun = fn (window : GlfwWindow) * (x : f64) * (y : f64) -> Unit 51 typealias ErrorFun = fn (error_code : int) * (description : CString) -> Unit 52 53 typealias MouseButtonFun = fn 54 (window : GlfwWindow) * (button : MouseButton) 55 * (action : MouseAction) * (mods : KeyModifiers) -> Unit 56 57 typealias WindowSizeFun = fn 58 (window : GlfwWindow) * (width : int) * (height : int) -> Unit 59 60 typealias WindowIconifyFun = fn (window : GlfwWindow) * (iconified : int) -> Unit 61 typealias WindowMaximizeFun = fn (window : GlfwWindow) * (maximized : int) -> Unit 62 63 type VideoMode "GLFWvidmode" = struct 64 width : int 65 height : int 66 red_bits : int 67 green_bits : int 68 blue_bits : int 69 refresh_rate : int 70 71 object Glfw 72 def init "glfwInit" : int 73 def window_hint "glfwWindowHint" (hint : int) (value : int) 74 def create_window "glfwCreateWindow" (width : int 75 height : int 76 title : CString 77 monitor : GlfwMonitor 78 share : GlfwWindow) : GlfwWindow 79 80 def window_should_close "glfwWindowShouldClose" (window : GlfwWindow) : int 81 def poll_events "glfwPollEvents" 82 def destroy_window "glfwDestroyWindow" (window : GlfwWindow) 83 def terminate "glfwTerminate" 84 def get_primary_monitor "glfwGetPrimaryMonitor" : GlfwMonitor 85 def get_video_mode "glfwGetVideoMode" (monitor : GlfwMonitor) : ptr VideoMode 86 def set_window_size_limits "glfwSetWindowSizeLimits" (window : GlfwWindow 87 min_width : int 88 min_height : int 89 max_width : int 90 max_height : int) 91 92 def set_key_callback "glfwSetKeyCallback" 93 (window : GlfwWindow 94 callback : KeyFun) : KeyFun 95 96 def set_char_callback "glfwSetCharCallback" 97 (window : GlfwWindow 98 callback : CharFun) : CharFun 99 100 def set_cursor_pos_callback "glfwSetCursorPosCallback" 101 (window : GlfwWindow 102 callback : CursorPosFun) : CursorPosFun 103 104 def set_mouse_button_callback "glfwSetMouseButtonCallback" 105 (window : GlfwWindow 106 callback : MouseButtonFun) : MouseButtonFun 107 108 def set_window_size_callback "glfwSetWindowSizeCallback" 109 (window : GlfwWindow 110 callback : WindowSizeFun) : WindowSizeFun 111 112 def set_window_iconify_callback "glfwSetWindowIconifyCallback" 113 (window : GlfwWindow 114 callback : WindowIconifyFun) : WindowIconifyFun 115 116 def set_window_maximize_callback "glfwSetWindowMaximizeCallback" 117 (window : GlfwWindow 118 callback : WindowMaximizeFun) : WindowMaximizeFun 119 120 def set_scroll_callback "glfwSetScrollCallback" 121 (window : GlfwWindow 122 callback : ScrollFun) : ScrollFun 123 124 def set_error_callback "glfwSetErrorCallback" (callback : ErrorFun) 125 def get_cursor_pos "glfwGetCursorPos" (window : GlfwWindow 126 x : mut ptr f64 127 y : mut ptr f64) 128 129 def get_mouse_button "glfwGetMouseButton" 130 (window : GlfwWindow 131 button : MouseButton) : MouseAction 132 133 def get_key "glfwGetKey" (window : GlfwWindow) (key : Key) : KeyState 134 def get_clipboard_string "glfwGetClipboardString" 135 (window : GlfwWindow) : CString 136 137 def set_clipboard_string "glfwSetClipboardString" 138 (window : GlfwWindow 139 string : CString) 140 141 def create_window_surface "glfwCreateWindowSurface" 142 (instance : VkInstance 143 window : GlfwWindow 144 allocator : Allocator 145 surface : mut ptr VkSurface) : Result 146 147 def swap_buffers "glfwSwapBuffers" (window : GlfwWindow) 148 def swap_interval "glfwSwapInterval" (interval : int) 149 def make_context_current "glfwMakeContextCurrent" (window : GlfwWindow) 150 def wait_events "glfwWaitEvents" 151