1 module dcv.plot.bindings.glfw; 2 3 struct GLFWwindow 4 { 5 } 6 7 struct GLFWmonitor 8 { 9 } 10 11 /************************************************************************* 12 * GLFW API tokens 13 *************************************************************************/ 14 immutable GLFW_TRUE = 1; 15 immutable GLFW_FALSE = 0; 16 17 immutable GLFW_VERSION_MAJOR = 3; 18 immutable GLFW_VERSION_MINOR = 1; 19 immutable GLFW_VERSION_REVISION = 2; 20 immutable GLFW_RELEASE = 0; 21 immutable GLFW_PRESS = 1; 22 immutable GLFW_REPEAT = 2; 23 24 immutable GLFW_KEY_UNKNOWN = -1; 25 26 immutable GLFW_KEY_SPACE = 32; 27 immutable GLFW_KEY_APOSTROPHE = 39; /* ' */ 28 immutable GLFW_KEY_COMMA = 44; /* , */ 29 immutable GLFW_KEY_MINUS = 45; /* - */ 30 immutable GLFW_KEY_PERIOD = 46; /* . */ 31 immutable GLFW_KEY_SLASH = 47; /* / */ 32 immutable GLFW_KEY_0 = 48; 33 immutable GLFW_KEY_1 = 49; 34 immutable GLFW_KEY_2 = 50; 35 immutable GLFW_KEY_3 = 51; 36 immutable GLFW_KEY_4 = 52; 37 immutable GLFW_KEY_5 = 53; 38 immutable GLFW_KEY_6 = 54; 39 immutable GLFW_KEY_7 = 55; 40 immutable GLFW_KEY_8 = 56; 41 immutable GLFW_KEY_9 = 57; 42 immutable GLFW_KEY_SEMICOLON = 59; /* ; */ 43 immutable GLFW_KEY_EQUAL = 61; /* = */ 44 immutable GLFW_KEY_A = 65; 45 immutable GLFW_KEY_B = 66; 46 immutable GLFW_KEY_C = 67; 47 immutable GLFW_KEY_D = 68; 48 immutable GLFW_KEY_E = 69; 49 immutable GLFW_KEY_F = 70; 50 immutable GLFW_KEY_G = 71; 51 immutable GLFW_KEY_H = 72; 52 immutable GLFW_KEY_I = 73; 53 immutable GLFW_KEY_J = 74; 54 immutable GLFW_KEY_K = 75; 55 immutable GLFW_KEY_L = 76; 56 immutable GLFW_KEY_M = 77; 57 immutable GLFW_KEY_N = 78; 58 immutable GLFW_KEY_O = 79; 59 immutable GLFW_KEY_P = 80; 60 immutable GLFW_KEY_Q = 81; 61 immutable GLFW_KEY_R = 82; 62 immutable GLFW_KEY_S = 83; 63 immutable GLFW_KEY_T = 84; 64 immutable GLFW_KEY_U = 85; 65 immutable GLFW_KEY_V = 86; 66 immutable GLFW_KEY_W = 87; 67 immutable GLFW_KEY_X = 88; 68 immutable GLFW_KEY_Y = 89; 69 immutable GLFW_KEY_Z = 90; 70 immutable GLFW_KEY_LEFT_BRACKET = 91; /* [ */ 71 immutable GLFW_KEY_BACKSLASH = 92; /* \ */ 72 immutable GLFW_KEY_RIGHT_BRACKET = 93; /* ] */ 73 immutable GLFW_KEY_GRAVE_ACCENT = 96; /* ` */ 74 immutable GLFW_KEY_WORLD_1 = 161; /* non-US #1 */ 75 immutable GLFW_KEY_WORLD_2 = 162; /* non-US #2 */ 76 77 immutable GLFW_KEY_ESCAPE = 256; 78 immutable GLFW_KEY_ENTER = 257; 79 immutable GLFW_KEY_TAB = 258; 80 immutable GLFW_KEY_BACKSPACE = 259; 81 immutable GLFW_KEY_INSERT = 260; 82 immutable GLFW_KEY_DELETE = 261; 83 immutable GLFW_KEY_RIGHT = 262; 84 immutable GLFW_KEY_LEFT = 263; 85 immutable GLFW_KEY_DOWN = 264; 86 immutable GLFW_KEY_UP = 265; 87 immutable GLFW_KEY_PAGE_UP = 266; 88 immutable GLFW_KEY_PAGE_DOWN = 267; 89 immutable GLFW_KEY_HOME = 268; 90 immutable GLFW_KEY_END = 269; 91 immutable GLFW_KEY_CAPS_LOCK = 280; 92 immutable GLFW_KEY_SCROLL_LOCK = 281; 93 immutable GLFW_KEY_NUM_LOCK = 282; 94 immutable GLFW_KEY_PRINT_SCREEN = 283; 95 immutable GLFW_KEY_PAUSE = 284; 96 immutable GLFW_KEY_F1 = 290; 97 immutable GLFW_KEY_F2 = 291; 98 immutable GLFW_KEY_F3 = 292; 99 immutable GLFW_KEY_F4 = 293; 100 immutable GLFW_KEY_F5 = 294; 101 immutable GLFW_KEY_F6 = 295; 102 immutable GLFW_KEY_F7 = 296; 103 immutable GLFW_KEY_F8 = 297; 104 immutable GLFW_KEY_F9 = 298; 105 immutable GLFW_KEY_F10 = 299; 106 immutable GLFW_KEY_F11 = 300; 107 immutable GLFW_KEY_F12 = 301; 108 immutable GLFW_KEY_F13 = 302; 109 immutable GLFW_KEY_F14 = 303; 110 immutable GLFW_KEY_F15 = 304; 111 immutable GLFW_KEY_F16 = 305; 112 immutable GLFW_KEY_F17 = 306; 113 immutable GLFW_KEY_F18 = 307; 114 immutable GLFW_KEY_F19 = 308; 115 immutable GLFW_KEY_F20 = 309; 116 immutable GLFW_KEY_F21 = 310; 117 immutable GLFW_KEY_F22 = 311; 118 immutable GLFW_KEY_F23 = 312; 119 immutable GLFW_KEY_F24 = 313; 120 immutable GLFW_KEY_F25 = 314; 121 immutable GLFW_KEY_KP_0 = 320; 122 immutable GLFW_KEY_KP_1 = 321; 123 immutable GLFW_KEY_KP_2 = 322; 124 immutable GLFW_KEY_KP_3 = 323; 125 immutable GLFW_KEY_KP_4 = 324; 126 immutable GLFW_KEY_KP_5 = 325; 127 immutable GLFW_KEY_KP_6 = 326; 128 immutable GLFW_KEY_KP_7 = 327; 129 immutable GLFW_KEY_KP_8 = 328; 130 immutable GLFW_KEY_KP_9 = 329; 131 immutable GLFW_KEY_KP_DECIMAL = 330; 132 immutable GLFW_KEY_KP_DIVIDE = 331; 133 immutable GLFW_KEY_KP_MULTIPLY = 332; 134 immutable GLFW_KEY_KP_SUBTRACT = 333; 135 immutable GLFW_KEY_KP_ADD = 334; 136 immutable GLFW_KEY_KP_ENTER = 335; 137 immutable GLFW_KEY_KP_EQUAL = 336; 138 immutable GLFW_KEY_LEFT_SHIFT = 340; 139 immutable GLFW_KEY_LEFT_CONTROL = 341; 140 immutable GLFW_KEY_LEFT_ALT = 342; 141 immutable GLFW_KEY_LEFT_SUPER = 343; 142 immutable GLFW_KEY_RIGHT_SHIFT = 344; 143 immutable GLFW_KEY_RIGHT_CONTROL = 345; 144 immutable GLFW_KEY_RIGHT_ALT = 346; 145 immutable GLFW_KEY_RIGHT_SUPER = 347; 146 immutable GLFW_KEY_MENU = 348; 147 immutable GLFW_KEY_LAST = GLFW_KEY_MENU; 148 149 immutable GLFW_MOD_SHIFT = 0x0001; 150 immutable GLFW_MOD_CONTROL = 0x0002; 151 immutable GLFW_MOD_ALT = 0x0004; 152 immutable GLFW_MOD_SUPER = 0x0008; 153 154 immutable GLFW_MOUSE_BUTTON_1 = 0; 155 immutable GLFW_MOUSE_BUTTON_2 = 1; 156 immutable GLFW_MOUSE_BUTTON_3 = 2; 157 immutable GLFW_MOUSE_BUTTON_4 = 3; 158 immutable GLFW_MOUSE_BUTTON_5 = 4; 159 immutable GLFW_MOUSE_BUTTON_6 = 5; 160 immutable GLFW_MOUSE_BUTTON_7 = 6; 161 immutable GLFW_MOUSE_BUTTON_8 = 7; 162 immutable GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8; 163 immutable GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1; 164 immutable GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2; 165 immutable GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3; 166 167 immutable GLFW_NOT_INITIALIZED = 0x00010001; 168 immutable GLFW_NO_CURRENT_CONTEXT = 0x00010002; 169 immutable GLFW_INVALID_ENUM = 0x00010003; 170 immutable GLFW_INVALID_VALUE = 0x00010004; 171 immutable GLFW_OUT_OF_MEMORY = 0x00010005; 172 immutable GLFW_API_UNAVAILABLE = 0x00010006; 173 immutable GLFW_VERSION_UNAVAILABLE = 0x00010007; 174 immutable GLFW_PLATFORM_ERROR = 0x00010008; 175 immutable GLFW_FORMAT_UNAVAILABLE = 0x00010009; 176 177 immutable GLFW_FOCUSED = 0x00020001; 178 immutable GLFW_ICONIFIED = 0x00020002; 179 immutable GLFW_RESIZABLE = 0x00020003; 180 immutable GLFW_VISIBLE = 0x00020004; 181 immutable GLFW_DECORATED = 0x00020005; 182 immutable GLFW_AUTO_ICONIFY = 0x00020006; 183 immutable GLFW_FLOATING = 0x00020007; 184 185 immutable GLFW_RED_BITS = 0x00021001; 186 immutable GLFW_GREEN_BITS = 0x00021002; 187 immutable GLFW_BLUE_BITS = 0x00021003; 188 immutable GLFW_ALPHA_BITS = 0x00021004; 189 immutable GLFW_DEPTH_BITS = 0x00021005; 190 immutable GLFW_STENCIL_BITS = 0x00021006; 191 immutable GLFW_ACCUM_RED_BITS = 0x00021007; 192 immutable GLFW_ACCUM_GREEN_BITS = 0x00021008; 193 immutable GLFW_ACCUM_BLUE_BITS = 0x00021009; 194 immutable GLFW_ACCUM_ALPHA_BITS = 0x0002100A; 195 immutable GLFW_AUX_BUFFERS = 0x0002100B; 196 immutable GLFW_STEREO = 0x0002100C; 197 immutable GLFW_SAMPLES = 0x0002100D; 198 immutable GLFW_SRGB_CAPABLE = 0x0002100E; 199 immutable GLFW_REFRESH_RATE = 0x0002100F; 200 immutable GLFW_DOUBLEBUFFER = 0x00021010; 201 202 immutable GLFW_CLIENT_API = 0x00022001; 203 immutable GLFW_CONTEXT_VERSION_MAJOR = 0x00022002; 204 immutable GLFW_CONTEXT_VERSION_MINOR = 0x00022003; 205 immutable GLFW_CONTEXT_REVISION = 0x00022004; 206 immutable GLFW_CONTEXT_ROBUSTNESS = 0x00022005; 207 immutable GLFW_OPENGL_FORWARD_COMPAT = 0x00022006; 208 immutable GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007; 209 immutable GLFW_OPENGL_PROFILE = 0x00022008; 210 immutable GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x00022009; 211 212 immutable GLFW_OPENGL_API = 0x00030001; 213 immutable GLFW_OPENGL_ES_API = 0x00030002; 214 215 immutable GLFW_NO_ROBUSTNESS = 0; 216 immutable GLFW_NO_RESET_NOTIFICATION = 0x00031001; 217 immutable GLFW_LOSE_CONTEXT_ON_RESET = 0x00031002; 218 219 immutable GLFW_OPENGL_ANY_PROFILE = 0; 220 immutable GLFW_OPENGL_CORE_PROFILE = 0x00032001; 221 immutable GLFW_OPENGL_COMPAT_PROFILE = 0x00032002; 222 223 immutable GLFW_CURSOR = 0x00033001; 224 immutable GLFW_STICKY_KEYS = 0x00033002; 225 immutable GLFW_STICKY_MOUSE_BUTTONS = 0x00033003; 226 227 immutable GLFW_CURSOR_NORMAL = 0x00034001; 228 immutable GLFW_CURSOR_HIDDEN = 0x00034002; 229 immutable GLFW_CURSOR_DISABLED = 0x00034003; 230 231 immutable GLFW_ANY_RELEASE_BEHAVIOR = 0; 232 immutable GLFW_RELEASE_BEHAVIOR_FLUSH = 0x00035001; 233 immutable GLFW_RELEASE_BEHAVIOR_NONE = 0x00035002; 234 immutable GLFW_ARROW_CURSOR = 0x00036001; 235 immutable GLFW_IBEAM_CURSOR = 0x00036002; 236 immutable GLFW_CROSSHAIR_CURSOR = 0x00036003; 237 immutable GLFW_HAND_CURSOR = 0x00036004; 238 immutable GLFW_HRESIZE_CURSOR = 0x00036005; 239 immutable GLFW_VRESIZE_CURSOR = 0x00036006; 240 241 immutable GLFW_CONNECTED = 0x00040001; 242 immutable GLFW_DISCONNECTED = 0x00040002; 243 244 immutable GLFW_DONT_CARE = -1; 245 246 /************************************************************************* 247 * GLFW API types 248 *************************************************************************/ 249 250 alias GLFWcharfun = void function(uint key, GLFWwindow* window); 251 alias GLFWcharmodsfun = void function(int mods, uint key, GLFWwindow*); 252 alias GLFWkeyfun = void function(int mods, int action, int scancode, int key, GLFWwindow* window); 253 alias GLFWwindowclosefun = void function(GLFWwindow* window); 254 alias GLFWmousebuttonfun = void function(int mods, int action, int button, GLFWwindow*); 255 alias GLFWcursorposfun = void function(double ypos, double xpos, GLFWwindow*); 256 alias GLFWwindowposfun = void function(int ypos, int xpos, GLFWwindow*); 257 alias GLFWwindowsizefun = void function(int height, int width, GLFWwindow* window); 258 259 extern (C) 260 { 261 /************************************************************************* 262 * GLFW functions definitions. 263 *************************************************************************/ 264 int glfwInit(); 265 GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); 266 void glfwShowWindow(GLFWwindow* window); 267 void glfwHideWindow(GLFWwindow* window); 268 void glfwDestroyWindow(GLFWwindow* window); 269 void glfwTerminate(); 270 void glfwMakeContextCurrent(GLFWwindow* window); 271 void glfwSwapBuffers(GLFWwindow* window); 272 void glfwPollEvents(); 273 void glfwWaitEvents(); 274 int glfwWindowShouldClose(GLFWwindow* window); 275 void glfwSetWindowTitle(GLFWwindow* window, const char* title); 276 int glfwGetWindowAttrib(GLFWwindow* window, int attrib); 277 void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); 278 void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); 279 void glfwSetInputMode(GLFWwindow* window, int mode, int value); 280 int glfwGetInputMode(GLFWwindow* window, int mode); 281 void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); 282 void glfwSetWindowSize(GLFWwindow* window, int width, int height); 283 void glfwWindowHint(int target, int hint); 284 void glfwGetFramebufferSize (GLFWwindow * window, int *width, int *height); 285 286 GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); 287 GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun); 288 GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); 289 GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); 290 GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); 291 GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); 292 GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); 293 GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); 294 }