1 /** 2 * The cross-platform GLFW 3 API, translated from `glfw3.h` 3 * 4 * This is the header file of the GLFW 3 API. 5 * It defines all types and functions that are used on all platforms. 6 * For platform-specific public definitions, refer to `glfw3.apinative`. 7 */ 8 module glfw3.api; 9 10 extern(C): @nogc: nothrow: __gshared: 11 /************************************************************************* 12 * GLFW 3.3 - www.glfw.org 13 * A library for OpenGL, window and input 14 *------------------------------------------------------------------------ 15 * Copyright (c) 2002-2006 Marcus Geelnard 16 * Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org> 17 * 18 * This software is provided 'as-is', without any express or implied 19 * warranty. In no event will the authors be held liable for any damages 20 * arising from the use of this software. 21 * 22 * Permission is granted to anyone to use this software for any purpose, 23 * including commercial applications, and to alter it and redistribute it 24 * freely, subject to the following restrictions: 25 * 26 * 1. The origin of this software must not be misrepresented; you must not 27 * claim that you wrote the original software. If you use this software 28 * in a product, an acknowledgment in the product documentation would 29 * be appreciated but is not required. 30 * 31 * 2. Altered source versions must be plainly marked as such, and must not 32 * be misrepresented as being the original software. 33 * 34 * 3. This notice may not be removed or altered from any source 35 * distribution. 36 * 37 *************************************************************************/ 38 39 /** @defgroup context Context reference 40 * Functions and types related to OpenGL and OpenGL ES contexts. 41 * 42 * This is the reference documentation for OpenGL and OpenGL ES context related 43 * functions. For more task-oriented information, see the @ref context_guide. 44 */ 45 /** @defgroup vulkan Vulkan reference 46 * Functions and types related to Vulkan. 47 * 48 * This is the reference documentation for Vulkan related functions and types. 49 * For more task-oriented information, see the @ref vulkan_guide. 50 */ 51 /** @defgroup init Initialization, version and error reference 52 * Functions and types related to initialization and error handling. 53 * 54 * This is the reference documentation for initialization and termination of 55 * the library, version management and error handling. For more task-oriented 56 * information, see the @ref intro_guide. 57 */ 58 /** @defgroup input Input reference 59 * Functions and types related to input handling. 60 * 61 * This is the reference documentation for input related functions and types. 62 * For more task-oriented information, see the @ref input_guide. 63 */ 64 /** @defgroup monitor Monitor reference 65 * Functions and types related to monitors. 66 * 67 * This is the reference documentation for monitor related functions and types. 68 * For more task-oriented information, see the @ref monitor_guide. 69 */ 70 /** @defgroup window Window reference 71 * Functions and types related to windows. 72 * 73 * This is the reference documentation for window related functions and types, 74 * including creation, deletion and event polling. For more task-oriented 75 * information, see the @ref window_guide. 76 */ 77 78 79 /************************************************************************* 80 * Compiler- and platform-specific preprocessor work 81 *************************************************************************/ 82 83 /* Include because most Windows GLU headers need wchar_t and 84 * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h. 85 * Include it unconditionally to avoid surprising side-effects. 86 */ 87 import core.stdc.stddef; 88 89 /* Include because it is needed by Vulkan and related functions. 90 * Include it unconditionally to avoid surprising side-effects. 91 */ 92 import core.stdc.stdint; 93 94 /************************************************************************* 95 * GLFW API tokens 96 *************************************************************************/ 97 98 /** @name GLFW version macros 99 * @{ */ 100 /** The major version number of the GLFW library. 101 * 102 * This is incremented when the API is changed in non-compatible ways. 103 * Ingroup: init 104 */ 105 enum GLFW_VERSION_MAJOR = 3; 106 /** The minor version number of the GLFW library. 107 * 108 * This is incremented when features are added to the API but it remains 109 * backward-compatible. 110 * Ingroup: init 111 */ 112 enum GLFW_VERSION_MINOR = 3; 113 /** The revision number of the GLFW library. 114 * 115 * This is incremented when a bug fix release is made that does not contain any 116 * API changes. 117 * Ingroup: init 118 */ 119 enum GLFW_VERSION_REVISION = 2; 120 /** @} */ 121 122 /** One. 123 * 124 * This is only semantic sugar for the number 1. You can instead use `1` or 125 * `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal 126 * to one. 127 * 128 * Ingroup: init 129 */ 130 enum GLFW_TRUE = 1; 131 /** Zero. 132 * 133 * This is only semantic sugar for the number 0. You can instead use `0` or 134 * `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is 135 * equal to zero. 136 * 137 * Ingroup: init 138 */ 139 enum GLFW_FALSE = 0; 140 141 /** @name Key and button actions 142 * @{ */ 143 /** The key or mouse button was released. 144 * 145 * The key or mouse button was released. 146 * 147 * Ingroup: input 148 */ 149 enum GLFW_RELEASE = 0; 150 /** The key or mouse button was pressed. 151 * 152 * The key or mouse button was pressed. 153 * 154 * Ingroup: input 155 */ 156 enum GLFW_PRESS = 1; 157 /** The key was held down until it repeated. 158 * 159 * The key was held down until it repeated. 160 * 161 * Ingroup: input 162 */ 163 enum GLFW_REPEAT = 2; 164 /** @} */ 165 166 /** @defgroup hat_state Joystick hat states 167 * Joystick hat states. 168 * 169 * See [joystick hat input](@ref joystick_hat) for how these are used. 170 * 171 * Ingroup: input 172 * @{ */ 173 enum GLFW_HAT_CENTERED = 0; 174 enum GLFW_HAT_UP = 1; 175 enum GLFW_HAT_RIGHT = 2; 176 enum GLFW_HAT_DOWN = 4; 177 enum GLFW_HAT_LEFT = 8; 178 enum GLFW_HAT_RIGHT_UP = (GLFW_HAT_RIGHT | GLFW_HAT_UP); 179 enum GLFW_HAT_RIGHT_DOWN = (GLFW_HAT_RIGHT | GLFW_HAT_DOWN); 180 enum GLFW_HAT_LEFT_UP = (GLFW_HAT_LEFT | GLFW_HAT_UP); 181 enum GLFW_HAT_LEFT_DOWN = (GLFW_HAT_LEFT | GLFW_HAT_DOWN); 182 /** @} */ 183 184 /** @defgroup keys Keyboard keys 185 * Keyboard key IDs. 186 * 187 * See [key input](@ref input_key) for how these are used. 188 * 189 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), 190 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are 191 * put in the 256+ range). 192 * 193 * The naming of the key codes follow these rules: 194 * - The US keyboard layout is used 195 * - Names of printable alpha-numeric characters are used (e.g. "A", "R", 196 * "3", etc.) 197 * - For non-alphanumeric characters, Unicode:ish names are used (e.g. 198 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not 199 * correspond to the Unicode standard (usually for brevity) 200 * - Keys that lack a clear US mapping are named "WORLD_x" 201 * - For non-printable keys, custom names are used (e.g. "F4", 202 * "BACKSPACE", etc.) 203 * 204 * Ingroup: input 205 * @{ 206 */ 207 208 /* The unknown key */ 209 enum GLFW_KEY_UNKNOWN = -1; 210 211 /** Printable keys */ 212 enum GLFW_KEY_SPACE = 32; 213 enum GLFW_KEY_APOSTROPHE = 39 /* ' */; 214 enum GLFW_KEY_COMMA = 44 /* , */; 215 enum GLFW_KEY_MINUS = 45 /* - */; 216 enum GLFW_KEY_PERIOD = 46 /* . */; 217 enum GLFW_KEY_SLASH = 47 /* / */; 218 enum GLFW_KEY_0 = 48; 219 enum GLFW_KEY_1 = 49; 220 enum GLFW_KEY_2 = 50; 221 enum GLFW_KEY_3 = 51; 222 enum GLFW_KEY_4 = 52; 223 enum GLFW_KEY_5 = 53; 224 enum GLFW_KEY_6 = 54; 225 enum GLFW_KEY_7 = 55; 226 enum GLFW_KEY_8 = 56; 227 enum GLFW_KEY_9 = 57; 228 enum GLFW_KEY_SEMICOLON = 59 /* ; */; 229 enum GLFW_KEY_EQUAL = 61 /* = */; 230 enum GLFW_KEY_A = 65; 231 enum GLFW_KEY_B = 66; 232 enum GLFW_KEY_C = 67; 233 enum GLFW_KEY_D = 68; 234 enum GLFW_KEY_E = 69; 235 enum GLFW_KEY_F = 70; 236 enum GLFW_KEY_G = 71; 237 enum GLFW_KEY_H = 72; 238 enum GLFW_KEY_I = 73; 239 enum GLFW_KEY_J = 74; 240 enum GLFW_KEY_K = 75; 241 enum GLFW_KEY_L = 76; 242 enum GLFW_KEY_M = 77; 243 enum GLFW_KEY_N = 78; 244 enum GLFW_KEY_O = 79; 245 enum GLFW_KEY_P = 80; 246 enum GLFW_KEY_Q = 81; 247 enum GLFW_KEY_R = 82; 248 enum GLFW_KEY_S = 83; 249 enum GLFW_KEY_T = 84; 250 enum GLFW_KEY_U = 85; 251 enum GLFW_KEY_V = 86; 252 enum GLFW_KEY_W = 87; 253 enum GLFW_KEY_X = 88; 254 enum GLFW_KEY_Y = 89; 255 enum GLFW_KEY_Z = 90; 256 enum GLFW_KEY_LEFT_BRACKET = 91 /* [ */; 257 enum GLFW_KEY_BACKSLASH = 92 /* \ */; 258 enum GLFW_KEY_RIGHT_BRACKET = 93 /* ] */; 259 enum GLFW_KEY_GRAVE_ACCENT = 96 /* ` */; 260 enum GLFW_KEY_WORLD_1 = 161 /* non-US #1 */; 261 enum GLFW_KEY_WORLD_2 = 162 /* non-US #2 */; 262 263 /* Function keys */ 264 enum GLFW_KEY_ESCAPE = 256; 265 enum GLFW_KEY_ENTER = 257; 266 enum GLFW_KEY_TAB = 258; 267 enum GLFW_KEY_BACKSPACE = 259; 268 enum GLFW_KEY_INSERT = 260; 269 enum GLFW_KEY_DELETE = 261; 270 enum GLFW_KEY_RIGHT = 262; 271 enum GLFW_KEY_LEFT = 263; 272 enum GLFW_KEY_DOWN = 264; 273 enum GLFW_KEY_UP = 265; 274 enum GLFW_KEY_PAGE_UP = 266; 275 enum GLFW_KEY_PAGE_DOWN = 267; 276 enum GLFW_KEY_HOME = 268; 277 enum GLFW_KEY_END = 269; 278 enum GLFW_KEY_CAPS_LOCK = 280; 279 enum GLFW_KEY_SCROLL_LOCK = 281; 280 enum GLFW_KEY_NUM_LOCK = 282; 281 enum GLFW_KEY_PRINT_SCREEN = 283; 282 enum GLFW_KEY_PAUSE = 284; 283 enum GLFW_KEY_F1 = 290; 284 enum GLFW_KEY_F2 = 291; 285 enum GLFW_KEY_F3 = 292; 286 enum GLFW_KEY_F4 = 293; 287 enum GLFW_KEY_F5 = 294; 288 enum GLFW_KEY_F6 = 295; 289 enum GLFW_KEY_F7 = 296; 290 enum GLFW_KEY_F8 = 297; 291 enum GLFW_KEY_F9 = 298; 292 enum GLFW_KEY_F10 = 299; 293 enum GLFW_KEY_F11 = 300; 294 enum GLFW_KEY_F12 = 301; 295 enum GLFW_KEY_F13 = 302; 296 enum GLFW_KEY_F14 = 303; 297 enum GLFW_KEY_F15 = 304; 298 enum GLFW_KEY_F16 = 305; 299 enum GLFW_KEY_F17 = 306; 300 enum GLFW_KEY_F18 = 307; 301 enum GLFW_KEY_F19 = 308; 302 enum GLFW_KEY_F20 = 309; 303 enum GLFW_KEY_F21 = 310; 304 enum GLFW_KEY_F22 = 311; 305 enum GLFW_KEY_F23 = 312; 306 enum GLFW_KEY_F24 = 313; 307 enum GLFW_KEY_F25 = 314; 308 enum GLFW_KEY_KP_0 = 320; 309 enum GLFW_KEY_KP_1 = 321; 310 enum GLFW_KEY_KP_2 = 322; 311 enum GLFW_KEY_KP_3 = 323; 312 enum GLFW_KEY_KP_4 = 324; 313 enum GLFW_KEY_KP_5 = 325; 314 enum GLFW_KEY_KP_6 = 326; 315 enum GLFW_KEY_KP_7 = 327; 316 enum GLFW_KEY_KP_8 = 328; 317 enum GLFW_KEY_KP_9 = 329; 318 enum GLFW_KEY_KP_DECIMAL = 330; 319 enum GLFW_KEY_KP_DIVIDE = 331; 320 enum GLFW_KEY_KP_MULTIPLY = 332; 321 enum GLFW_KEY_KP_SUBTRACT = 333; 322 enum GLFW_KEY_KP_ADD = 334; 323 enum GLFW_KEY_KP_ENTER = 335; 324 enum GLFW_KEY_KP_EQUAL = 336; 325 enum GLFW_KEY_LEFT_SHIFT = 340; 326 enum GLFW_KEY_LEFT_CONTROL = 341; 327 enum GLFW_KEY_LEFT_ALT = 342; 328 enum GLFW_KEY_LEFT_SUPER = 343; 329 enum GLFW_KEY_RIGHT_SHIFT = 344; 330 enum GLFW_KEY_RIGHT_CONTROL = 345; 331 enum GLFW_KEY_RIGHT_ALT = 346; 332 enum GLFW_KEY_RIGHT_SUPER = 347; 333 enum GLFW_KEY_MENU = 348; 334 335 enum GLFW_KEY_LAST = GLFW_KEY_MENU; 336 337 /** @} */ 338 339 /** @defgroup mods Modifier key flags 340 * Modifier key flags. 341 * 342 * See [key input](@ref input_key) for how these are used. 343 * 344 * Ingroup: input 345 * @{ */ 346 347 /** If this bit is set one or more Shift keys were held down. 348 * 349 * If this bit is set one or more Shift keys were held down. 350 */ 351 enum GLFW_MOD_SHIFT = 0x0001; 352 /** If this bit is set one or more Control keys were held down. 353 * 354 * If this bit is set one or more Control keys were held down. 355 */ 356 enum GLFW_MOD_CONTROL = 0x0002; 357 /** If this bit is set one or more Alt keys were held down. 358 * 359 * If this bit is set one or more Alt keys were held down. 360 */ 361 enum GLFW_MOD_ALT = 0x0004; 362 /** If this bit is set one or more Super keys were held down. 363 * 364 * If this bit is set one or more Super keys were held down. 365 */ 366 enum GLFW_MOD_SUPER = 0x0008; 367 /** If this bit is set the Caps Lock key is enabled. 368 * 369 * If this bit is set the Caps Lock key is enabled and the @ref 370 * GLFW_LOCK_KEY_MODS input mode is set. 371 */ 372 enum GLFW_MOD_CAPS_LOCK = 0x0010; 373 /** If this bit is set the Num Lock key is enabled. 374 * 375 * If this bit is set the Num Lock key is enabled and the @ref 376 * GLFW_LOCK_KEY_MODS input mode is set. 377 */ 378 enum GLFW_MOD_NUM_LOCK = 0x0020; 379 380 /** @} */ 381 382 /** @defgroup buttons Mouse buttons 383 * Mouse button IDs. 384 * 385 * See [mouse button input](@ref input_mouse_button) for how these are used. 386 * 387 * Ingroup: input 388 * @{ */ 389 enum GLFW_MOUSE_BUTTON_1 = 0; 390 enum GLFW_MOUSE_BUTTON_2 = 1; 391 enum GLFW_MOUSE_BUTTON_3 = 2; 392 enum GLFW_MOUSE_BUTTON_4 = 3; 393 enum GLFW_MOUSE_BUTTON_5 = 4; 394 enum GLFW_MOUSE_BUTTON_6 = 5; 395 enum GLFW_MOUSE_BUTTON_7 = 6; 396 enum GLFW_MOUSE_BUTTON_8 = 7; 397 enum GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8; 398 enum GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1; 399 enum GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2; 400 enum GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3; 401 /** @} */ 402 403 /** @defgroup joysticks Joysticks 404 * Joystick IDs. 405 * 406 * See [joystick input](@ref joystick) for how these are used. 407 * 408 * Ingroup: input 409 * @{ */ 410 enum GLFW_JOYSTICK_1 = 0; 411 enum GLFW_JOYSTICK_2 = 1; 412 enum GLFW_JOYSTICK_3 = 2; 413 enum GLFW_JOYSTICK_4 = 3; 414 enum GLFW_JOYSTICK_5 = 4; 415 enum GLFW_JOYSTICK_6 = 5; 416 enum GLFW_JOYSTICK_7 = 6; 417 enum GLFW_JOYSTICK_8 = 7; 418 enum GLFW_JOYSTICK_9 = 8; 419 enum GLFW_JOYSTICK_10 = 9; 420 enum GLFW_JOYSTICK_11 = 10; 421 enum GLFW_JOYSTICK_12 = 11; 422 enum GLFW_JOYSTICK_13 = 12; 423 enum GLFW_JOYSTICK_14 = 13; 424 enum GLFW_JOYSTICK_15 = 14; 425 enum GLFW_JOYSTICK_16 = 15; 426 enum GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16; 427 /** @} */ 428 429 /** @defgroup gamepad_buttons Gamepad buttons 430 * Gamepad buttons. 431 * 432 * See @ref gamepad for how these are used. 433 * 434 * Ingroup: input 435 * @{ */ 436 enum GLFW_GAMEPAD_BUTTON_A = 0; 437 enum GLFW_GAMEPAD_BUTTON_B = 1; 438 enum GLFW_GAMEPAD_BUTTON_X = 2; 439 enum GLFW_GAMEPAD_BUTTON_Y = 3; 440 enum GLFW_GAMEPAD_BUTTON_LEFT_BUMPER = 4; 441 enum GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER = 5; 442 enum GLFW_GAMEPAD_BUTTON_BACK = 6; 443 enum GLFW_GAMEPAD_BUTTON_START = 7; 444 enum GLFW_GAMEPAD_BUTTON_GUIDE = 8; 445 enum GLFW_GAMEPAD_BUTTON_LEFT_THUMB = 9; 446 enum GLFW_GAMEPAD_BUTTON_RIGHT_THUMB = 10; 447 enum GLFW_GAMEPAD_BUTTON_DPAD_UP = 11; 448 enum GLFW_GAMEPAD_BUTTON_DPAD_RIGHT = 12; 449 enum GLFW_GAMEPAD_BUTTON_DPAD_DOWN = 13; 450 enum GLFW_GAMEPAD_BUTTON_DPAD_LEFT = 14; 451 enum GLFW_GAMEPAD_BUTTON_LAST = GLFW_GAMEPAD_BUTTON_DPAD_LEFT; 452 453 enum GLFW_GAMEPAD_BUTTON_CROSS = GLFW_GAMEPAD_BUTTON_A; 454 enum GLFW_GAMEPAD_BUTTON_CIRCLE = GLFW_GAMEPAD_BUTTON_B; 455 enum GLFW_GAMEPAD_BUTTON_SQUARE = GLFW_GAMEPAD_BUTTON_X; 456 enum GLFW_GAMEPAD_BUTTON_TRIANGLE = GLFW_GAMEPAD_BUTTON_Y; 457 /** @} */ 458 459 /** @defgroup gamepad_axes Gamepad axes 460 * Gamepad axes. 461 * 462 * See @ref gamepad for how these are used. 463 * 464 * Ingroup: input 465 * @{ */ 466 enum GLFW_GAMEPAD_AXIS_LEFT_X = 0; 467 enum GLFW_GAMEPAD_AXIS_LEFT_Y = 1; 468 enum GLFW_GAMEPAD_AXIS_RIGHT_X = 2; 469 enum GLFW_GAMEPAD_AXIS_RIGHT_Y = 3; 470 enum GLFW_GAMEPAD_AXIS_LEFT_TRIGGER = 4; 471 enum GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER = 5; 472 enum GLFW_GAMEPAD_AXIS_LAST = GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER; 473 /** @} */ 474 475 /** @defgroup errors Error codes 476 * Error codes. 477 * 478 * See [error handling](@ref error_handling) for how these are used. 479 * 480 * Ingroup: init 481 * @{ */ 482 /** No error has occurred. 483 * 484 * No error has occurred. 485 * 486 * @analysis Yay. 487 */ 488 enum GLFW_NO_ERROR = 0; 489 /** GLFW has not been initialized. 490 * 491 * This occurs if a GLFW function was called that must not be called unless the 492 * library is [initialized](@ref intro_init). 493 * 494 * @analysis Application programmer error. Initialize GLFW before calling any 495 * function that requires initialization. 496 */ 497 enum GLFW_NOT_INITIALIZED = 0x00010001; 498 /** No context is current for this thread. 499 * 500 * This occurs if a GLFW function was called that needs and operates on the 501 * current OpenGL or OpenGL ES context but no context is current on the calling 502 * thread. One such function is @ref glfwSwapInterval. 503 * 504 * @analysis Application programmer error. Ensure a context is current before 505 * calling functions that require a current context. 506 */ 507 enum GLFW_NO_CURRENT_CONTEXT = 0x00010002; 508 /** One of the arguments to the function was an invalid enum value. 509 * 510 * One of the arguments to the function was an invalid enum value, for example 511 * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib. 512 * 513 * @analysis Application programmer error. Fix the offending call. 514 */ 515 enum GLFW_INVALID_ENUM = 0x00010003; 516 /** One of the arguments to the function was an invalid value. 517 * 518 * One of the arguments to the function was an invalid value, for example 519 * requesting a non-existent OpenGL or OpenGL ES version like 2.7. 520 * 521 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead 522 * result in a @ref GLFW_VERSION_UNAVAILABLE error. 523 * 524 * @analysis Application programmer error. Fix the offending call. 525 */ 526 enum GLFW_INVALID_VALUE = 0x00010004; 527 /** A memory allocation failed. 528 * 529 * A memory allocation failed. 530 * 531 * @analysis A bug in GLFW or the underlying operating system. Report the bug 532 * to our [issue tracker](https://github.com/glfw/glfw/issues). 533 */ 534 enum GLFW_OUT_OF_MEMORY = 0x00010005; 535 /** GLFW could not find support for the requested API on the system. 536 * 537 * GLFW could not find support for the requested API on the system. 538 * 539 * @analysis The installed graphics driver does not support the requested 540 * API, or does not support it via the chosen context creation backend. 541 * Below are a few examples. 542 * 543 * @par 544 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only 545 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via 546 * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa 547 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary 548 * driver. Older graphics drivers do not support Vulkan. 549 */ 550 enum GLFW_API_UNAVAILABLE = 0x00010006; 551 /** The requested OpenGL or OpenGL ES version is not available. 552 * 553 * The requested OpenGL or OpenGL ES version (including any requested context 554 * or framebuffer hints) is not available on this machine. 555 * 556 * @analysis The machine does not support your requirements. If your 557 * application is sufficiently flexible, downgrade your requirements and try 558 * again. Otherwise, inform the user that their machine does not match your 559 * requirements. 560 * 561 * @par 562 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 563 * comes out before the 4.x series gets that far, also fail with this error and 564 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions 565 * will exist. 566 */ 567 enum GLFW_VERSION_UNAVAILABLE = 0x00010007; 568 /** A platform-specific error occurred that does not match any of the 569 * more specific categories. 570 * 571 * A platform-specific error occurred that does not match any of the more 572 * specific categories. 573 * 574 * @analysis A bug or configuration error in GLFW, the underlying operating 575 * system or its drivers, or a lack of required resources. Report the issue to 576 * our [issue tracker](https://github.com/glfw/glfw/issues). 577 */ 578 enum GLFW_PLATFORM_ERROR = 0x00010008; 579 /** The requested format is not supported or available. 580 * 581 * If emitted during window creation, the requested pixel format is not 582 * supported. 583 * 584 * If emitted when querying the clipboard, the contents of the clipboard could 585 * not be converted to the requested format. 586 * 587 * @analysis If emitted during window creation, one or more 588 * [hard constraints](@ref window_hints_hard) did not match any of the 589 * available pixel formats. If your application is sufficiently flexible, 590 * downgrade your requirements and try again. Otherwise, inform the user that 591 * their machine does not match your requirements. 592 * 593 * @par 594 * If emitted when querying the clipboard, ignore the error or report it to 595 * the user, as appropriate. 596 */ 597 enum GLFW_FORMAT_UNAVAILABLE = 0x00010009; 598 /** The specified window does not have an OpenGL or OpenGL ES context. 599 * 600 * A window that does not have an OpenGL or OpenGL ES context was passed to 601 * a function that requires it to have one. 602 * 603 * @analysis Application programmer error. Fix the offending call. 604 */ 605 enum GLFW_NO_WINDOW_CONTEXT = 0x0001000A; 606 /** @} */ 607 608 /** @addtogroup window 609 * @{ */ 610 /** Input focus window hint and attribute 611 * 612 * Input focus [window hint](@ref GLFW_FOCUSED_hint) or 613 * [window attribute](@ref GLFW_FOCUSED_attrib). 614 */ 615 enum GLFW_FOCUSED = 0x00020001; 616 /** Window iconification window attribute 617 * 618 * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib). 619 */ 620 enum GLFW_ICONIFIED = 0x00020002; 621 /** Window resize-ability window hint and attribute 622 * 623 * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and 624 * [window attribute](@ref GLFW_RESIZABLE_attrib). 625 */ 626 enum GLFW_RESIZABLE = 0x00020003; 627 /** Window visibility window hint and attribute 628 * 629 * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and 630 * [window attribute](@ref GLFW_VISIBLE_attrib). 631 */ 632 enum GLFW_VISIBLE = 0x00020004; 633 /** Window decoration window hint and attribute 634 * 635 * Window decoration [window hint](@ref GLFW_DECORATED_hint) and 636 * [window attribute](@ref GLFW_DECORATED_attrib). 637 */ 638 enum GLFW_DECORATED = 0x00020005; 639 /** Window auto-iconification window hint and attribute 640 * 641 * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and 642 * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib). 643 */ 644 enum GLFW_AUTO_ICONIFY = 0x00020006; 645 /** Window decoration window hint and attribute 646 * 647 * Window decoration [window hint](@ref GLFW_FLOATING_hint) and 648 * [window attribute](@ref GLFW_FLOATING_attrib). 649 */ 650 enum GLFW_FLOATING = 0x00020007; 651 /** Window maximization window hint and attribute 652 * 653 * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and 654 * [window attribute](@ref GLFW_MAXIMIZED_attrib). 655 */ 656 enum GLFW_MAXIMIZED = 0x00020008; 657 /** Cursor centering window hint 658 * 659 * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint). 660 */ 661 enum GLFW_CENTER_CURSOR = 0x00020009; 662 /** Window framebuffer transparency hint and attribute 663 * 664 * Window framebuffer transparency 665 * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and 666 * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib). 667 */ 668 enum GLFW_TRANSPARENT_FRAMEBUFFER = 0x0002000A; 669 /** Mouse cursor hover window attribute. 670 * 671 * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib). 672 */ 673 enum GLFW_HOVERED = 0x0002000B; 674 /** Input focus on calling show window hint and attribute 675 * 676 * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or 677 * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). 678 */ 679 enum GLFW_FOCUS_ON_SHOW = 0x0002000C; 680 681 /** Framebuffer bit depth hint. 682 * 683 * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). 684 */ 685 enum GLFW_RED_BITS = 0x00021001; 686 /** Framebuffer bit depth hint. 687 * 688 * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS). 689 */ 690 enum GLFW_GREEN_BITS = 0x00021002; 691 /** Framebuffer bit depth hint. 692 * 693 * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS). 694 */ 695 enum GLFW_BLUE_BITS = 0x00021003; 696 /** Framebuffer bit depth hint. 697 * 698 * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS). 699 */ 700 enum GLFW_ALPHA_BITS = 0x00021004; 701 /** Framebuffer bit depth hint. 702 * 703 * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS). 704 */ 705 enum GLFW_DEPTH_BITS = 0x00021005; 706 /** Framebuffer bit depth hint. 707 * 708 * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS). 709 */ 710 enum GLFW_STENCIL_BITS = 0x00021006; 711 /** Framebuffer bit depth hint. 712 * 713 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS). 714 */ 715 enum GLFW_ACCUM_RED_BITS = 0x00021007; 716 /** Framebuffer bit depth hint. 717 * 718 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS). 719 */ 720 enum GLFW_ACCUM_GREEN_BITS = 0x00021008; 721 /** Framebuffer bit depth hint. 722 * 723 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS). 724 */ 725 enum GLFW_ACCUM_BLUE_BITS = 0x00021009; 726 /** Framebuffer bit depth hint. 727 * 728 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS). 729 */ 730 enum GLFW_ACCUM_ALPHA_BITS = 0x0002100A; 731 /** Framebuffer auxiliary buffer hint. 732 * 733 * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS). 734 */ 735 enum GLFW_AUX_BUFFERS = 0x0002100B; 736 /** OpenGL stereoscopic rendering hint. 737 * 738 * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO). 739 */ 740 enum GLFW_STEREO = 0x0002100C; 741 /** Framebuffer MSAA samples hint. 742 * 743 * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES). 744 */ 745 enum GLFW_SAMPLES = 0x0002100D; 746 /** Framebuffer sRGB hint. 747 * 748 * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE). 749 */ 750 enum GLFW_SRGB_CAPABLE = 0x0002100E; 751 /** Monitor refresh rate hint. 752 * 753 * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE). 754 */ 755 enum GLFW_REFRESH_RATE = 0x0002100F; 756 /** Framebuffer double buffering hint. 757 * 758 * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER). 759 */ 760 enum GLFW_DOUBLEBUFFER = 0x00021010; 761 762 /** Context client API hint and attribute. 763 * 764 * Context client API [hint](@ref GLFW_CLIENT_API_hint) and 765 * [attribute](@ref GLFW_CLIENT_API_attrib). 766 */ 767 enum GLFW_CLIENT_API = 0x00022001; 768 /** Context client API major version hint and attribute. 769 * 770 * Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint) 771 * and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib). 772 */ 773 enum GLFW_CONTEXT_VERSION_MAJOR = 0x00022002; 774 /** Context client API minor version hint and attribute. 775 * 776 * Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint) 777 * and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib). 778 */ 779 enum GLFW_CONTEXT_VERSION_MINOR = 0x00022003; 780 /** Context client API revision number hint and attribute. 781 * 782 * Context client API revision number 783 * [attribute](@ref GLFW_CONTEXT_REVISION_attrib). 784 */ 785 enum GLFW_CONTEXT_REVISION = 0x00022004; 786 /** Context robustness hint and attribute. 787 * 788 * Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint) 789 * and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib). 790 */ 791 enum GLFW_CONTEXT_ROBUSTNESS = 0x00022005; 792 /** OpenGL forward-compatibility hint and attribute. 793 * 794 * OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) 795 * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib). 796 */ 797 enum GLFW_OPENGL_FORWARD_COMPAT = 0x00022006; 798 /** OpenGL debug context hint and attribute. 799 * 800 * OpenGL debug context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and 801 * [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib). 802 */ 803 enum GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007; 804 /** OpenGL profile hint and attribute. 805 * 806 * OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and 807 * [attribute](@ref GLFW_OPENGL_PROFILE_attrib). 808 */ 809 enum GLFW_OPENGL_PROFILE = 0x00022008; 810 /** Context flush-on-release hint and attribute. 811 * 812 * Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and 813 * [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib). 814 */ 815 enum GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x00022009; 816 /** Context error suppression hint and attribute. 817 * 818 * Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and 819 * [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib). 820 */ 821 enum GLFW_CONTEXT_NO_ERROR = 0x0002200A; 822 /** Context creation API hint and attribute. 823 * 824 * Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and 825 * [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib). 826 */ 827 enum GLFW_CONTEXT_CREATION_API = 0x0002200B; 828 /** Window content area scaling window 829 * [window hint](@ref GLFW_SCALE_TO_MONITOR). 830 */ 831 enum GLFW_SCALE_TO_MONITOR = 0x0002200C; 832 /** macOS specific 833 * [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint). 834 */ 835 enum GLFW_COCOA_RETINA_FRAMEBUFFER = 0x00023001; 836 /** macOS specific 837 * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint). 838 */ 839 enum GLFW_COCOA_FRAME_NAME = 0x00023002; 840 /** macOS specific 841 * [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint). 842 */ 843 enum GLFW_COCOA_GRAPHICS_SWITCHING = 0x00023003; 844 /** X11 specific 845 * [window hint](@ref GLFW_X11_CLASS_NAME_hint). 846 */ 847 enum GLFW_X11_CLASS_NAME = 0x00024001; 848 /** X11 specific 849 * [window hint](@ref GLFW_X11_CLASS_NAME_hint). 850 */ 851 enum GLFW_X11_INSTANCE_NAME = 0x00024002; 852 /** @} */ 853 854 enum GLFW_NO_API = 0; 855 enum GLFW_OPENGL_API = 0x00030001; 856 enum GLFW_OPENGL_ES_API = 0x00030002; 857 858 enum GLFW_NO_ROBUSTNESS = 0; 859 enum GLFW_NO_RESET_NOTIFICATION = 0x00031001; 860 enum GLFW_LOSE_CONTEXT_ON_RESET = 0x00031002; 861 862 enum GLFW_OPENGL_ANY_PROFILE = 0; 863 enum GLFW_OPENGL_CORE_PROFILE = 0x00032001; 864 enum GLFW_OPENGL_COMPAT_PROFILE = 0x00032002; 865 866 enum GLFW_CURSOR = 0x00033001; 867 enum GLFW_STICKY_KEYS = 0x00033002; 868 enum GLFW_STICKY_MOUSE_BUTTONS = 0x00033003; 869 enum GLFW_LOCK_KEY_MODS = 0x00033004; 870 enum GLFW_RAW_MOUSE_MOTION = 0x00033005; 871 872 enum GLFW_CURSOR_NORMAL = 0x00034001; 873 enum GLFW_CURSOR_HIDDEN = 0x00034002; 874 enum GLFW_CURSOR_DISABLED = 0x00034003; 875 876 enum GLFW_ANY_RELEASE_BEHAVIOR = 0; 877 enum GLFW_RELEASE_BEHAVIOR_FLUSH = 0x00035001; 878 enum GLFW_RELEASE_BEHAVIOR_NONE = 0x00035002; 879 880 enum GLFW_NATIVE_CONTEXT_API = 0x00036001; 881 enum GLFW_EGL_CONTEXT_API = 0x00036002; 882 enum GLFW_OSMESA_CONTEXT_API = 0x00036003; 883 884 /** @defgroup shapes Standard cursor shapes 885 * Standard system cursor shapes. 886 * 887 * See [standard cursor creation](@ref cursor_standard) for how these are used. 888 * 889 * Ingroup: input 890 * @{ */ 891 892 /** The regular arrow cursor shape. 893 * 894 * The regular arrow cursor. 895 */ 896 enum GLFW_ARROW_CURSOR = 0x00036001; 897 /** The text input I-beam cursor shape. 898 * 899 * The text input I-beam cursor shape. 900 */ 901 enum GLFW_IBEAM_CURSOR = 0x00036002; 902 /** The crosshair shape. 903 * 904 * The crosshair shape. 905 */ 906 enum GLFW_CROSSHAIR_CURSOR = 0x00036003; 907 /** The hand shape. 908 * 909 * The hand shape. 910 */ 911 enum GLFW_HAND_CURSOR = 0x00036004; 912 /** The horizontal resize arrow shape. 913 * 914 * The horizontal resize arrow shape. 915 */ 916 enum GLFW_HRESIZE_CURSOR = 0x00036005; 917 /** The vertical resize arrow shape. 918 * 919 * The vertical resize arrow shape. 920 */ 921 enum GLFW_VRESIZE_CURSOR = 0x00036006; 922 /** @} */ 923 924 enum GLFW_CONNECTED = 0x00040001; 925 enum GLFW_DISCONNECTED = 0x00040002; 926 927 /** @addtogroup init 928 * @{ */ 929 /** Joystick hat buttons init hint. 930 * 931 * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS). 932 */ 933 enum GLFW_JOYSTICK_HAT_BUTTONS = 0x00050001; 934 /** macOS specific init hint. 935 * 936 * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint). 937 */ 938 enum GLFW_COCOA_CHDIR_RESOURCES = 0x00051001; 939 /** macOS specific init hint. 940 * 941 * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint). 942 */ 943 enum GLFW_COCOA_MENUBAR = 0x00051002; 944 /** @} */ 945 946 enum GLFW_DONT_CARE = -1; 947 948 949 /************************************************************************* 950 * GLFW API types 951 *************************************************************************/ 952 953 /** Client API function pointer type. 954 * 955 * Generic function pointer used for returning client API function pointers 956 * without forcing a cast from a regular pointer. 957 * 958 * @sa @ref context_glext 959 * @sa @ref glfwGetProcAddress 960 * 961 * Since: Added in version 3.0. 962 * 963 * Ingroup: context 964 */ 965 alias void function() GLFWglproc; 966 967 /** Vulkan API function pointer type. 968 * 969 * Generic function pointer used for returning Vulkan API function pointers 970 * without forcing a cast from a regular pointer. 971 * 972 * @sa @ref vulkan_proc 973 * @sa @ref glfwGetInstanceProcAddress 974 * 975 * Since: Added in version 3.2. 976 * 977 * Ingroup: vulkan 978 */ 979 alias void function() GLFWvkproc; 980 981 /** Opaque monitor object. 982 * 983 * Opaque monitor object. 984 * 985 * @see @ref monitor_object 986 * 987 * Since: Added in version 3.0. 988 * 989 * Ingroup: monitor 990 */ 991 struct GLFWmonitor; 992 993 /** Opaque window object. 994 * 995 * Opaque window object. 996 * 997 * @see @ref window_object 998 * 999 * Since: Added in version 3.0. 1000 * 1001 * Ingroup: window 1002 */ 1003 struct GLFWwindow; 1004 1005 /** Opaque cursor object. 1006 * 1007 * Opaque cursor object. 1008 * 1009 * @see @ref cursor_object 1010 * 1011 * Since: Added in version 3.1. 1012 * 1013 * Ingroup: input 1014 */ 1015 struct GLFWcursor; 1016 1017 /** The function pointer type for error callbacks. 1018 * 1019 * This is the function pointer type for error callbacks. An error callback 1020 * function has the following signature: 1021 * ``` 1022 * void callback_name(int error_code, const char* description) 1023 * ``` 1024 * 1025 * Params: 1026 * error_code = An [error code](@ref errors). Future releases may add 1027 * more error codes. 1028 * description = A UTF-8 encoded string describing the error. 1029 * 1030 * Pointer_lifetime: The error description string is valid until the callback 1031 * function returns. 1032 * 1033 * @sa @ref error_handling 1034 * @sa @ref glfwSetErrorCallback 1035 * 1036 * Since: Added in version 3.0. 1037 * 1038 * Ingroup: init 1039 */ 1040 alias void function(int, const(char)*) GLFWerrorfun; 1041 1042 /** The function pointer type for window position callbacks. 1043 * 1044 * This is the function pointer type for window position callbacks. A window 1045 * position callback function has the following signature: 1046 * ``` 1047 * void callback_name(GLFWwindow* window, int xpos, int ypos) 1048 * ``` 1049 * 1050 * Params: 1051 * window = The window that was moved. 1052 * xpos = The new x-coordinate, in screen coordinates, of the 1053 * upper-left corner of the content area of the window. 1054 * ypos = The new y-coordinate, in screen coordinates, of the 1055 * upper-left corner of the content area of the window. 1056 * 1057 * @sa @ref window_pos 1058 * @sa @ref glfwSetWindowPosCallback 1059 * 1060 * Since: Added in version 3.0. 1061 * 1062 * Ingroup: window 1063 */ 1064 alias void function(GLFWwindow*, int, int) GLFWwindowposfun; 1065 1066 /** The function pointer type for window size callbacks. 1067 * 1068 * This is the function pointer type for window size callbacks. A window size 1069 * callback function has the following signature: 1070 * ``` 1071 * void callback_name(GLFWwindow* window, int width, int height) 1072 * ``` 1073 * 1074 * Params: 1075 * window = The window that was resized. 1076 * width = The new width, in screen coordinates, of the window. 1077 * height = The new height, in screen coordinates, of the window. 1078 * 1079 * @sa @ref window_size 1080 * @sa @ref glfwSetWindowSizeCallback 1081 * 1082 * Since: Added in version 1.0. 1083 * @glfw3 Added window handle parameter. 1084 * 1085 * Ingroup: window 1086 */ 1087 alias void function(GLFWwindow*, int, int) GLFWwindowsizefun; 1088 1089 /** The function pointer type for window close callbacks. 1090 * 1091 * This is the function pointer type for window close callbacks. A window 1092 * close callback function has the following signature: 1093 * ``` 1094 * void function_name(GLFWwindow* window) 1095 * ``` 1096 * 1097 * Params: 1098 * window = The window that the user attempted to close. 1099 * 1100 * @sa @ref window_close 1101 * @sa @ref glfwSetWindowCloseCallback 1102 * 1103 * Since: Added in version 2.5. 1104 * @glfw3 Added window handle parameter. 1105 * 1106 * Ingroup: window 1107 */ 1108 alias void function(GLFWwindow*) GLFWwindowclosefun; 1109 1110 /** The function pointer type for window content refresh callbacks. 1111 * 1112 * This is the function pointer type for window content refresh callbacks. 1113 * A window content refresh callback function has the following signature: 1114 * ``` 1115 * void function_name(GLFWwindow* window); 1116 * ``` 1117 * 1118 * Params: 1119 * window = The window whose content needs to be refreshed. 1120 * 1121 * @sa @ref window_refresh 1122 * @sa @ref glfwSetWindowRefreshCallback 1123 * 1124 * Since: Added in version 2.5. 1125 * @glfw3 Added window handle parameter. 1126 * 1127 * Ingroup: window 1128 */ 1129 alias void function(GLFWwindow*) GLFWwindowrefreshfun; 1130 1131 /** The function pointer type for window focus callbacks. 1132 * 1133 * This is the function pointer type for window focus callbacks. A window 1134 * focus callback function has the following signature: 1135 * ``` 1136 * void function_name(GLFWwindow* window, int focused) 1137 * ``` 1138 * 1139 * Params: 1140 * window = The window that gained or lost input focus. 1141 * focused = `GLFW_TRUE` if the window was given input focus, or 1142 * `GLFW_FALSE` if it lost it. 1143 * 1144 * @sa @ref window_focus 1145 * @sa @ref glfwSetWindowFocusCallback 1146 * 1147 * Since: Added in version 3.0. 1148 * 1149 * Ingroup: window 1150 */ 1151 alias void function(GLFWwindow*, int) GLFWwindowfocusfun; 1152 1153 /** The function pointer type for window iconify callbacks. 1154 * 1155 * This is the function pointer type for window iconify callbacks. A window 1156 * iconify callback function has the following signature: 1157 * ``` 1158 * void function_name(GLFWwindow* window, int iconified) 1159 * ``` 1160 * 1161 * Params: 1162 * window = The window that was iconified or restored. 1163 * iconified = `GLFW_TRUE` if the window was iconified, or 1164 * `GLFW_FALSE` if it was restored. 1165 * 1166 * @sa @ref window_iconify 1167 * @sa @ref glfwSetWindowIconifyCallback 1168 * 1169 * Since: Added in version 3.0. 1170 * 1171 * Ingroup: window 1172 */ 1173 alias void function(GLFWwindow*, int) GLFWwindowiconifyfun; 1174 1175 /** The function pointer type for window maximize callbacks. 1176 * 1177 * This is the function pointer type for window maximize callbacks. A window 1178 * maximize callback function has the following signature: 1179 * ``` 1180 * void function_name(GLFWwindow* window, int maximized) 1181 * ``` 1182 * 1183 * Params: 1184 * window = The window that was maximized or restored. 1185 * iconified = `GLFW_TRUE` if the window was maximized, or 1186 * `GLFW_FALSE` if it was restored. 1187 * 1188 * @sa @ref window_maximize 1189 * @sa glfwSetWindowMaximizeCallback 1190 * 1191 * Since: Added in version 3.3. 1192 * 1193 * Ingroup: window 1194 */ 1195 alias void function(GLFWwindow*, int) GLFWwindowmaximizefun; 1196 1197 /** The function pointer type for framebuffer size callbacks. 1198 * 1199 * This is the function pointer type for framebuffer size callbacks. 1200 * A framebuffer size callback function has the following signature: 1201 * ``` 1202 * void function_name(GLFWwindow* window, int width, int height) 1203 * ``` 1204 * 1205 * Params: 1206 * window = The window whose framebuffer was resized. 1207 * width = The new width, in pixels, of the framebuffer. 1208 * height = The new height, in pixels, of the framebuffer. 1209 * 1210 * @sa @ref window_fbsize 1211 * @sa @ref glfwSetFramebufferSizeCallback 1212 * 1213 * Since: Added in version 3.0. 1214 * 1215 * Ingroup: window 1216 */ 1217 alias void function(GLFWwindow*, int, int) GLFWframebuffersizefun; 1218 1219 /** The function pointer type for window content scale callbacks. 1220 * 1221 * This is the function pointer type for window content scale callbacks. 1222 * A window content scale callback function has the following signature: 1223 * ``` 1224 * void function_name(GLFWwindow* window, float xscale, float yscale) 1225 * ``` 1226 * 1227 * Params: 1228 * window = The window whose content scale changed. 1229 * xscale = The new x-axis content scale of the window. 1230 * yscale = The new y-axis content scale of the window. 1231 * 1232 * @sa @ref window_scale 1233 * @sa @ref glfwSetWindowContentScaleCallback 1234 * 1235 * Since: Added in version 3.3. 1236 * 1237 * Ingroup: window 1238 */ 1239 alias void function(GLFWwindow*, float, float) GLFWwindowcontentscalefun; 1240 1241 /** The function pointer type for mouse button callbacks. 1242 * 1243 * This is the function pointer type for mouse button callback functions. 1244 * A mouse button callback function has the following signature: 1245 * ``` 1246 * void function_name(GLFWwindow* window, int button, int action, int mods) 1247 * ``` 1248 * 1249 * Params: 1250 * window = The window that received the event. 1251 * button = The [mouse button](@ref buttons) that was pressed or 1252 * released. 1253 * action = One of `GLFW_PRESS` or `GLFW_RELEASE`. Future releases 1254 * may add more actions. 1255 * mods = Bit field describing which [modifier keys](@ref mods) were 1256 * held down. 1257 * 1258 * @sa @ref input_mouse_button 1259 * @sa @ref glfwSetMouseButtonCallback 1260 * 1261 * Since: Added in version 1.0. 1262 * @glfw3 Added window handle and modifier mask parameters. 1263 * 1264 * Ingroup: input 1265 */ 1266 alias void function(GLFWwindow*, int, int, int) GLFWmousebuttonfun; 1267 1268 /** The function pointer type for cursor position callbacks. 1269 * 1270 * This is the function pointer type for cursor position callbacks. A cursor 1271 * position callback function has the following signature: 1272 * ``` 1273 * void function_name(GLFWwindow* window, double xpos, double ypos); 1274 * ``` 1275 * 1276 * Params: 1277 * window = The window that received the event. 1278 * xpos = The new cursor x-coordinate, relative to the left edge of 1279 * the content area. 1280 * ypos = The new cursor y-coordinate, relative to the top edge of the 1281 * content area. 1282 * 1283 * @sa @ref cursor_pos 1284 * @sa @ref glfwSetCursorPosCallback 1285 * 1286 * Since: Added in version 3.0. Replaces `GLFWmouseposfun`. 1287 * 1288 * Ingroup: input 1289 */ 1290 alias void function(GLFWwindow*, double, double) GLFWcursorposfun; 1291 1292 /** The function pointer type for cursor enter/leave callbacks. 1293 * 1294 * This is the function pointer type for cursor enter/leave callbacks. 1295 * A cursor enter/leave callback function has the following signature: 1296 * ``` 1297 * void function_name(GLFWwindow* window, int entered) 1298 * ``` 1299 * 1300 * Params: 1301 * window = The window that received the event. 1302 * entered = `GLFW_TRUE` if the cursor entered the window's content 1303 * area, or `GLFW_FALSE` if it left it. 1304 * 1305 * @sa @ref cursor_enter 1306 * @sa @ref glfwSetCursorEnterCallback 1307 * 1308 * Since: Added in version 3.0. 1309 * 1310 * Ingroup: input 1311 */ 1312 alias void function(GLFWwindow*, int) GLFWcursorenterfun; 1313 1314 /** The function pointer type for scroll callbacks. 1315 * 1316 * This is the function pointer type for scroll callbacks. A scroll callback 1317 * function has the following signature: 1318 * ``` 1319 * void function_name(GLFWwindow* window, double xoffset, double yoffset) 1320 * ``` 1321 * 1322 * Params: 1323 * window = The window that received the event. 1324 * xoffset = The scroll offset along the x-axis. 1325 * yoffset = The scroll offset along the y-axis. 1326 * 1327 * @sa @ref scrolling 1328 * @sa @ref glfwSetScrollCallback 1329 * 1330 * Since: Added in version 3.0. Replaces `GLFWmousewheelfun`. 1331 * 1332 * Ingroup: input 1333 */ 1334 alias void function(GLFWwindow*, double, double) GLFWscrollfun; 1335 1336 /** The function pointer type for keyboard key callbacks. 1337 * 1338 * This is the function pointer type for keyboard key callbacks. A keyboard 1339 * key callback function has the following signature: 1340 * ``` 1341 * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods) 1342 * ``` 1343 * 1344 * Params: 1345 * window = The window that received the event. 1346 * key = The [keyboard key](@ref keys) that was pressed or released. 1347 * scancode = The system-specific scancode of the key. 1348 * action = `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. Future 1349 * releases may add more actions. 1350 * mods = Bit field describing which [modifier keys](@ref mods) were 1351 * held down. 1352 * 1353 * @sa @ref input_key 1354 * @sa @ref glfwSetKeyCallback 1355 * 1356 * Since: Added in version 1.0. 1357 * @glfw3 Added window handle, scancode and modifier mask parameters. 1358 * 1359 * Ingroup: input 1360 */ 1361 alias void function(GLFWwindow*, int, int, int, int) GLFWkeyfun; 1362 1363 /** The function pointer type for Unicode character callbacks. 1364 * 1365 * This is the function pointer type for Unicode character callbacks. 1366 * A Unicode character callback function has the following signature: 1367 * ``` 1368 * void function_name(GLFWwindow* window, unsigned int codepoint) 1369 * ``` 1370 * 1371 * Params: 1372 * window = The window that received the event. 1373 * codepoint = The Unicode code point of the character. 1374 * 1375 * @sa @ref input_char 1376 * @sa @ref glfwSetCharCallback 1377 * 1378 * Since: Added in version 2.4. 1379 * @glfw3 Added window handle parameter. 1380 * 1381 * Ingroup: input 1382 */ 1383 alias void function(GLFWwindow*, uint) GLFWcharfun; 1384 1385 /** The function pointer type for Unicode character with modifiers 1386 * callbacks. 1387 * 1388 * This is the function pointer type for Unicode character with modifiers 1389 * callbacks. It is called for each input character, regardless of what 1390 * modifier keys are held down. A Unicode character with modifiers callback 1391 * function has the following signature: 1392 * ``` 1393 * void function_name(GLFWwindow* window, unsigned int codepoint, int mods) 1394 * ``` 1395 * 1396 * Params: 1397 * window = The window that received the event. 1398 * codepoint = The Unicode code point of the character. 1399 * mods = Bit field describing which [modifier keys](@ref mods) were 1400 * held down. 1401 * 1402 * @sa @ref input_char 1403 * @sa @ref glfwSetCharModsCallback 1404 * 1405 * @deprecated Scheduled for removal in version 4.0. 1406 * 1407 * Since: Added in version 3.1. 1408 * 1409 * Ingroup: input 1410 */ 1411 alias void function(GLFWwindow*, uint, int) GLFWcharmodsfun; 1412 1413 /** The function pointer type for path drop callbacks. 1414 * 1415 * This is the function pointer type for path drop callbacks. A path drop 1416 * callback function has the following signature: 1417 * ``` 1418 * void function_name(GLFWwindow* window, int path_count, const char* paths[]) 1419 * ``` 1420 * 1421 * Params: 1422 * window = The window that received the event. 1423 * path_count = The number of dropped paths. 1424 * paths = The UTF-8 encoded file and/or directory path names. 1425 * 1426 * Pointer_lifetime: The path array and its strings are valid until the 1427 * callback function returns. 1428 * 1429 * @sa @ref path_drop 1430 * @sa @ref glfwSetDropCallback 1431 * 1432 * Since: Added in version 3.1. 1433 * 1434 * Ingroup: input 1435 */ 1436 alias void function(GLFWwindow*, int, const(char)**) GLFWdropfun; 1437 1438 /** The function pointer type for monitor configuration callbacks. 1439 * 1440 * This is the function pointer type for monitor configuration callbacks. 1441 * A monitor callback function has the following signature: 1442 * ``` 1443 * void function_name(GLFWmonitor* monitor, int event) 1444 * ``` 1445 * 1446 * Params: 1447 * monitor = The monitor that was connected or disconnected. 1448 * event = One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future 1449 * releases may add more events. 1450 * 1451 * @sa @ref monitor_event 1452 * @sa @ref glfwSetMonitorCallback 1453 * 1454 * Since: Added in version 3.0. 1455 * 1456 * Ingroup: monitor 1457 */ 1458 alias void function(GLFWmonitor*, int) GLFWmonitorfun; 1459 1460 /** The function pointer type for joystick configuration callbacks. 1461 * 1462 * This is the function pointer type for joystick configuration callbacks. 1463 * A joystick configuration callback function has the following signature: 1464 * ``` 1465 * void function_name(int jid, int event) 1466 * ``` 1467 * 1468 * Params: 1469 * jid = The joystick that was connected or disconnected. 1470 * event = One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future 1471 * releases may add more events. 1472 * 1473 * @sa @ref joystick_event 1474 * @sa @ref glfwSetJoystickCallback 1475 * 1476 * Since: Added in version 3.2. 1477 * 1478 * Ingroup: input 1479 */ 1480 alias void function(int, int) GLFWjoystickfun; 1481 1482 /** Video mode type. 1483 * 1484 * This describes a single video mode. 1485 * 1486 * @sa @ref monitor_modes 1487 * @sa @ref glfwGetVideoMode 1488 * @sa @ref glfwGetVideoModes 1489 * 1490 * Since: Added in version 1.0. 1491 * @glfw3 Added refresh rate member. 1492 * 1493 * Ingroup: monitor 1494 */ 1495 struct GLFWvidmode { 1496 /** The width, in screen coordinates, of the video mode. 1497 */ 1498 int width; 1499 /** The height, in screen coordinates, of the video mode. 1500 */ 1501 int height; 1502 /** The bit depth of the red channel of the video mode. 1503 */ 1504 int redBits; 1505 /** The bit depth of the green channel of the video mode. 1506 */ 1507 int greenBits; 1508 /** The bit depth of the blue channel of the video mode. 1509 */ 1510 int blueBits; 1511 /** The refresh rate, in Hz, of the video mode. 1512 */ 1513 int refreshRate; 1514 } 1515 1516 /** Gamma ramp. 1517 * 1518 * This describes the gamma ramp for a monitor. 1519 * 1520 * @sa @ref monitor_gamma 1521 * @sa @ref glfwGetGammaRamp 1522 * @sa @ref glfwSetGammaRamp 1523 * 1524 * Since: Added in version 3.0. 1525 * 1526 * Ingroup: monitor 1527 */ 1528 struct GLFWgammaramp { 1529 /** An array of value describing the response of the red channel. 1530 */ 1531 ushort* red; 1532 /** An array of value describing the response of the green channel. 1533 */ 1534 ushort* green; 1535 /** An array of value describing the response of the blue channel. 1536 */ 1537 ushort* blue; 1538 /** The number of elements in each array. 1539 */ 1540 uint size; 1541 } 1542 1543 /** Image data. 1544 * 1545 * This describes a single 2D image. See the documentation for each related 1546 * function what the expected pixel format is. 1547 * 1548 * @sa @ref cursor_custom 1549 * @sa @ref window_icon 1550 * 1551 * Since: Added in version 2.1. 1552 * @glfw3 Removed format and bytes-per-pixel members. 1553 * 1554 * Ingroup: window 1555 */ 1556 struct GLFWimage { 1557 /** The width, in pixels, of this image. 1558 */ 1559 int width; 1560 /** The height, in pixels, of this image. 1561 */ 1562 int height; 1563 /** The pixel data of this image, arranged left-to-right, top-to-bottom. 1564 */ 1565 ubyte* pixels; 1566 } 1567 1568 /** Gamepad input state 1569 * 1570 * This describes the input state of a gamepad. 1571 * 1572 * @sa @ref gamepad 1573 * @sa @ref glfwGetGamepadState 1574 * 1575 * Since: Added in version 3.3. 1576 * 1577 * Ingroup: input 1578 */ 1579 struct GLFWgamepadstate { 1580 /** The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS` 1581 * or `GLFW_RELEASE`. 1582 */ 1583 ubyte[15] buttons; 1584 /** The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0 1585 * to 1.0 inclusive. 1586 */ 1587 float[6] axes; 1588 } 1589 1590 1591 /************************************************************************* 1592 * GLFW API functions 1593 *************************************************************************/ 1594 1595 /** Initializes the GLFW library. 1596 * 1597 * This function initializes the GLFW library. Before most GLFW functions can 1598 * be used, GLFW must be initialized, and before an application terminates GLFW 1599 * should be terminated in order to free any resources allocated during or 1600 * after initialization. 1601 * 1602 * If this function fails, it calls @ref glfwTerminate before returning. If it 1603 * succeeds, you should call @ref glfwTerminate before the application exits. 1604 * 1605 * Additional calls to this function after successful initialization but before 1606 * termination will return `GLFW_TRUE` immediately. 1607 * 1608 * Returns: `GLFW_TRUE` if successful, or `GLFW_FALSE` if an 1609 * [error](@ref error_handling) occurred. 1610 * 1611 * Errors: Possible errors include @ref GLFW_PLATFORM_ERROR. 1612 * 1613 * @remark @macos This function will change the current directory of the 1614 * application to the `Contents/Resources` subdirectory of the application's 1615 * bundle, if present. This can be disabled with the @ref 1616 * GLFW_COCOA_CHDIR_RESOURCES init hint. 1617 * 1618 * Thread_Safety: This function must only be called from the main thread. 1619 * 1620 * @sa @ref intro_init 1621 * @sa @ref glfwTerminate 1622 * 1623 * Since: Added in version 1.0. 1624 * 1625 * Ingroup: init 1626 */ 1627 int glfwInit(); 1628 1629 /** Terminates the GLFW library. 1630 * 1631 * This function destroys all remaining windows and cursors, restores any 1632 * modified gamma ramps and frees any other allocated resources. Once this 1633 * function is called, you must again call @ref glfwInit successfully before 1634 * you will be able to use most GLFW functions. 1635 * 1636 * If GLFW has been successfully initialized, this function should be called 1637 * before the application exits. If initialization fails, there is no need to 1638 * call this function, as it is called by @ref glfwInit before it returns 1639 * failure. 1640 * 1641 * Errors: Possible errors include @ref GLFW_PLATFORM_ERROR. 1642 * 1643 * @remark This function may be called before @ref glfwInit. 1644 * 1645 * @warning The contexts of any remaining windows must not be current on any 1646 * other thread when this function is called. 1647 * 1648 * @reentrancy This function must not be called from a callback. 1649 * 1650 * Thread_Safety: This function must only be called from the main thread. 1651 * 1652 * @sa @ref intro_init 1653 * @sa @ref glfwInit 1654 * 1655 * Since: Added in version 1.0. 1656 * 1657 * Ingroup: init 1658 */ 1659 void glfwTerminate(); 1660 1661 /** Sets the specified init hint to the desired value. 1662 * 1663 * This function sets hints for the next initialization of GLFW. 1664 * 1665 * The values you set hints to are never reset by GLFW, but they only take 1666 * effect during initialization. Once GLFW has been initialized, any values 1667 * you set will be ignored until the library is terminated and initialized 1668 * again. 1669 * 1670 * Some hints are platform specific. These may be set on any platform but they 1671 * will only affect their specific platform. Other platforms will ignore them. 1672 * Setting these hints requires no platform specific headers or functions. 1673 * 1674 * Params: 1675 * hint = The [init hint](@ref init_hints) to set. 1676 * value = The new value of the init hint. 1677 * 1678 * Errors: Possible errors include @ref GLFW_INVALID_ENUM and @ref 1679 * GLFW_INVALID_VALUE. 1680 * 1681 * @remarks This function may be called before @ref glfwInit. 1682 * 1683 * Thread_Safety: This function must only be called from the main thread. 1684 * 1685 * @sa init_hints 1686 * @sa glfwInit 1687 * 1688 * Since: Added in version 3.3. 1689 * 1690 * Ingroup: init 1691 */ 1692 void glfwInitHint(int hint, int value); 1693 1694 /** Retrieves the version of the GLFW library. 1695 * 1696 * This function retrieves the major, minor and revision numbers of the GLFW 1697 * library. It is intended for when you are using GLFW as a shared library and 1698 * want to ensure that you are using the minimum required version. 1699 * 1700 * Any or all of the version arguments may be `null`. 1701 * 1702 * Params: 1703 * major = Where to store the major version number, or `null`. 1704 * minor = Where to store the minor version number, or `null`. 1705 * rev = Where to store the revision number, or `null`. 1706 * 1707 * Errors: None. 1708 * 1709 * @remark This function may be called before @ref glfwInit. 1710 * 1711 * Thread_Safety: This function may be called from any thread. 1712 * 1713 * @sa @ref intro_version 1714 * @sa @ref glfwGetVersionString 1715 * 1716 * Since: Added in version 1.0. 1717 * 1718 * Ingroup: init 1719 */ 1720 void glfwGetVersion(int* major, int* minor, int* rev); 1721 1722 /** Returns a string describing the compile-time configuration. 1723 * 1724 * This function returns the compile-time generated 1725 * [version string](@ref intro_version_string) of the GLFW library binary. It 1726 * describes the version, platform, compiler and any platform-specific 1727 * compile-time options. It should not be confused with the OpenGL or OpenGL 1728 * ES version string, queried with `glGetString`. 1729 * 1730 * __Do not use the version string__ to parse the GLFW library version. The 1731 * @ref glfwGetVersion function provides the version of the running library 1732 * binary in numerical format. 1733 * 1734 * Returns: The ASCII encoded GLFW version string. 1735 * 1736 * Errors: None. 1737 * 1738 * @remark This function may be called before @ref glfwInit. 1739 * 1740 * Pointer_lifetime: The returned string is static and compile-time generated. 1741 * 1742 * Thread_Safety: This function may be called from any thread. 1743 * 1744 * @sa @ref intro_version 1745 * @sa @ref glfwGetVersion 1746 * 1747 * Since: Added in version 3.0. 1748 * 1749 * Ingroup: init 1750 */ 1751 const(char)* glfwGetVersionString(); 1752 1753 /** Returns and clears the last error for the calling thread. 1754 * 1755 * This function returns and clears the [error code](@ref errors) of the last 1756 * error that occurred on the calling thread, and optionally a UTF-8 encoded 1757 * human-readable description of it. If no error has occurred since the last 1758 * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is 1759 * set to `null`. 1760 * 1761 * Params: 1762 * description = Where to store the error description pointer, or `null`. 1763 * Returns: The last error code for the calling thread, or @ref GLFW_NO_ERROR 1764 * (zero). 1765 * 1766 * Errors: None. 1767 * 1768 * Pointer_lifetime: The returned string is allocated and freed by GLFW. You 1769 * should not free it yourself. It is guaranteed to be valid only until the 1770 * next error occurs or the library is terminated. 1771 * 1772 * @remark This function may be called before @ref glfwInit. 1773 * 1774 * Thread_Safety: This function may be called from any thread. 1775 * 1776 * @sa @ref error_handling 1777 * @sa @ref glfwSetErrorCallback 1778 * 1779 * Since: Added in version 3.3. 1780 * 1781 * Ingroup: init 1782 */ 1783 int glfwGetError(const(char)** description); 1784 1785 /** Sets the error callback. 1786 * 1787 * This function sets the error callback, which is called with an error code 1788 * and a human-readable description each time a GLFW error occurs. 1789 * 1790 * The error code is set before the callback is called. Calling @ref 1791 * glfwGetError from the error callback will return the same value as the error 1792 * code argument. 1793 * 1794 * The error callback is called on the thread where the error occurred. If you 1795 * are using GLFW from multiple threads, your error callback needs to be 1796 * written accordingly. 1797 * 1798 * Because the description string may have been generated specifically for that 1799 * error, it is not guaranteed to be valid after the callback has returned. If 1800 * you wish to use it after the callback returns, you need to make a copy. 1801 * 1802 * Once set, the error callback remains set even after the library has been 1803 * terminated. 1804 * 1805 * Params: 1806 * callback = The new callback, or `null` to remove the currently set 1807 * callback. 1808 * Returns: The previously set callback, or `null` if no callback was set. 1809 * 1810 * @callback_signature 1811 * ``` 1812 * void callback_name(int error_code, const char* description) 1813 * ``` 1814 * For more information about the callback parameters, see the 1815 * [callback pointer type](@ref GLFWerrorfun). 1816 * 1817 * Errors: None. 1818 * 1819 * @remark This function may be called before @ref glfwInit. 1820 * 1821 * Thread_Safety: This function must only be called from the main thread. 1822 * 1823 * @sa @ref error_handling 1824 * @sa @ref glfwGetError 1825 * 1826 * Since: Added in version 3.0. 1827 * 1828 * Ingroup: init 1829 */ 1830 GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback); 1831 1832 /** Returns the currently connected monitors. 1833 * 1834 * This function returns an array of handles for all currently connected 1835 * monitors. The primary monitor is always first in the returned array. If no 1836 * monitors were found, this function returns `null`. 1837 * 1838 * Params: 1839 * count = Where to store the number of monitors in the returned 1840 * array. This is set to zero if an error occurred. 1841 * Returns: An array of monitor handles, or `null` if no monitors were found or 1842 * if an [error](@ref error_handling) occurred. 1843 * 1844 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 1845 * 1846 * Pointer_lifetime: The returned array is allocated and freed by GLFW. You 1847 * should not free it yourself. It is guaranteed to be valid only until the 1848 * monitor configuration changes or the library is terminated. 1849 * 1850 * Thread_Safety: This function must only be called from the main thread. 1851 * 1852 * @sa @ref monitor_monitors 1853 * @sa @ref monitor_event 1854 * @sa @ref glfwGetPrimaryMonitor 1855 * 1856 * Since: Added in version 3.0. 1857 * 1858 * Ingroup: monitor 1859 */ 1860 GLFWmonitor** glfwGetMonitors(int* count); 1861 1862 /** Returns the primary monitor. 1863 * 1864 * This function returns the primary monitor. This is usually the monitor 1865 * where elements like the task bar or global menu bar are located. 1866 * 1867 * Returns: The primary monitor, or `null` if no monitors were found or if an 1868 * [error](@ref error_handling) occurred. 1869 * 1870 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 1871 * 1872 * Thread_Safety: This function must only be called from the main thread. 1873 * 1874 * @remark The primary monitor is always first in the array returned by @ref 1875 * glfwGetMonitors. 1876 * 1877 * @sa @ref monitor_monitors 1878 * @sa @ref glfwGetMonitors 1879 * 1880 * Since: Added in version 3.0. 1881 * 1882 * Ingroup: monitor 1883 */ 1884 GLFWmonitor* glfwGetPrimaryMonitor(); 1885 1886 /** Returns the position of the monitor's viewport on the virtual screen. 1887 * 1888 * This function returns the position, in screen coordinates, of the upper-left 1889 * corner of the specified monitor. 1890 * 1891 * Any or all of the position arguments may be `null`. If an error occurs, all 1892 * non-`null` position arguments will be set to zero. 1893 * 1894 * Params: 1895 * monitor = The monitor to query. 1896 * xpos = Where to store the monitor x-coordinate, or `null`. 1897 * ypos = Where to store the monitor y-coordinate, or `null`. 1898 * 1899 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 1900 * GLFW_PLATFORM_ERROR. 1901 * 1902 * Thread_Safety: This function must only be called from the main thread. 1903 * 1904 * @sa @ref monitor_properties 1905 * 1906 * Since: Added in version 3.0. 1907 * 1908 * Ingroup: monitor 1909 */ 1910 void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); 1911 1912 /** Retrieves the work area of the monitor. 1913 * 1914 * This function returns the position, in screen coordinates, of the upper-left 1915 * corner of the work area of the specified monitor along with the work area 1916 * size in screen coordinates. The work area is defined as the area of the 1917 * monitor not occluded by the operating system task bar where present. If no 1918 * task bar exists then the work area is the monitor resolution in screen 1919 * coordinates. 1920 * 1921 * Any or all of the position and size arguments may be `null`. If an error 1922 * occurs, all non-`null` position and size arguments will be set to zero. 1923 * 1924 * Params: 1925 * monitor = The monitor to query. 1926 * xpos = Where to store the monitor x-coordinate, or `null`. 1927 * ypos = Where to store the monitor y-coordinate, or `null`. 1928 * width = Where to store the monitor width, or `null`. 1929 * height = Where to store the monitor height, or `null`. 1930 * 1931 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 1932 * GLFW_PLATFORM_ERROR. 1933 * 1934 * Thread_Safety: This function must only be called from the main thread. 1935 * 1936 * @sa @ref monitor_workarea 1937 * 1938 * Since: Added in version 3.3. 1939 * 1940 * Ingroup: monitor 1941 */ 1942 void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); 1943 1944 /** Returns the physical size of the monitor. 1945 * 1946 * This function returns the size, in millimetres, of the display area of the 1947 * specified monitor. 1948 * 1949 * Some systems do not provide accurate monitor size information, either 1950 * because the monitor 1951 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) 1952 * data is incorrect or because the driver does not report it accurately. 1953 * 1954 * Any or all of the size arguments may be `null`. If an error occurs, all 1955 * non-`null` size arguments will be set to zero. 1956 * 1957 * Params: 1958 * monitor = The monitor to query. 1959 * widthMM = Where to store the width, in millimetres, of the 1960 * monitor's display area, or `null`. 1961 * heightMM = Where to store the height, in millimetres, of the 1962 * monitor's display area, or `null`. 1963 * 1964 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 1965 * 1966 * @remark @win32 calculates the returned physical size from the 1967 * current resolution and system DPI instead of querying the monitor EDID data. 1968 * 1969 * Thread_Safety: This function must only be called from the main thread. 1970 * 1971 * @sa @ref monitor_properties 1972 * 1973 * Since: Added in version 3.0. 1974 * 1975 * Ingroup: monitor 1976 */ 1977 void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); 1978 1979 /** Retrieves the content scale for the specified monitor. 1980 * 1981 * This function retrieves the content scale for the specified monitor. The 1982 * content scale is the ratio between the current DPI and the platform's 1983 * default DPI. This is especially important for text and any UI elements. If 1984 * the pixel dimensions of your UI scaled by this look appropriate on your 1985 * machine then it should appear at a reasonable size on other machines 1986 * regardless of their DPI and scaling settings. This relies on the system DPI 1987 * and scaling settings being somewhat correct. 1988 * 1989 * The content scale may depend on both the monitor resolution and pixel 1990 * density and on user settings. It may be very different from the raw DPI 1991 * calculated from the physical size and current resolution. 1992 * 1993 * Params: 1994 * monitor = The monitor to query. 1995 * xscale = Where to store the x-axis content scale, or `null`. 1996 * yscale = Where to store the y-axis content scale, or `null`. 1997 * 1998 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 1999 * GLFW_PLATFORM_ERROR. 2000 * 2001 * Thread_Safety: This function must only be called from the main thread. 2002 * 2003 * @sa @ref monitor_scale 2004 * @sa @ref glfwGetWindowContentScale 2005 * 2006 * Since: Added in version 3.3. 2007 * 2008 * Ingroup: monitor 2009 */ 2010 void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); 2011 2012 /** Returns the name of the specified monitor. 2013 * 2014 * This function returns a human-readable name, encoded as UTF-8, of the 2015 * specified monitor. The name typically reflects the make and model of the 2016 * monitor and is not guaranteed to be unique among the connected monitors. 2017 * 2018 * Params: 2019 * monitor = The monitor to query. 2020 * Returns: The UTF-8 encoded name of the monitor, or `null` if an 2021 * [error](@ref error_handling) occurred. 2022 * 2023 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 2024 * 2025 * Pointer_lifetime: The returned string is allocated and freed by GLFW. You 2026 * should not free it yourself. It is valid until the specified monitor is 2027 * disconnected or the library is terminated. 2028 * 2029 * Thread_Safety: This function must only be called from the main thread. 2030 * 2031 * @sa @ref monitor_properties 2032 * 2033 * Since: Added in version 3.0. 2034 * 2035 * Ingroup: monitor 2036 */ 2037 const(char)* glfwGetMonitorName(GLFWmonitor* monitor); 2038 2039 /** Sets the user pointer of the specified monitor. 2040 * 2041 * This function sets the user-defined pointer of the specified monitor. The 2042 * current value is retained until the monitor is disconnected. The initial 2043 * value is `null`. 2044 * 2045 * This function may be called from the monitor callback, even for a monitor 2046 * that is being disconnected. 2047 * 2048 * Params: 2049 * monitor = The monitor whose pointer to set. 2050 * pointer = The new value. 2051 * 2052 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 2053 * 2054 * Thread_Safety: This function may be called from any thread. Access is not 2055 * synchronized. 2056 * 2057 * @sa @ref monitor_userptr 2058 * @sa @ref glfwGetMonitorUserPointer 2059 * 2060 * Since: Added in version 3.3. 2061 * 2062 * Ingroup: monitor 2063 */ 2064 void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); 2065 2066 /** Returns the user pointer of the specified monitor. 2067 * 2068 * This function returns the current value of the user-defined pointer of the 2069 * specified monitor. The initial value is `null`. 2070 * 2071 * This function may be called from the monitor callback, even for a monitor 2072 * that is being disconnected. 2073 * 2074 * Params: 2075 * monitor = The monitor whose pointer to return. 2076 * 2077 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 2078 * 2079 * Thread_Safety: This function may be called from any thread. Access is not 2080 * synchronized. 2081 * 2082 * @sa @ref monitor_userptr 2083 * @sa @ref glfwSetMonitorUserPointer 2084 * 2085 * Since: Added in version 3.3. 2086 * 2087 * Ingroup: monitor 2088 */ 2089 void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); 2090 2091 /** Sets the monitor configuration callback. 2092 * 2093 * This function sets the monitor configuration callback, or removes the 2094 * currently set callback. This is called when a monitor is connected to or 2095 * disconnected from the system. 2096 * 2097 * Params: 2098 * callback = The new callback, or `null` to remove the currently set 2099 * callback. 2100 * Returns: The previously set callback, or `null` if no callback was set or the 2101 * library had not been [initialized](@ref intro_init). 2102 * 2103 * @callback_signature 2104 * ``` 2105 * void function_name(GLFWmonitor* monitor, int event) 2106 * ``` 2107 * For more information about the callback parameters, see the 2108 * [function pointer type](@ref GLFWmonitorfun). 2109 * 2110 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 2111 * 2112 * Thread_Safety: This function must only be called from the main thread. 2113 * 2114 * @sa @ref monitor_event 2115 * 2116 * Since: Added in version 3.0. 2117 * 2118 * Ingroup: monitor 2119 */ 2120 GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback); 2121 2122 /** Returns the available video modes for the specified monitor. 2123 * 2124 * This function returns an array of all video modes supported by the specified 2125 * monitor. The returned array is sorted in ascending order, first by color 2126 * bit depth (the sum of all channel depths) and then by resolution area (the 2127 * product of width and height). 2128 * 2129 * Params: 2130 * monitor = The monitor to query. 2131 * count = Where to store the number of video modes in the returned 2132 * array. This is set to zero if an error occurred. 2133 * Returns: An array of video modes, or `null` if an 2134 * [error](@ref error_handling) occurred. 2135 * 2136 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2137 * GLFW_PLATFORM_ERROR. 2138 * 2139 * Pointer_lifetime: The returned array is allocated and freed by GLFW. You 2140 * should not free it yourself. It is valid until the specified monitor is 2141 * disconnected, this function is called again for that monitor or the library 2142 * is terminated. 2143 * 2144 * Thread_Safety: This function must only be called from the main thread. 2145 * 2146 * @sa @ref monitor_modes 2147 * @sa @ref glfwGetVideoMode 2148 * 2149 * Since: Added in version 1.0. 2150 * @glfw3 Changed to return an array of modes for a specific monitor. 2151 * 2152 * Ingroup: monitor 2153 */ 2154 const(GLFWvidmode)* glfwGetVideoModes(GLFWmonitor* monitor, int* count); 2155 2156 /** Returns the current mode of the specified monitor. 2157 * 2158 * This function returns the current video mode of the specified monitor. If 2159 * you have created a full screen window for that monitor, the return value 2160 * will depend on whether that window is iconified. 2161 * 2162 * Params: 2163 * monitor = The monitor to query. 2164 * Returns: The current mode of the monitor, or `null` if an 2165 * [error](@ref error_handling) occurred. 2166 * 2167 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2168 * GLFW_PLATFORM_ERROR. 2169 * 2170 * Pointer_lifetime: The returned array is allocated and freed by GLFW. You 2171 * should not free it yourself. It is valid until the specified monitor is 2172 * disconnected or the library is terminated. 2173 * 2174 * Thread_Safety: This function must only be called from the main thread. 2175 * 2176 * @sa @ref monitor_modes 2177 * @sa @ref glfwGetVideoModes 2178 * 2179 * Since: Added in version 3.0. Replaces `glfwGetDesktopMode`. 2180 * 2181 * Ingroup: monitor 2182 */ 2183 const(GLFWvidmode)* glfwGetVideoMode(GLFWmonitor* monitor); 2184 2185 /** Generates a gamma ramp and sets it for the specified monitor. 2186 * 2187 * This function generates an appropriately sized gamma ramp from the specified 2188 * exponent and then calls @ref glfwSetGammaRamp with it. The value must be 2189 * a finite number greater than zero. 2190 * 2191 * The software controlled gamma ramp is applied _in addition_ to the hardware 2192 * gamma correction, which today is usually an approximation of sRGB gamma. 2193 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce 2194 * the default (usually sRGB-like) behavior. 2195 * 2196 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref 2197 * GLFW_SRGB_CAPABLE hint. 2198 * 2199 * Params: 2200 * monitor = The monitor whose gamma ramp to set. 2201 * gamma = The desired exponent. 2202 * 2203 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 2204 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. 2205 * 2206 * @remark @wayland Gamma handling is a privileged protocol, this function 2207 * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. 2208 * 2209 * Thread_Safety: This function must only be called from the main thread. 2210 * 2211 * @sa @ref monitor_gamma 2212 * 2213 * Since: Added in version 3.0. 2214 * 2215 * Ingroup: monitor 2216 */ 2217 void glfwSetGamma(GLFWmonitor* monitor, float gamma); 2218 2219 /** Returns the current gamma ramp for the specified monitor. 2220 * 2221 * This function returns the current gamma ramp of the specified monitor. 2222 * 2223 * Params: 2224 * monitor = The monitor to query. 2225 * Returns: The current gamma ramp, or `null` if an 2226 * [error](@ref error_handling) occurred. 2227 * 2228 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2229 * GLFW_PLATFORM_ERROR. 2230 * 2231 * @remark @wayland Gamma handling is a privileged protocol, this function 2232 * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while 2233 * returning `null`. 2234 * 2235 * Pointer_lifetime: The returned structure and its arrays are allocated and 2236 * freed by GLFW. You should not free them yourself. They are valid until the 2237 * specified monitor is disconnected, this function is called again for that 2238 * monitor or the library is terminated. 2239 * 2240 * Thread_Safety: This function must only be called from the main thread. 2241 * 2242 * @sa @ref monitor_gamma 2243 * 2244 * Since: Added in version 3.0. 2245 * 2246 * Ingroup: monitor 2247 */ 2248 const(GLFWgammaramp)* glfwGetGammaRamp(GLFWmonitor* monitor); 2249 2250 /** Sets the current gamma ramp for the specified monitor. 2251 * 2252 * This function sets the current gamma ramp for the specified monitor. The 2253 * original gamma ramp for that monitor is saved by GLFW the first time this 2254 * function is called and is restored by @ref glfwTerminate. 2255 * 2256 * The software controlled gamma ramp is applied _in addition_ to the hardware 2257 * gamma correction, which today is usually an approximation of sRGB gamma. 2258 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce 2259 * the default (usually sRGB-like) behavior. 2260 * 2261 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref 2262 * GLFW_SRGB_CAPABLE hint. 2263 * 2264 * Params: 2265 * monitor = The monitor whose gamma ramp to set. 2266 * ramp = The gamma ramp to use. 2267 * 2268 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2269 * GLFW_PLATFORM_ERROR. 2270 * 2271 * @remark The size of the specified gamma ramp should match the size of the 2272 * current ramp for that monitor. 2273 * 2274 * @remark @win32 The gamma ramp size must be 256. 2275 * 2276 * @remark @wayland Gamma handling is a privileged protocol, this function 2277 * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. 2278 * 2279 * Pointer_lifetime: The specified gamma ramp is copied before this function 2280 * returns. 2281 * 2282 * Thread_Safety: This function must only be called from the main thread. 2283 * 2284 * @sa @ref monitor_gamma 2285 * 2286 * Since: Added in version 3.0. 2287 * 2288 * Ingroup: monitor 2289 */ 2290 void glfwSetGammaRamp(GLFWmonitor* monitor, const(GLFWgammaramp)* ramp); 2291 2292 /** Resets all window hints to their default values. 2293 * 2294 * This function resets all window hints to their 2295 * [default values](@ref window_hints_values). 2296 * 2297 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 2298 * 2299 * Thread_Safety: This function must only be called from the main thread. 2300 * 2301 * @sa @ref window_hints 2302 * @sa @ref glfwWindowHint 2303 * @sa @ref glfwWindowHintString 2304 * 2305 * Since: Added in version 3.0. 2306 * 2307 * Ingroup: window 2308 */ 2309 void glfwDefaultWindowHints(); 2310 2311 /** Sets the specified window hint to the desired value. 2312 * 2313 * This function sets hints for the next call to @ref glfwCreateWindow. The 2314 * hints, once set, retain their values until changed by a call to this 2315 * function or @ref glfwDefaultWindowHints, or until the library is terminated. 2316 * 2317 * Only integer value hints can be set with this function. String value hints 2318 * are set with @ref glfwWindowHintString. 2319 * 2320 * This function does not check whether the specified hint values are valid. 2321 * If you set hints to invalid values this will instead be reported by the next 2322 * call to @ref glfwCreateWindow. 2323 * 2324 * Some hints are platform specific. These may be set on any platform but they 2325 * will only affect their specific platform. Other platforms will ignore them. 2326 * Setting these hints requires no platform specific headers or functions. 2327 * 2328 * Params: 2329 * hint = The [window hint](@ref window_hints) to set. 2330 * value = The new value of the window hint. 2331 * 2332 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2333 * GLFW_INVALID_ENUM. 2334 * 2335 * Thread_Safety: This function must only be called from the main thread. 2336 * 2337 * @sa @ref window_hints 2338 * @sa @ref glfwWindowHintString 2339 * @sa @ref glfwDefaultWindowHints 2340 * 2341 * Since: Added in version 3.0. Replaces `glfwOpenWindowHint`. 2342 * 2343 * Ingroup: window 2344 */ 2345 void glfwWindowHint(int hint, int value); 2346 2347 /** Sets the specified window hint to the desired value. 2348 * 2349 * This function sets hints for the next call to @ref glfwCreateWindow. The 2350 * hints, once set, retain their values until changed by a call to this 2351 * function or @ref glfwDefaultWindowHints, or until the library is terminated. 2352 * 2353 * Only string type hints can be set with this function. Integer value hints 2354 * are set with @ref glfwWindowHint. 2355 * 2356 * This function does not check whether the specified hint values are valid. 2357 * If you set hints to invalid values this will instead be reported by the next 2358 * call to @ref glfwCreateWindow. 2359 * 2360 * Some hints are platform specific. These may be set on any platform but they 2361 * will only affect their specific platform. Other platforms will ignore them. 2362 * Setting these hints requires no platform specific headers or functions. 2363 * 2364 * Params: 2365 * hint = The [window hint](@ref window_hints) to set. 2366 * value = The new value of the window hint. 2367 * 2368 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2369 * GLFW_INVALID_ENUM. 2370 * 2371 * Pointer_lifetime: The specified string is copied before this function 2372 * returns. 2373 * 2374 * Thread_Safety: This function must only be called from the main thread. 2375 * 2376 * @sa @ref window_hints 2377 * @sa @ref glfwWindowHint 2378 * @sa @ref glfwDefaultWindowHints 2379 * 2380 * Since: Added in version 3.3. 2381 * 2382 * Ingroup: window 2383 */ 2384 void glfwWindowHintString(int hint, const(char)* value); 2385 2386 /** Creates a window and its associated context. 2387 * 2388 * This function creates a window and its associated OpenGL or OpenGL ES 2389 * context. Most of the options controlling how the window and its context 2390 * should be created are specified with [window hints](@ref window_hints). 2391 * 2392 * Successful creation does not change which context is current. Before you 2393 * can use the newly created context, you need to 2394 * [make it current](@ref context_current). For information about the `share` 2395 * parameter, see @ref context_sharing. 2396 * 2397 * The created window, framebuffer and context may differ from what you 2398 * requested, as not all parameters and hints are 2399 * [hard constraints](@ref window_hints_hard). This includes the size of the 2400 * window, especially for full screen windows. To query the actual attributes 2401 * of the created window, framebuffer and context, see @ref 2402 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. 2403 * 2404 * To create a full screen window, you need to specify the monitor the window 2405 * will cover. If no monitor is specified, the window will be windowed mode. 2406 * Unless you have a way for the user to choose a specific monitor, it is 2407 * recommended that you pick the primary monitor. For more information on how 2408 * to query connected monitors, see @ref monitor_monitors. 2409 * 2410 * For full screen windows, the specified size becomes the resolution of the 2411 * window's _desired video mode_. As long as a full screen window is not 2412 * iconified, the supported video mode most closely matching the desired video 2413 * mode is set for the specified monitor. For more information about full 2414 * screen windows, including the creation of so called _windowed full screen_ 2415 * or _borderless full screen_ windows, see @ref window_windowed_full_screen. 2416 * 2417 * Once you have created the window, you can switch it between windowed and 2418 * full screen mode with @ref glfwSetWindowMonitor. This will not affect its 2419 * OpenGL or OpenGL ES context. 2420 * 2421 * By default, newly created windows use the placement recommended by the 2422 * window system. To create the window at a specific position, make it 2423 * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window 2424 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) 2425 * it. 2426 * 2427 * As long as at least one full screen window is not iconified, the screensaver 2428 * is prohibited from starting. 2429 * 2430 * Window systems put limits on window sizes. Very large or very small window 2431 * dimensions may be overridden by the window system on creation. Check the 2432 * actual [size](@ref window_size) after creation. 2433 * 2434 * The [swap interval](@ref buffer_swap) is not set during window creation and 2435 * the initial value may vary depending on driver settings and defaults. 2436 * 2437 * Params: 2438 * width = The desired width, in screen coordinates, of the window. 2439 * This must be greater than zero. 2440 * height = The desired height, in screen coordinates, of the window. 2441 * This must be greater than zero. 2442 * title = The initial, UTF-8 encoded window title. 2443 * monitor = The monitor to use for full screen mode, or `null` for 2444 * windowed mode. 2445 * share = The window whose context to share resources with, or `null` 2446 * to not share resources. 2447 * Returns: The handle of the created window, or `null` if an 2448 * [error](@ref error_handling) occurred. 2449 * 2450 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 2451 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref 2452 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref 2453 * GLFW_PLATFORM_ERROR. 2454 * 2455 * @remark @win32 Window creation will fail if the Microsoft GDI software 2456 * OpenGL implementation is the only one available. 2457 * 2458 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it 2459 * will be set as the initial icon for the window. If no such icon is present, 2460 * the `IDI_APPLICATION` icon will be used instead. To set a different icon, 2461 * see @ref glfwSetWindowIcon. 2462 * 2463 * @remark @win32 The context to share resources with must not be current on 2464 * any other thread. 2465 * 2466 * @remark @macos The OS only supports forward-compatible core profile contexts 2467 * for OpenGL versions 3.2 and later. Before creating an OpenGL context of 2468 * version 3.2 or later you must set the 2469 * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and 2470 * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly. 2471 * OpenGL 3.0 and 3.1 contexts are not supported at all on macOS. 2472 * 2473 * @remark @macos The GLFW window has no icon, as it is not a document 2474 * window, but the dock icon will be the same as the application bundle's icon. 2475 * For more information on bundles, see the 2476 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) 2477 * in the Mac Developer Library. 2478 * 2479 * @remark @macos The first time a window is created the menu bar is created. 2480 * If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu 2481 * bar. Otherwise a minimal menu bar is created manually with common commands 2482 * like Hide, Quit and About. The About entry opens a minimal about dialog 2483 * with information from the application's bundle. Menu bar creation can be 2484 * disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint. 2485 * 2486 * @remark @macos On OS X 10.10 and later the window frame will not be rendered 2487 * at full resolution on Retina displays unless the 2488 * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) 2489 * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the 2490 * application bundle's `Info.plist`. For more information, see 2491 * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html) 2492 * in the Mac Developer Library. The GLFW test and example programs use 2493 * a custom `Info.plist` template for this, which can be found as 2494 * `CMake/MacOSXBundleInfo.plist.in` in the source tree. 2495 * 2496 * @remark @macos When activating frame autosaving with 2497 * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified 2498 * window size and position may be overridden by previously saved values. 2499 * 2500 * @remark @x11 Some window managers will not respect the placement of 2501 * initially hidden windows. 2502 * 2503 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for 2504 * a window to reach its requested state. This means you may not be able to 2505 * query the final size, position or other attributes directly after window 2506 * creation. 2507 * 2508 * @remark @x11 The class part of the `WM_CLASS` window property will by 2509 * default be set to the window title passed to this function. The instance 2510 * part will use the contents of the `RESOURCE_NAME` environment variable, if 2511 * present and not empty, or fall back to the window title. Set the 2512 * [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and 2513 * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to 2514 * override this. 2515 * 2516 * @remark @wayland Compositors should implement the xdg-decoration protocol 2517 * for GLFW to decorate the window properly. If this protocol isn't 2518 * supported, or if the compositor prefers client-side decorations, a very 2519 * simple fallback frame will be drawn using the wp_viewporter protocol. A 2520 * compositor can still emit close, maximize or fullscreen events, using for 2521 * instance a keybind mechanism. If neither of these protocols is supported, 2522 * the window won't be decorated. 2523 * 2524 * @remark @wayland A full screen window will not attempt to change the mode, 2525 * no matter what the requested size or refresh rate. 2526 * 2527 * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol 2528 * to be implemented in the user's compositor. 2529 * 2530 * Thread_Safety: This function must only be called from the main thread. 2531 * 2532 * @sa @ref window_creation 2533 * @sa @ref glfwDestroyWindow 2534 * 2535 * Since: Added in version 3.0. Replaces `glfwOpenWindow`. 2536 * 2537 * Ingroup: window 2538 */ 2539 GLFWwindow* glfwCreateWindow(int width, int height, const(char)* title, GLFWmonitor* monitor, GLFWwindow* share); 2540 2541 /** Destroys the specified window and its context. 2542 * 2543 * This function destroys the specified window and its context. On calling 2544 * this function, no further callbacks will be called for that window. 2545 * 2546 * If the context of the specified window is current on the main thread, it is 2547 * detached before being destroyed. 2548 * 2549 * Params: 2550 * window = The window to destroy. 2551 * 2552 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2553 * GLFW_PLATFORM_ERROR. 2554 * 2555 * @note The context of the specified window must not be current on any other 2556 * thread when this function is called. 2557 * 2558 * @reentrancy This function must not be called from a callback. 2559 * 2560 * Thread_Safety: This function must only be called from the main thread. 2561 * 2562 * @sa @ref window_creation 2563 * @sa @ref glfwCreateWindow 2564 * 2565 * Since: Added in version 3.0. Replaces `glfwCloseWindow`. 2566 * 2567 * Ingroup: window 2568 */ 2569 void glfwDestroyWindow(GLFWwindow* window); 2570 2571 /** Checks the close flag of the specified window. 2572 * 2573 * This function returns the value of the close flag of the specified window. 2574 * 2575 * Params: 2576 * window = The window to query. 2577 * Returns: The value of the close flag. 2578 * 2579 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 2580 * 2581 * Thread_Safety: This function may be called from any thread. Access is not 2582 * synchronized. 2583 * 2584 * @sa @ref window_close 2585 * 2586 * Since: Added in version 3.0. 2587 * 2588 * Ingroup: window 2589 */ 2590 int glfwWindowShouldClose(GLFWwindow* window); 2591 2592 /** Sets the close flag of the specified window. 2593 * 2594 * This function sets the value of the close flag of the specified window. 2595 * This can be used to override the user's attempt to close the window, or 2596 * to signal that it should be closed. 2597 * 2598 * Params: 2599 * window = The window whose flag to change. 2600 * value = The new value. 2601 * 2602 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 2603 * 2604 * Thread_Safety: This function may be called from any thread. Access is not 2605 * synchronized. 2606 * 2607 * @sa @ref window_close 2608 * 2609 * Since: Added in version 3.0. 2610 * 2611 * Ingroup: window 2612 */ 2613 void glfwSetWindowShouldClose(GLFWwindow* window, int value); 2614 2615 /** Sets the title of the specified window. 2616 * 2617 * This function sets the window title, encoded as UTF-8, of the specified 2618 * window. 2619 * 2620 * Params: 2621 * window = The window whose title to change. 2622 * title = The UTF-8 encoded window title. 2623 * 2624 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2625 * GLFW_PLATFORM_ERROR. 2626 * 2627 * @remark @macos The window title will not be updated until the next time you 2628 * process events. 2629 * 2630 * Thread_Safety: This function must only be called from the main thread. 2631 * 2632 * @sa @ref window_title 2633 * 2634 * Since: Added in version 1.0. 2635 * @glfw3 Added window handle parameter. 2636 * 2637 * Ingroup: window 2638 */ 2639 void glfwSetWindowTitle(GLFWwindow* window, const(char)* title); 2640 2641 /** Sets the icon for the specified window. 2642 * 2643 * This function sets the icon of the specified window. If passed an array of 2644 * candidate images, those of or closest to the sizes desired by the system are 2645 * selected. If no images are specified, the window reverts to its default 2646 * icon. 2647 * 2648 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight 2649 * bits per channel with the red channel first. They are arranged canonically 2650 * as packed sequential rows, starting from the top-left corner. 2651 * 2652 * The desired image sizes varies depending on platform and system settings. 2653 * The selected images will be rescaled as needed. Good sizes include 16x16, 2654 * 32x32 and 48x48. 2655 * 2656 * Params: 2657 * window = The window whose icon to set. 2658 * count = The number of images in the specified array, or zero to 2659 * revert to the default window icon. 2660 * images = The images to create the icon from. This is ignored if 2661 * count is zero. 2662 * 2663 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2664 * GLFW_PLATFORM_ERROR. 2665 * 2666 * Pointer_lifetime: The specified image data is copied before this function 2667 * returns. 2668 * 2669 * @remark @macos The GLFW window has no icon, as it is not a document 2670 * window, so this function does nothing. The dock icon will be the same as 2671 * the application bundle's icon. For more information on bundles, see the 2672 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) 2673 * in the Mac Developer Library. 2674 * 2675 * @remark @wayland There is no existing protocol to change an icon, the 2676 * window will thus inherit the one defined in the application's desktop file. 2677 * This function always emits @ref GLFW_PLATFORM_ERROR. 2678 * 2679 * Thread_Safety: This function must only be called from the main thread. 2680 * 2681 * @sa @ref window_icon 2682 * 2683 * Since: Added in version 3.2. 2684 * 2685 * Ingroup: window 2686 */ 2687 void glfwSetWindowIcon(GLFWwindow* window, int count, const(GLFWimage)* images); 2688 2689 /** Retrieves the position of the content area of the specified window. 2690 * 2691 * This function retrieves the position, in screen coordinates, of the 2692 * upper-left corner of the content area of the specified window. 2693 * 2694 * Any or all of the position arguments may be `null`. If an error occurs, all 2695 * non-`null` position arguments will be set to zero. 2696 * 2697 * Params: 2698 * window = The window to query. 2699 * xpos = Where to store the x-coordinate of the upper-left corner of 2700 * the content area, or `null`. 2701 * ypos = Where to store the y-coordinate of the upper-left corner of 2702 * the content area, or `null`. 2703 * 2704 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2705 * GLFW_PLATFORM_ERROR. 2706 * 2707 * @remark @wayland There is no way for an application to retrieve the global 2708 * position of its windows, this function will always emit @ref 2709 * GLFW_PLATFORM_ERROR. 2710 * 2711 * Thread_Safety: This function must only be called from the main thread. 2712 * 2713 * @sa @ref window_pos 2714 * @sa @ref glfwSetWindowPos 2715 * 2716 * Since: Added in version 3.0. 2717 * 2718 * Ingroup: window 2719 */ 2720 void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); 2721 2722 /** Sets the position of the content area of the specified window. 2723 * 2724 * This function sets the position, in screen coordinates, of the upper-left 2725 * corner of the content area of the specified windowed mode window. If the 2726 * window is a full screen window, this function does nothing. 2727 * 2728 * __Do not use this function__ to move an already visible window unless you 2729 * have very good reasons for doing so, as it will confuse and annoy the user. 2730 * 2731 * The window manager may put limits on what positions are allowed. GLFW 2732 * cannot and should not override these limits. 2733 * 2734 * Params: 2735 * window = The window to query. 2736 * xpos = The x-coordinate of the upper-left corner of the content area. 2737 * ypos = The y-coordinate of the upper-left corner of the content area. 2738 * 2739 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2740 * GLFW_PLATFORM_ERROR. 2741 * 2742 * @remark @wayland There is no way for an application to set the global 2743 * position of its windows, this function will always emit @ref 2744 * GLFW_PLATFORM_ERROR. 2745 * 2746 * Thread_Safety: This function must only be called from the main thread. 2747 * 2748 * @sa @ref window_pos 2749 * @sa @ref glfwGetWindowPos 2750 * 2751 * Since: Added in version 1.0. 2752 * @glfw3 Added window handle parameter. 2753 * 2754 * Ingroup: window 2755 */ 2756 void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); 2757 2758 /** Retrieves the size of the content area of the specified window. 2759 * 2760 * This function retrieves the size, in screen coordinates, of the content area 2761 * of the specified window. If you wish to retrieve the size of the 2762 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. 2763 * 2764 * Any or all of the size arguments may be `null`. If an error occurs, all 2765 * non-`null` size arguments will be set to zero. 2766 * 2767 * Params: 2768 * window = The window whose size to retrieve. 2769 * width = Where to store the width, in screen coordinates, of the 2770 * content area, or `null`. 2771 * height = Where to store the height, in screen coordinates, of the 2772 * content area, or `null`. 2773 * 2774 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2775 * GLFW_PLATFORM_ERROR. 2776 * 2777 * Thread_Safety: This function must only be called from the main thread. 2778 * 2779 * @sa @ref window_size 2780 * @sa @ref glfwSetWindowSize 2781 * 2782 * Since: Added in version 1.0. 2783 * @glfw3 Added window handle parameter. 2784 * 2785 * Ingroup: window 2786 */ 2787 void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); 2788 2789 /** Sets the size limits of the specified window. 2790 * 2791 * This function sets the size limits of the content area of the specified 2792 * window. If the window is full screen, the size limits only take effect 2793 * once it is made windowed. If the window is not resizable, this function 2794 * does nothing. 2795 * 2796 * The size limits are applied immediately to a windowed mode window and may 2797 * cause it to be resized. 2798 * 2799 * The maximum dimensions must be greater than or equal to the minimum 2800 * dimensions and all must be greater than or equal to zero. 2801 * 2802 * Params: 2803 * window = The window to set limits for. 2804 * minwidth = The minimum width, in screen coordinates, of the content 2805 * area, or `GLFW_DONT_CARE`. 2806 * minheight = The minimum height, in screen coordinates, of the 2807 * content area, or `GLFW_DONT_CARE`. 2808 * maxwidth = The maximum width, in screen coordinates, of the content 2809 * area, or `GLFW_DONT_CARE`. 2810 * maxheight = The maximum height, in screen coordinates, of the 2811 * content area, or `GLFW_DONT_CARE`. 2812 * 2813 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 2814 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. 2815 * 2816 * @remark If you set size limits and an aspect ratio that conflict, the 2817 * results are undefined. 2818 * 2819 * @remark @wayland The size limits will not be applied until the window is 2820 * actually resized, either by the user or by the compositor. 2821 * 2822 * Thread_Safety: This function must only be called from the main thread. 2823 * 2824 * @sa @ref window_sizelimits 2825 * @sa @ref glfwSetWindowAspectRatio 2826 * 2827 * Since: Added in version 3.2. 2828 * 2829 * Ingroup: window 2830 */ 2831 void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); 2832 2833 /** Sets the aspect ratio of the specified window. 2834 * 2835 * This function sets the required aspect ratio of the content area of the 2836 * specified window. If the window is full screen, the aspect ratio only takes 2837 * effect once it is made windowed. If the window is not resizable, this 2838 * function does nothing. 2839 * 2840 * The aspect ratio is specified as a numerator and a denominator and both 2841 * values must be greater than zero. For example, the common 16:9 aspect ratio 2842 * is specified as 16 and 9, respectively. 2843 * 2844 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect 2845 * ratio limit is disabled. 2846 * 2847 * The aspect ratio is applied immediately to a windowed mode window and may 2848 * cause it to be resized. 2849 * 2850 * Params: 2851 * window = The window to set limits for. 2852 * numer = The numerator of the desired aspect ratio, or 2853 * `GLFW_DONT_CARE`. 2854 * denom = The denominator of the desired aspect ratio, or 2855 * `GLFW_DONT_CARE`. 2856 * 2857 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 2858 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. 2859 * 2860 * @remark If you set size limits and an aspect ratio that conflict, the 2861 * results are undefined. 2862 * 2863 * @remark @wayland The aspect ratio will not be applied until the window is 2864 * actually resized, either by the user or by the compositor. 2865 * 2866 * Thread_Safety: This function must only be called from the main thread. 2867 * 2868 * @sa @ref window_sizelimits 2869 * @sa @ref glfwSetWindowSizeLimits 2870 * 2871 * Since: Added in version 3.2. 2872 * 2873 * Ingroup: window 2874 */ 2875 void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); 2876 2877 /** Sets the size of the content area of the specified window. 2878 * 2879 * This function sets the size, in screen coordinates, of the content area of 2880 * the specified window. 2881 * 2882 * For full screen windows, this function updates the resolution of its desired 2883 * video mode and switches to the video mode closest to it, without affecting 2884 * the window's context. As the context is unaffected, the bit depths of the 2885 * framebuffer remain unchanged. 2886 * 2887 * If you wish to update the refresh rate of the desired video mode in addition 2888 * to its resolution, see @ref glfwSetWindowMonitor. 2889 * 2890 * The window manager may put limits on what sizes are allowed. GLFW cannot 2891 * and should not override these limits. 2892 * 2893 * Params: 2894 * window = The window to resize. 2895 * width = The desired width, in screen coordinates, of the window 2896 * content area. 2897 * height = The desired height, in screen coordinates, of the window 2898 * content area. 2899 * 2900 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2901 * GLFW_PLATFORM_ERROR. 2902 * 2903 * @remark @wayland A full screen window will not attempt to change the mode, 2904 * no matter what the requested size. 2905 * 2906 * Thread_Safety: This function must only be called from the main thread. 2907 * 2908 * @sa @ref window_size 2909 * @sa @ref glfwGetWindowSize 2910 * @sa @ref glfwSetWindowMonitor 2911 * 2912 * Since: Added in version 1.0. 2913 * @glfw3 Added window handle parameter. 2914 * 2915 * Ingroup: window 2916 */ 2917 void glfwSetWindowSize(GLFWwindow* window, int width, int height); 2918 2919 /** Retrieves the size of the framebuffer of the specified window. 2920 * 2921 * This function retrieves the size, in pixels, of the framebuffer of the 2922 * specified window. If you wish to retrieve the size of the window in screen 2923 * coordinates, see @ref glfwGetWindowSize. 2924 * 2925 * Any or all of the size arguments may be `null`. If an error occurs, all 2926 * non-`null` size arguments will be set to zero. 2927 * 2928 * Params: 2929 * window = The window whose framebuffer to query. 2930 * width = Where to store the width, in pixels, of the framebuffer, 2931 * or `null`. 2932 * height = Where to store the height, in pixels, of the framebuffer, 2933 * or `null`. 2934 * 2935 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2936 * GLFW_PLATFORM_ERROR. 2937 * 2938 * Thread_Safety: This function must only be called from the main thread. 2939 * 2940 * @sa @ref window_fbsize 2941 * @sa @ref glfwSetFramebufferSizeCallback 2942 * 2943 * Since: Added in version 3.0. 2944 * 2945 * Ingroup: window 2946 */ 2947 void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); 2948 2949 /** Retrieves the size of the frame of the window. 2950 * 2951 * This function retrieves the size, in screen coordinates, of each edge of the 2952 * frame of the specified window. This size includes the title bar, if the 2953 * window has one. The size of the frame may vary depending on the 2954 * [window-related hints](@ref window_hints_wnd) used to create it. 2955 * 2956 * Because this function retrieves the size of each window frame edge and not 2957 * the offset along a particular coordinate axis, the retrieved values will 2958 * always be zero or positive. 2959 * 2960 * Any or all of the size arguments may be `null`. If an error occurs, all 2961 * non-`null` size arguments will be set to zero. 2962 * 2963 * Params: 2964 * window = The window whose frame size to query. 2965 * left = Where to store the size, in screen coordinates, of the left 2966 * edge of the window frame, or `null`. 2967 * top = Where to store the size, in screen coordinates, of the top 2968 * edge of the window frame, or `null`. 2969 * right = Where to store the size, in screen coordinates, of the 2970 * right edge of the window frame, or `null`. 2971 * bottom = Where to store the size, in screen coordinates, of the 2972 * bottom edge of the window frame, or `null`. 2973 * 2974 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 2975 * GLFW_PLATFORM_ERROR. 2976 * 2977 * Thread_Safety: This function must only be called from the main thread. 2978 * 2979 * @sa @ref window_size 2980 * 2981 * Since: Added in version 3.1. 2982 * 2983 * Ingroup: window 2984 */ 2985 void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); 2986 2987 /** Retrieves the content scale for the specified window. 2988 * 2989 * This function retrieves the content scale for the specified window. The 2990 * content scale is the ratio between the current DPI and the platform's 2991 * default DPI. This is especially important for text and any UI elements. If 2992 * the pixel dimensions of your UI scaled by this look appropriate on your 2993 * machine then it should appear at a reasonable size on other machines 2994 * regardless of their DPI and scaling settings. This relies on the system DPI 2995 * and scaling settings being somewhat correct. 2996 * 2997 * On systems where each monitors can have its own content scale, the window 2998 * content scale will depend on which monitor the system considers the window 2999 * to be on. 3000 * 3001 * Params: 3002 * window = The window to query. 3003 * xscale = Where to store the x-axis content scale, or `null`. 3004 * yscale = Where to store the y-axis content scale, or `null`. 3005 * 3006 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3007 * GLFW_PLATFORM_ERROR. 3008 * 3009 * Thread_Safety: This function must only be called from the main thread. 3010 * 3011 * @sa @ref window_scale 3012 * @sa @ref glfwSetWindowContentScaleCallback 3013 * @sa @ref glfwGetMonitorContentScale 3014 * 3015 * Since: Added in version 3.3. 3016 * 3017 * Ingroup: window 3018 */ 3019 void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); 3020 3021 /** Returns the opacity of the whole window. 3022 * 3023 * This function returns the opacity of the window, including any decorations. 3024 * 3025 * The opacity (or alpha) value is a positive finite number between zero and 3026 * one, where zero is fully transparent and one is fully opaque. If the system 3027 * does not support whole window transparency, this function always returns one. 3028 * 3029 * The initial opacity value for newly created windows is one. 3030 * 3031 * Params: 3032 * window = The window to query. 3033 * Returns: The opacity value of the specified window. 3034 * 3035 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3036 * GLFW_PLATFORM_ERROR. 3037 * 3038 * Thread_Safety: This function must only be called from the main thread. 3039 * 3040 * @sa @ref window_transparency 3041 * @sa @ref glfwSetWindowOpacity 3042 * 3043 * Since: Added in version 3.3. 3044 * 3045 * Ingroup: window 3046 */ 3047 float glfwGetWindowOpacity(GLFWwindow* window); 3048 3049 /** Sets the opacity of the whole window. 3050 * 3051 * This function sets the opacity of the window, including any decorations. 3052 * 3053 * The opacity (or alpha) value is a positive finite number between zero and 3054 * one, where zero is fully transparent and one is fully opaque. 3055 * 3056 * The initial opacity value for newly created windows is one. 3057 * 3058 * A window created with framebuffer transparency may not use whole window 3059 * transparency. The results of doing this are undefined. 3060 * 3061 * Params: 3062 * window = The window to set the opacity for. 3063 * opacity = The desired opacity of the specified window. 3064 * 3065 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3066 * GLFW_PLATFORM_ERROR. 3067 * 3068 * Thread_Safety: This function must only be called from the main thread. 3069 * 3070 * @sa @ref window_transparency 3071 * @sa @ref glfwGetWindowOpacity 3072 * 3073 * Since: Added in version 3.3. 3074 * 3075 * Ingroup: window 3076 */ 3077 void glfwSetWindowOpacity(GLFWwindow* window, float opacity); 3078 3079 /** Iconifies the specified window. 3080 * 3081 * This function iconifies (minimizes) the specified window if it was 3082 * previously restored. If the window is already iconified, this function does 3083 * nothing. 3084 * 3085 * If the specified window is a full screen window, the original monitor 3086 * resolution is restored until the window is restored. 3087 * 3088 * Params: 3089 * window = The window to iconify. 3090 * 3091 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3092 * GLFW_PLATFORM_ERROR. 3093 * 3094 * @remark @wayland There is no concept of iconification in wl_shell, this 3095 * function will emit @ref GLFW_PLATFORM_ERROR when using this deprecated 3096 * protocol. 3097 * 3098 * Thread_Safety: This function must only be called from the main thread. 3099 * 3100 * @sa @ref window_iconify 3101 * @sa @ref glfwRestoreWindow 3102 * @sa @ref glfwMaximizeWindow 3103 * 3104 * Since: Added in version 2.1. 3105 * @glfw3 Added window handle parameter. 3106 * 3107 * Ingroup: window 3108 */ 3109 void glfwIconifyWindow(GLFWwindow* window); 3110 3111 /** Restores the specified window. 3112 * 3113 * This function restores the specified window if it was previously iconified 3114 * (minimized) or maximized. If the window is already restored, this function 3115 * does nothing. 3116 * 3117 * If the specified window is a full screen window, the resolution chosen for 3118 * the window is restored on the selected monitor. 3119 * 3120 * Params: 3121 * window = The window to restore. 3122 * 3123 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3124 * GLFW_PLATFORM_ERROR. 3125 * 3126 * Thread_Safety: This function must only be called from the main thread. 3127 * 3128 * @sa @ref window_iconify 3129 * @sa @ref glfwIconifyWindow 3130 * @sa @ref glfwMaximizeWindow 3131 * 3132 * Since: Added in version 2.1. 3133 * @glfw3 Added window handle parameter. 3134 * 3135 * Ingroup: window 3136 */ 3137 void glfwRestoreWindow(GLFWwindow* window); 3138 3139 /** Maximizes the specified window. 3140 * 3141 * This function maximizes the specified window if it was previously not 3142 * maximized. If the window is already maximized, this function does nothing. 3143 * 3144 * If the specified window is a full screen window, this function does nothing. 3145 * 3146 * Params: 3147 * window = The window to maximize. 3148 * 3149 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3150 * GLFW_PLATFORM_ERROR. 3151 * 3152 * @par Thread Safety 3153 * This function may only be called from the main thread. 3154 * 3155 * @sa @ref window_iconify 3156 * @sa @ref glfwIconifyWindow 3157 * @sa @ref glfwRestoreWindow 3158 * 3159 * Since: Added in GLFW 3.2. 3160 * 3161 * Ingroup: window 3162 */ 3163 void glfwMaximizeWindow(GLFWwindow* window); 3164 3165 /** Makes the specified window visible. 3166 * 3167 * This function makes the specified window visible if it was previously 3168 * hidden. If the window is already visible or is in full screen mode, this 3169 * function does nothing. 3170 * 3171 * By default, windowed mode windows are focused when shown 3172 * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint 3173 * to change this behavior for all newly created windows, or change the 3174 * behavior for an existing window with @ref glfwSetWindowAttrib. 3175 * 3176 * Params: 3177 * window = The window to make visible. 3178 * 3179 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3180 * GLFW_PLATFORM_ERROR. 3181 * 3182 * Thread_Safety: This function must only be called from the main thread. 3183 * 3184 * @sa @ref window_hide 3185 * @sa @ref glfwHideWindow 3186 * 3187 * Since: Added in version 3.0. 3188 * 3189 * Ingroup: window 3190 */ 3191 void glfwShowWindow(GLFWwindow* window); 3192 3193 /** Hides the specified window. 3194 * 3195 * This function hides the specified window if it was previously visible. If 3196 * the window is already hidden or is in full screen mode, this function does 3197 * nothing. 3198 * 3199 * Params: 3200 * window = The window to hide. 3201 * 3202 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3203 * GLFW_PLATFORM_ERROR. 3204 * 3205 * Thread_Safety: This function must only be called from the main thread. 3206 * 3207 * @sa @ref window_hide 3208 * @sa @ref glfwShowWindow 3209 * 3210 * Since: Added in version 3.0. 3211 * 3212 * Ingroup: window 3213 */ 3214 void glfwHideWindow(GLFWwindow* window); 3215 3216 /** Brings the specified window to front and sets input focus. 3217 * 3218 * This function brings the specified window to front and sets input focus. 3219 * The window should already be visible and not iconified. 3220 * 3221 * By default, both windowed and full screen mode windows are focused when 3222 * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to 3223 * disable this behavior. 3224 * 3225 * Also by default, windowed mode windows are focused when shown 3226 * with @ref glfwShowWindow. Set the 3227 * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior. 3228 * 3229 * __Do not use this function__ to steal focus from other applications unless 3230 * you are certain that is what the user wants. Focus stealing can be 3231 * extremely disruptive. 3232 * 3233 * For a less disruptive way of getting the user's attention, see 3234 * [attention requests](@ref window_attention). 3235 * 3236 * Params: 3237 * window = The window to give input focus. 3238 * 3239 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3240 * GLFW_PLATFORM_ERROR. 3241 * 3242 * @remark @wayland It is not possible for an application to bring its windows 3243 * to front, this function will always emit @ref GLFW_PLATFORM_ERROR. 3244 * 3245 * Thread_Safety: This function must only be called from the main thread. 3246 * 3247 * @sa @ref window_focus 3248 * @sa @ref window_attention 3249 * 3250 * Since: Added in version 3.2. 3251 * 3252 * Ingroup: window 3253 */ 3254 void glfwFocusWindow(GLFWwindow* window); 3255 3256 /** Requests user attention to the specified window. 3257 * 3258 * This function requests user attention to the specified window. On 3259 * platforms where this is not supported, attention is requested to the 3260 * application as a whole. 3261 * 3262 * Once the user has given attention, usually by focusing the window or 3263 * application, the system will end the request automatically. 3264 * 3265 * Params: 3266 * window = The window to request attention to. 3267 * 3268 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3269 * GLFW_PLATFORM_ERROR. 3270 * 3271 * @remark @macos Attention is requested to the application as a whole, not the 3272 * specific window. 3273 * 3274 * Thread_Safety: This function must only be called from the main thread. 3275 * 3276 * @sa @ref window_attention 3277 * 3278 * Since: Added in version 3.3. 3279 * 3280 * Ingroup: window 3281 */ 3282 void glfwRequestWindowAttention(GLFWwindow* window); 3283 3284 /** Returns the monitor that the window uses for full screen mode. 3285 * 3286 * This function returns the handle of the monitor that the specified window is 3287 * in full screen on. 3288 * 3289 * Params: 3290 * window = The window to query. 3291 * Returns: The monitor, or `null` if the window is in windowed mode or an 3292 * [error](@ref error_handling) occurred. 3293 * 3294 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3295 * 3296 * Thread_Safety: This function must only be called from the main thread. 3297 * 3298 * @sa @ref window_monitor 3299 * @sa @ref glfwSetWindowMonitor 3300 * 3301 * Since: Added in version 3.0. 3302 * 3303 * Ingroup: window 3304 */ 3305 GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); 3306 3307 /** Sets the mode, monitor, video mode and placement of a window. 3308 * 3309 * This function sets the monitor that the window uses for full screen mode or, 3310 * if the monitor is `null`, makes it windowed mode. 3311 * 3312 * When setting a monitor, this function updates the width, height and refresh 3313 * rate of the desired video mode and switches to the video mode closest to it. 3314 * The window position is ignored when setting a monitor. 3315 * 3316 * When the monitor is `null`, the position, width and height are used to 3317 * place the window content area. The refresh rate is ignored when no monitor 3318 * is specified. 3319 * 3320 * If you only wish to update the resolution of a full screen window or the 3321 * size of a windowed mode window, see @ref glfwSetWindowSize. 3322 * 3323 * When a window transitions from full screen to windowed mode, this function 3324 * restores any previous window settings such as whether it is decorated, 3325 * floating, resizable, has size or aspect ratio limits, etc. 3326 * 3327 * Params: 3328 * window = The window whose monitor, size or video mode to set. 3329 * monitor = The desired monitor, or `null` to set windowed mode. 3330 * xpos = The desired x-coordinate of the upper-left corner of the 3331 * content area. 3332 * ypos = The desired y-coordinate of the upper-left corner of the 3333 * content area. 3334 * width = The desired with, in screen coordinates, of the content 3335 * area or video mode. 3336 * height = The desired height, in screen coordinates, of the content 3337 * area or video mode. 3338 * refreshRate = The desired refresh rate, in Hz, of the video mode, 3339 * or `GLFW_DONT_CARE`. 3340 * 3341 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3342 * GLFW_PLATFORM_ERROR. 3343 * 3344 * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise 3345 * affected by any resizing or mode switching, although you may need to update 3346 * your viewport if the framebuffer size has changed. 3347 * 3348 * @remark @wayland The desired window position is ignored, as there is no way 3349 * for an application to set this property. 3350 * 3351 * @remark @wayland Setting the window to full screen will not attempt to 3352 * change the mode, no matter what the requested size or refresh rate. 3353 * 3354 * Thread_Safety: This function must only be called from the main thread. 3355 * 3356 * @sa @ref window_monitor 3357 * @sa @ref window_full_screen 3358 * @sa @ref glfwGetWindowMonitor 3359 * @sa @ref glfwSetWindowSize 3360 * 3361 * Since: Added in version 3.2. 3362 * 3363 * Ingroup: window 3364 */ 3365 void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); 3366 3367 /** Returns an attribute of the specified window. 3368 * 3369 * This function returns the value of an attribute of the specified window or 3370 * its OpenGL or OpenGL ES context. 3371 * 3372 * Params: 3373 * window = The window to query. 3374 * attrib = The [window attribute](@ref window_attribs) whose value to 3375 * return. 3376 * Returns: The value of the attribute, or zero if an 3377 * [error](@ref error_handling) occurred. 3378 * 3379 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 3380 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 3381 * 3382 * @remark Framebuffer related hints are not window attributes. See @ref 3383 * window_attribs_fb for more information. 3384 * 3385 * @remark Zero is a valid value for many window and context related 3386 * attributes so you cannot use a return value of zero as an indication of 3387 * errors. However, this function should not fail as long as it is passed 3388 * valid arguments and the library has been [initialized](@ref intro_init). 3389 * 3390 * Thread_Safety: This function must only be called from the main thread. 3391 * 3392 * @sa @ref window_attribs 3393 * @sa @ref glfwSetWindowAttrib 3394 * 3395 * Since: Added in version 3.0. Replaces `glfwGetWindowParam` and 3396 * `glfwGetGLVersion`. 3397 * 3398 * Ingroup: window 3399 */ 3400 int glfwGetWindowAttrib(GLFWwindow* window, int attrib); 3401 3402 /** Sets an attribute of the specified window. 3403 * 3404 * This function sets the value of an attribute of the specified window. 3405 * 3406 * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), 3407 * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), 3408 * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), 3409 * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and 3410 * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib). 3411 * 3412 * Some of these attributes are ignored for full screen windows. The new 3413 * value will take effect if the window is later made windowed. 3414 * 3415 * Some of these attributes are ignored for windowed mode windows. The new 3416 * value will take effect if the window is later made full screen. 3417 * 3418 * Params: 3419 * window = The window to set the attribute for. 3420 * attrib = A supported window attribute. 3421 * value = `GLFW_TRUE` or `GLFW_FALSE`. 3422 * 3423 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 3424 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. 3425 * 3426 * @remark Calling @ref glfwGetWindowAttrib will always return the latest 3427 * value, even if that value is ignored by the current mode of the window. 3428 * 3429 * Thread_Safety: This function must only be called from the main thread. 3430 * 3431 * @sa @ref window_attribs 3432 * @sa @ref glfwGetWindowAttrib 3433 * 3434 * Since: Added in version 3.3. 3435 * 3436 * Ingroup: window 3437 */ 3438 void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value); 3439 3440 /** Sets the user pointer of the specified window. 3441 * 3442 * This function sets the user-defined pointer of the specified window. The 3443 * current value is retained until the window is destroyed. The initial value 3444 * is `null`. 3445 * 3446 * Params: 3447 * window = The window whose pointer to set. 3448 * pointer = The new value. 3449 * 3450 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3451 * 3452 * Thread_Safety: This function may be called from any thread. Access is not 3453 * synchronized. 3454 * 3455 * @sa @ref window_userptr 3456 * @sa @ref glfwGetWindowUserPointer 3457 * 3458 * Since: Added in version 3.0. 3459 * 3460 * Ingroup: window 3461 */ 3462 void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); 3463 3464 /** Returns the user pointer of the specified window. 3465 * 3466 * This function returns the current value of the user-defined pointer of the 3467 * specified window. The initial value is `null`. 3468 * 3469 * Params: 3470 * window = The window whose pointer to return. 3471 * 3472 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3473 * 3474 * Thread_Safety: This function may be called from any thread. Access is not 3475 * synchronized. 3476 * 3477 * @sa @ref window_userptr 3478 * @sa @ref glfwSetWindowUserPointer 3479 * 3480 * Since: Added in version 3.0. 3481 * 3482 * Ingroup: window 3483 */ 3484 void* glfwGetWindowUserPointer(GLFWwindow* window); 3485 3486 /** Sets the position callback for the specified window. 3487 * 3488 * This function sets the position callback of the specified window, which is 3489 * called when the window is moved. The callback is provided with the 3490 * position, in screen coordinates, of the upper-left corner of the content 3491 * area of the window. 3492 * 3493 * Params: 3494 * window = The window whose callback to set. 3495 * callback = The new callback, or `null` to remove the currently set 3496 * callback. 3497 * Returns: The previously set callback, or `null` if no callback was set or the 3498 * library had not been [initialized](@ref intro_init). 3499 * 3500 * @callback_signature 3501 * ``` 3502 * void function_name(GLFWwindow* window, int xpos, int ypos) 3503 * ``` 3504 * For more information about the callback parameters, see the 3505 * [function pointer type](@ref GLFWwindowposfun). 3506 * 3507 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3508 * 3509 * @remark @wayland This callback will never be called, as there is no way for 3510 * an application to know its global position. 3511 * 3512 * Thread_Safety: This function must only be called from the main thread. 3513 * 3514 * @sa @ref window_pos 3515 * 3516 * Since: Added in version 3.0. 3517 * 3518 * Ingroup: window 3519 */ 3520 GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback); 3521 3522 /** Sets the size callback for the specified window. 3523 * 3524 * This function sets the size callback of the specified window, which is 3525 * called when the window is resized. The callback is provided with the size, 3526 * in screen coordinates, of the content area of the window. 3527 * 3528 * Params: 3529 * window = The window whose callback to set. 3530 * callback = The new callback, or `null` to remove the currently set 3531 * callback. 3532 * Returns: The previously set callback, or `null` if no callback was set or the 3533 * library had not been [initialized](@ref intro_init). 3534 * 3535 * @callback_signature 3536 * ``` 3537 * void function_name(GLFWwindow* window, int width, int height) 3538 * ``` 3539 * For more information about the callback parameters, see the 3540 * [function pointer type](@ref GLFWwindowsizefun). 3541 * 3542 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3543 * 3544 * Thread_Safety: This function must only be called from the main thread. 3545 * 3546 * @sa @ref window_size 3547 * 3548 * Since: Added in version 1.0. 3549 * @glfw3 Added window handle parameter and return value. 3550 * 3551 * Ingroup: window 3552 */ 3553 GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback); 3554 3555 /** Sets the close callback for the specified window. 3556 * 3557 * This function sets the close callback of the specified window, which is 3558 * called when the user attempts to close the window, for example by clicking 3559 * the close widget in the title bar. 3560 * 3561 * The close flag is set before this callback is called, but you can modify it 3562 * at any time with @ref glfwSetWindowShouldClose. 3563 * 3564 * The close callback is not triggered by @ref glfwDestroyWindow. 3565 * 3566 * Params: 3567 * window = The window whose callback to set. 3568 * callback = The new callback, or `null` to remove the currently set 3569 * callback. 3570 * Returns: The previously set callback, or `null` if no callback was set or the 3571 * library had not been [initialized](@ref intro_init). 3572 * 3573 * @callback_signature 3574 * ``` 3575 * void function_name(GLFWwindow* window) 3576 * ``` 3577 * For more information about the callback parameters, see the 3578 * [function pointer type](@ref GLFWwindowclosefun). 3579 * 3580 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3581 * 3582 * @remark @macos Selecting Quit from the application menu will trigger the 3583 * close callback for all windows. 3584 * 3585 * Thread_Safety: This function must only be called from the main thread. 3586 * 3587 * @sa @ref window_close 3588 * 3589 * Since: Added in version 2.5. 3590 * @glfw3 Added window handle parameter and return value. 3591 * 3592 * Ingroup: window 3593 */ 3594 GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback); 3595 3596 /** Sets the refresh callback for the specified window. 3597 * 3598 * This function sets the refresh callback of the specified window, which is 3599 * called when the content area of the window needs to be redrawn, for example 3600 * if the window has been exposed after having been covered by another window. 3601 * 3602 * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where 3603 * the window contents are saved off-screen, this callback may be called only 3604 * very infrequently or never at all. 3605 * 3606 * Params: 3607 * window = The window whose callback to set. 3608 * callback = The new callback, or `null` to remove the currently set 3609 * callback. 3610 * Returns: The previously set callback, or `null` if no callback was set or the 3611 * library had not been [initialized](@ref intro_init). 3612 * 3613 * @callback_signature 3614 * ``` 3615 * void function_name(GLFWwindow* window); 3616 * ``` 3617 * For more information about the callback parameters, see the 3618 * [function pointer type](@ref GLFWwindowrefreshfun). 3619 * 3620 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3621 * 3622 * Thread_Safety: This function must only be called from the main thread. 3623 * 3624 * @sa @ref window_refresh 3625 * 3626 * Since: Added in version 2.5. 3627 * @glfw3 Added window handle parameter and return value. 3628 * 3629 * Ingroup: window 3630 */ 3631 GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback); 3632 3633 /** Sets the focus callback for the specified window. 3634 * 3635 * This function sets the focus callback of the specified window, which is 3636 * called when the window gains or loses input focus. 3637 * 3638 * After the focus callback is called for a window that lost input focus, 3639 * synthetic key and mouse button release events will be generated for all such 3640 * that had been pressed. For more information, see @ref glfwSetKeyCallback 3641 * and @ref glfwSetMouseButtonCallback. 3642 * 3643 * Params: 3644 * window = The window whose callback to set. 3645 * callback = The new callback, or `null` to remove the currently set 3646 * callback. 3647 * Returns: The previously set callback, or `null` if no callback was set or the 3648 * library had not been [initialized](@ref intro_init). 3649 * 3650 * @callback_signature 3651 * ``` 3652 * void function_name(GLFWwindow* window, int focused) 3653 * ``` 3654 * For more information about the callback parameters, see the 3655 * [function pointer type](@ref GLFWwindowfocusfun). 3656 * 3657 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3658 * 3659 * Thread_Safety: This function must only be called from the main thread. 3660 * 3661 * @sa @ref window_focus 3662 * 3663 * Since: Added in version 3.0. 3664 * 3665 * Ingroup: window 3666 */ 3667 GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback); 3668 3669 /** Sets the iconify callback for the specified window. 3670 * 3671 * This function sets the iconification callback of the specified window, which 3672 * is called when the window is iconified or restored. 3673 * 3674 * Params: 3675 * window = The window whose callback to set. 3676 * callback = The new callback, or `null` to remove the currently set 3677 * callback. 3678 * Returns: The previously set callback, or `null` if no callback was set or the 3679 * library had not been [initialized](@ref intro_init). 3680 * 3681 * @callback_signature 3682 * ``` 3683 * void function_name(GLFWwindow* window, int iconified) 3684 * ``` 3685 * For more information about the callback parameters, see the 3686 * [function pointer type](@ref GLFWwindowiconifyfun). 3687 * 3688 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3689 * 3690 * @remark @wayland The wl_shell protocol has no concept of iconification, 3691 * this callback will never be called when using this deprecated protocol. 3692 * 3693 * Thread_Safety: This function must only be called from the main thread. 3694 * 3695 * @sa @ref window_iconify 3696 * 3697 * Since: Added in version 3.0. 3698 * 3699 * Ingroup: window 3700 */ 3701 GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback); 3702 3703 /** Sets the maximize callback for the specified window. 3704 * 3705 * This function sets the maximization callback of the specified window, which 3706 * is called when the window is maximized or restored. 3707 * 3708 * Params: 3709 * window = The window whose callback to set. 3710 * callback = The new callback, or `null` to remove the currently set 3711 * callback. 3712 * Returns: The previously set callback, or `null` if no callback was set or the 3713 * library had not been [initialized](@ref intro_init). 3714 * 3715 * @callback_signature 3716 * ``` 3717 * void function_name(GLFWwindow* window, int maximized) 3718 * ``` 3719 * For more information about the callback parameters, see the 3720 * [function pointer type](@ref GLFWwindowmaximizefun). 3721 * 3722 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3723 * 3724 * Thread_Safety: This function must only be called from the main thread. 3725 * 3726 * @sa @ref window_maximize 3727 * 3728 * Since: Added in version 3.3. 3729 * 3730 * Ingroup: window 3731 */ 3732 GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback); 3733 3734 /** Sets the framebuffer resize callback for the specified window. 3735 * 3736 * This function sets the framebuffer resize callback of the specified window, 3737 * which is called when the framebuffer of the specified window is resized. 3738 * 3739 * Params: 3740 * window = The window whose callback to set. 3741 * callback = The new callback, or `null` to remove the currently set 3742 * callback. 3743 * Returns: The previously set callback, or `null` if no callback was set or the 3744 * library had not been [initialized](@ref intro_init). 3745 * 3746 * @callback_signature 3747 * ``` 3748 * void function_name(GLFWwindow* window, int width, int height) 3749 * ``` 3750 * For more information about the callback parameters, see the 3751 * [function pointer type](@ref GLFWframebuffersizefun). 3752 * 3753 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3754 * 3755 * Thread_Safety: This function must only be called from the main thread. 3756 * 3757 * @sa @ref window_fbsize 3758 * 3759 * Since: Added in version 3.0. 3760 * 3761 * Ingroup: window 3762 */ 3763 GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback); 3764 3765 /** Sets the window content scale callback for the specified window. 3766 * 3767 * This function sets the window content scale callback of the specified window, 3768 * which is called when the content scale of the specified window changes. 3769 * 3770 * Params: 3771 * window = The window whose callback to set. 3772 * callback = The new callback, or `null` to remove the currently set 3773 * callback. 3774 * Returns: The previously set callback, or `null` if no callback was set or the 3775 * library had not been [initialized](@ref intro_init). 3776 * 3777 * @callback_signature 3778 * ``` 3779 * void function_name(GLFWwindow* window, float xscale, float yscale) 3780 * ``` 3781 * For more information about the callback parameters, see the 3782 * [function pointer type](@ref GLFWwindowcontentscalefun). 3783 * 3784 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 3785 * 3786 * Thread_Safety: This function must only be called from the main thread. 3787 * 3788 * @sa @ref window_scale 3789 * @sa @ref glfwGetWindowContentScale 3790 * 3791 * Since: Added in version 3.3. 3792 * 3793 * Ingroup: window 3794 */ 3795 GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback); 3796 3797 /** Processes all pending events. 3798 * 3799 * This function processes only those events that are already in the event 3800 * queue and then returns immediately. Processing events will cause the window 3801 * and input callbacks associated with those events to be called. 3802 * 3803 * On some platforms, a window move, resize or menu operation will cause event 3804 * processing to block. This is due to how event processing is designed on 3805 * those platforms. You can use the 3806 * [window refresh callback](@ref window_refresh) to redraw the contents of 3807 * your window when necessary during such operations. 3808 * 3809 * Do not assume that callbacks you set will _only_ be called in response to 3810 * event processing functions like this one. While it is necessary to poll for 3811 * events, window systems that require GLFW to register callbacks of its own 3812 * can pass events to GLFW in response to many window system function calls. 3813 * GLFW will pass those events on to the application callbacks before 3814 * returning. 3815 * 3816 * Event processing is not required for joystick input to work. 3817 * 3818 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3819 * GLFW_PLATFORM_ERROR. 3820 * 3821 * @reentrancy This function must not be called from a callback. 3822 * 3823 * Thread_Safety: This function must only be called from the main thread. 3824 * 3825 * @sa @ref events 3826 * @sa @ref glfwWaitEvents 3827 * @sa @ref glfwWaitEventsTimeout 3828 * 3829 * Since: Added in version 1.0. 3830 * 3831 * Ingroup: window 3832 */ 3833 void glfwPollEvents(); 3834 3835 /** Waits until events are queued and processes them. 3836 * 3837 * This function puts the calling thread to sleep until at least one event is 3838 * available in the event queue. Once one or more events are available, 3839 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue 3840 * are processed and the function then returns immediately. Processing events 3841 * will cause the window and input callbacks associated with those events to be 3842 * called. 3843 * 3844 * Since not all events are associated with callbacks, this function may return 3845 * without a callback having been called even if you are monitoring all 3846 * callbacks. 3847 * 3848 * On some platforms, a window move, resize or menu operation will cause event 3849 * processing to block. This is due to how event processing is designed on 3850 * those platforms. You can use the 3851 * [window refresh callback](@ref window_refresh) to redraw the contents of 3852 * your window when necessary during such operations. 3853 * 3854 * Do not assume that callbacks you set will _only_ be called in response to 3855 * event processing functions like this one. While it is necessary to poll for 3856 * events, window systems that require GLFW to register callbacks of its own 3857 * can pass events to GLFW in response to many window system function calls. 3858 * GLFW will pass those events on to the application callbacks before 3859 * returning. 3860 * 3861 * Event processing is not required for joystick input to work. 3862 * 3863 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3864 * GLFW_PLATFORM_ERROR. 3865 * 3866 * @reentrancy This function must not be called from a callback. 3867 * 3868 * Thread_Safety: This function must only be called from the main thread. 3869 * 3870 * @sa @ref events 3871 * @sa @ref glfwPollEvents 3872 * @sa @ref glfwWaitEventsTimeout 3873 * 3874 * Since: Added in version 2.5. 3875 * 3876 * Ingroup: window 3877 */ 3878 void glfwWaitEvents(); 3879 3880 /** Waits with timeout until events are queued and processes them. 3881 * 3882 * This function puts the calling thread to sleep until at least one event is 3883 * available in the event queue, or until the specified timeout is reached. If 3884 * one or more events are available, it behaves exactly like @ref 3885 * glfwPollEvents, i.e. the events in the queue are processed and the function 3886 * then returns immediately. Processing events will cause the window and input 3887 * callbacks associated with those events to be called. 3888 * 3889 * The timeout value must be a positive finite number. 3890 * 3891 * Since not all events are associated with callbacks, this function may return 3892 * without a callback having been called even if you are monitoring all 3893 * callbacks. 3894 * 3895 * On some platforms, a window move, resize or menu operation will cause event 3896 * processing to block. This is due to how event processing is designed on 3897 * those platforms. You can use the 3898 * [window refresh callback](@ref window_refresh) to redraw the contents of 3899 * your window when necessary during such operations. 3900 * 3901 * Do not assume that callbacks you set will _only_ be called in response to 3902 * event processing functions like this one. While it is necessary to poll for 3903 * events, window systems that require GLFW to register callbacks of its own 3904 * can pass events to GLFW in response to many window system function calls. 3905 * GLFW will pass those events on to the application callbacks before 3906 * returning. 3907 * 3908 * Event processing is not required for joystick input to work. 3909 * 3910 * Params: 3911 * timeout = The maximum amount of time, in seconds, to wait. 3912 * 3913 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 3914 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. 3915 * 3916 * @reentrancy This function must not be called from a callback. 3917 * 3918 * Thread_Safety: This function must only be called from the main thread. 3919 * 3920 * @sa @ref events 3921 * @sa @ref glfwPollEvents 3922 * @sa @ref glfwWaitEvents 3923 * 3924 * Since: Added in version 3.2. 3925 * 3926 * Ingroup: window 3927 */ 3928 void glfwWaitEventsTimeout(double timeout); 3929 3930 /** Posts an empty event to the event queue. 3931 * 3932 * This function posts an empty event from the current thread to the event 3933 * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return. 3934 * 3935 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3936 * GLFW_PLATFORM_ERROR. 3937 * 3938 * Thread_Safety: This function may be called from any thread. 3939 * 3940 * @sa @ref events 3941 * @sa @ref glfwWaitEvents 3942 * @sa @ref glfwWaitEventsTimeout 3943 * 3944 * Since: Added in version 3.1. 3945 * 3946 * Ingroup: window 3947 */ 3948 void glfwPostEmptyEvent(); 3949 3950 /** Returns the value of an input option for the specified window. 3951 * 3952 * This function returns the value of an input option for the specified window. 3953 * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, 3954 * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or 3955 * @ref GLFW_RAW_MOUSE_MOTION. 3956 * 3957 * Params: 3958 * window = The window to query. 3959 * mode = One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, 3960 * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or 3961 * `GLFW_RAW_MOUSE_MOTION`. 3962 * 3963 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 3964 * GLFW_INVALID_ENUM. 3965 * 3966 * Thread_Safety: This function must only be called from the main thread. 3967 * 3968 * @sa @ref glfwSetInputMode 3969 * 3970 * Since: Added in version 3.0. 3971 * 3972 * Ingroup: input 3973 */ 3974 int glfwGetInputMode(GLFWwindow* window, int mode); 3975 3976 /** Sets an input option for the specified window. 3977 * 3978 * This function sets an input mode option for the specified window. The mode 3979 * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, 3980 * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or 3981 * @ref GLFW_RAW_MOUSE_MOTION. 3982 * 3983 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor 3984 * modes: 3985 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. 3986 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the 3987 * content area of the window but does not restrict the cursor from leaving. 3988 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual 3989 * and unlimited cursor movement. This is useful for implementing for 3990 * example 3D camera controls. 3991 * 3992 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to 3993 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are 3994 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` 3995 * the next time it is called even if the key had been released before the 3996 * call. This is useful when you are only interested in whether keys have been 3997 * pressed but not when or in which order. 3998 * 3999 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either 4000 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. 4001 * If sticky mouse buttons are enabled, a mouse button press will ensure that 4002 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even 4003 * if the mouse button had been released before the call. This is useful when 4004 * you are only interested in whether mouse buttons have been pressed but not 4005 * when or in which order. 4006 * 4007 * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to 4008 * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled, 4009 * callbacks that receive modifier bits will also have the @ref 4010 * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on, 4011 * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on. 4012 * 4013 * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE` 4014 * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is 4015 * disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported, 4016 * attempting to set this will emit @ref GLFW_PLATFORM_ERROR. Call @ref 4017 * glfwRawMouseMotionSupported to check for support. 4018 * 4019 * Params: 4020 * window = The window whose input mode to set. 4021 * mode = One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, 4022 * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or 4023 * `GLFW_RAW_MOUSE_MOTION`. 4024 * value = The new value of the specified input mode. 4025 * 4026 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4027 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4028 * 4029 * Thread_Safety: This function must only be called from the main thread. 4030 * 4031 * @sa @ref glfwGetInputMode 4032 * 4033 * Since: Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`. 4034 * 4035 * Ingroup: input 4036 */ 4037 void glfwSetInputMode(GLFWwindow* window, int mode, int value); 4038 4039 /** Returns whether raw mouse motion is supported. 4040 * 4041 * This function returns whether raw mouse motion is supported on the current 4042 * system. This status does not change after GLFW has been initialized so you 4043 * only need to check this once. If you attempt to enable raw motion on 4044 * a system that does not support it, @ref GLFW_PLATFORM_ERROR will be emitted. 4045 * 4046 * Raw mouse motion is closer to the actual motion of the mouse across 4047 * a surface. It is not affected by the scaling and acceleration applied to 4048 * the motion of the desktop cursor. That processing is suitable for a cursor 4049 * while raw motion is better for controlling for example a 3D camera. Because 4050 * of this, raw mouse motion is only provided when the cursor is disabled. 4051 * 4052 * Returns: `GLFW_TRUE` if raw mouse motion is supported on the current machine, 4053 * or `GLFW_FALSE` otherwise. 4054 * 4055 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4056 * 4057 * Thread_Safety: This function must only be called from the main thread. 4058 * 4059 * @sa @ref raw_mouse_motion 4060 * @sa @ref glfwSetInputMode 4061 * 4062 * Since: Added in version 3.3. 4063 * 4064 * Ingroup: input 4065 */ 4066 int glfwRawMouseMotionSupported(); 4067 4068 /** Returns the layout-specific name of the specified printable key. 4069 * 4070 * This function returns the name of the specified printable key, encoded as 4071 * UTF-8. This is typically the character that key would produce without any 4072 * modifier keys, intended for displaying key bindings to the user. For dead 4073 * keys, it is typically the diacritic it would add to a character. 4074 * 4075 * __Do not use this function__ for [text input](@ref input_char). You will 4076 * break text input for many languages even if it happens to work for yours. 4077 * 4078 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key, 4079 * otherwise the scancode is ignored. If you specify a non-printable key, or 4080 * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this 4081 * function returns `null` but does not emit an error. 4082 * 4083 * This behavior allows you to always pass in the arguments in the 4084 * [key callback](@ref input_key) without modification. 4085 * 4086 * The printable keys are: 4087 * - `GLFW_KEY_APOSTROPHE` 4088 * - `GLFW_KEY_COMMA` 4089 * - `GLFW_KEY_MINUS` 4090 * - `GLFW_KEY_PERIOD` 4091 * - `GLFW_KEY_SLASH` 4092 * - `GLFW_KEY_SEMICOLON` 4093 * - `GLFW_KEY_EQUAL` 4094 * - `GLFW_KEY_LEFT_BRACKET` 4095 * - `GLFW_KEY_RIGHT_BRACKET` 4096 * - `GLFW_KEY_BACKSLASH` 4097 * - `GLFW_KEY_WORLD_1` 4098 * - `GLFW_KEY_WORLD_2` 4099 * - `GLFW_KEY_0` to `GLFW_KEY_9` 4100 * - `GLFW_KEY_A` to `GLFW_KEY_Z` 4101 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9` 4102 * - `GLFW_KEY_KP_DECIMAL` 4103 * - `GLFW_KEY_KP_DIVIDE` 4104 * - `GLFW_KEY_KP_MULTIPLY` 4105 * - `GLFW_KEY_KP_SUBTRACT` 4106 * - `GLFW_KEY_KP_ADD` 4107 * - `GLFW_KEY_KP_EQUAL` 4108 * 4109 * Names for printable keys depend on keyboard layout, while names for 4110 * non-printable keys are the same across layouts but depend on the application 4111 * language and should be localized along with other user interface text. 4112 * 4113 * Params: 4114 * key = The key to query, or `GLFW_KEY_UNKNOWN`. 4115 * scancode = The scancode of the key to query. 4116 * Returns: The UTF-8 encoded, layout-specific name of the key, or `null`. 4117 * 4118 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 4119 * GLFW_PLATFORM_ERROR. 4120 * 4121 * @remark The contents of the returned string may change when a keyboard 4122 * layout change event is received. 4123 * 4124 * Pointer_lifetime: The returned string is allocated and freed by GLFW. You 4125 * should not free it yourself. It is valid until the library is terminated. 4126 * 4127 * Thread_Safety: This function must only be called from the main thread. 4128 * 4129 * @sa @ref input_key_name 4130 * 4131 * Since: Added in version 3.2. 4132 * 4133 * Ingroup: input 4134 */ 4135 const(char)* glfwGetKeyName(int key, int scancode); 4136 4137 /** Returns the platform-specific scancode of the specified key. 4138 * 4139 * This function returns the platform-specific scancode of the specified key. 4140 * 4141 * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this 4142 * method will return `-1`. 4143 * 4144 * Params: 4145 * key = Any [named key](@ref keys). 4146 * Returns: The platform-specific scancode for the key, or `-1` if an 4147 * [error](@ref error_handling) occurred. 4148 * 4149 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4150 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4151 * 4152 * Thread_Safety: This function may be called from any thread. 4153 * 4154 * @sa @ref input_key 4155 * 4156 * Since: Added in version 3.3. 4157 * 4158 * Ingroup: input 4159 */ 4160 int glfwGetKeyScancode(int key); 4161 4162 /** Returns the last reported state of a keyboard key for the specified 4163 * window. 4164 * 4165 * This function returns the last state reported for the specified key to the 4166 * specified window. The returned state is one of `GLFW_PRESS` or 4167 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to 4168 * the key callback. 4169 * 4170 * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns 4171 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if 4172 * that key has already been released. 4173 * 4174 * The key functions deal with physical keys, with [key tokens](@ref keys) 4175 * named after their use on the standard US keyboard layout. If you want to 4176 * input text, use the Unicode character callback instead. 4177 * 4178 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be 4179 * used with this function. 4180 * 4181 * __Do not use this function__ to implement [text input](@ref input_char). 4182 * 4183 * Params: 4184 * window = The desired window. 4185 * key = The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is 4186 * not a valid key for this function. 4187 * Returns: One of `GLFW_PRESS` or `GLFW_RELEASE`. 4188 * 4189 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 4190 * GLFW_INVALID_ENUM. 4191 * 4192 * Thread_Safety: This function must only be called from the main thread. 4193 * 4194 * @sa @ref input_key 4195 * 4196 * Since: Added in version 1.0. 4197 * @glfw3 Added window handle parameter. 4198 * 4199 * Ingroup: input 4200 */ 4201 int glfwGetKey(GLFWwindow* window, int key); 4202 4203 /** Returns the last reported state of a mouse button for the specified 4204 * window. 4205 * 4206 * This function returns the last state reported for the specified mouse button 4207 * to the specified window. The returned state is one of `GLFW_PRESS` or 4208 * `GLFW_RELEASE`. 4209 * 4210 * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function 4211 * returns `GLFW_PRESS` the first time you call it for a mouse button that was 4212 * pressed, even if that mouse button has already been released. 4213 * 4214 * Params: 4215 * window = The desired window. 4216 * button = The desired [mouse button](@ref buttons). 4217 * Returns: One of `GLFW_PRESS` or `GLFW_RELEASE`. 4218 * 4219 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 4220 * GLFW_INVALID_ENUM. 4221 * 4222 * Thread_Safety: This function must only be called from the main thread. 4223 * 4224 * @sa @ref input_mouse_button 4225 * 4226 * Since: Added in version 1.0. 4227 * @glfw3 Added window handle parameter. 4228 * 4229 * Ingroup: input 4230 */ 4231 int glfwGetMouseButton(GLFWwindow* window, int button); 4232 4233 /** Retrieves the position of the cursor relative to the content area of 4234 * the window. 4235 * 4236 * This function returns the position of the cursor, in screen coordinates, 4237 * relative to the upper-left corner of the content area of the specified 4238 * window. 4239 * 4240 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor 4241 * position is unbounded and limited only by the minimum and maximum values of 4242 * a `double`. 4243 * 4244 * The coordinate can be converted to their integer equivalents with the 4245 * `floor` function. Casting directly to an integer type works for positive 4246 * coordinates, but fails for negative ones. 4247 * 4248 * Any or all of the position arguments may be `null`. If an error occurs, all 4249 * non-`null` position arguments will be set to zero. 4250 * 4251 * Params: 4252 * window = The desired window. 4253 * xpos = Where to store the cursor x-coordinate, relative to the 4254 * left edge of the content area, or `null`. 4255 * ypos = Where to store the cursor y-coordinate, relative to the to 4256 * top edge of the content area, or `null`. 4257 * 4258 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 4259 * GLFW_PLATFORM_ERROR. 4260 * 4261 * Thread_Safety: This function must only be called from the main thread. 4262 * 4263 * @sa @ref cursor_pos 4264 * @sa @ref glfwSetCursorPos 4265 * 4266 * Since: Added in version 3.0. Replaces `glfwGetMousePos`. 4267 * 4268 * Ingroup: input 4269 */ 4270 void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); 4271 4272 /** Sets the position of the cursor, relative to the content area of the 4273 * window. 4274 * 4275 * This function sets the position, in screen coordinates, of the cursor 4276 * relative to the upper-left corner of the content area of the specified 4277 * window. The window must have input focus. If the window does not have 4278 * input focus when this function is called, it fails silently. 4279 * 4280 * __Do not use this function__ to implement things like camera controls. GLFW 4281 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the 4282 * cursor, transparently re-centers it and provides unconstrained cursor 4283 * motion. See @ref glfwSetInputMode for more information. 4284 * 4285 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is 4286 * unconstrained and limited only by the minimum and maximum values of 4287 * a `double`. 4288 * 4289 * Params: 4290 * window = The desired window. 4291 * xpos = The desired x-coordinate, relative to the left edge of the 4292 * content area. 4293 * ypos = The desired y-coordinate, relative to the top edge of the 4294 * content area. 4295 * 4296 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 4297 * GLFW_PLATFORM_ERROR. 4298 * 4299 * @remark @wayland This function will only work when the cursor mode is 4300 * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing. 4301 * 4302 * Thread_Safety: This function must only be called from the main thread. 4303 * 4304 * @sa @ref cursor_pos 4305 * @sa @ref glfwGetCursorPos 4306 * 4307 * Since: Added in version 3.0. Replaces `glfwSetMousePos`. 4308 * 4309 * Ingroup: input 4310 */ 4311 void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); 4312 4313 /** Creates a custom cursor. 4314 * 4315 * Creates a new custom cursor image that can be set for a window with @ref 4316 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. 4317 * Any remaining cursors are destroyed by @ref glfwTerminate. 4318 * 4319 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight 4320 * bits per channel with the red channel first. They are arranged canonically 4321 * as packed sequential rows, starting from the top-left corner. 4322 * 4323 * The cursor hotspot is specified in pixels, relative to the upper-left corner 4324 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis 4325 * points to the right and the Y-axis points down. 4326 * 4327 * Params: 4328 * image = The desired cursor image. 4329 * xhot = The desired x-coordinate, in pixels, of the cursor hotspot. 4330 * yhot = The desired y-coordinate, in pixels, of the cursor hotspot. 4331 * Returns: The handle of the created cursor, or `null` if an 4332 * [error](@ref error_handling) occurred. 4333 * 4334 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 4335 * GLFW_PLATFORM_ERROR. 4336 * 4337 * Pointer_lifetime: The specified image data is copied before this function 4338 * returns. 4339 * 4340 * Thread_Safety: This function must only be called from the main thread. 4341 * 4342 * @sa @ref cursor_object 4343 * @sa @ref glfwDestroyCursor 4344 * @sa @ref glfwCreateStandardCursor 4345 * 4346 * Since: Added in version 3.1. 4347 * 4348 * Ingroup: input 4349 */ 4350 GLFWcursor* glfwCreateCursor(const(GLFWimage)* image, int xhot, int yhot); 4351 4352 /** Creates a cursor with a standard shape. 4353 * 4354 * Returns a cursor with a [standard shape](@ref shapes), that can be set for 4355 * a window with @ref glfwSetCursor. 4356 * 4357 * Params: 4358 * shape = One of the [standard shapes](@ref shapes). 4359 * Returns: A new cursor ready to use or `null` if an 4360 * [error](@ref error_handling) occurred. 4361 * 4362 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4363 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4364 * 4365 * Thread_Safety: This function must only be called from the main thread. 4366 * 4367 * @sa @ref cursor_object 4368 * @sa @ref glfwCreateCursor 4369 * 4370 * Since: Added in version 3.1. 4371 * 4372 * Ingroup: input 4373 */ 4374 GLFWcursor* glfwCreateStandardCursor(int shape); 4375 4376 /** Destroys a cursor. 4377 * 4378 * This function destroys a cursor previously created with @ref 4379 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref 4380 * glfwTerminate. 4381 * 4382 * If the specified cursor is current for any window, that window will be 4383 * reverted to the default cursor. This does not affect the cursor mode. 4384 * 4385 * Params: 4386 * cursor = The cursor object to destroy. 4387 * 4388 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 4389 * GLFW_PLATFORM_ERROR. 4390 * 4391 * @reentrancy This function must not be called from a callback. 4392 * 4393 * Thread_Safety: This function must only be called from the main thread. 4394 * 4395 * @sa @ref cursor_object 4396 * @sa @ref glfwCreateCursor 4397 * 4398 * Since: Added in version 3.1. 4399 * 4400 * Ingroup: input 4401 */ 4402 void glfwDestroyCursor(GLFWcursor* cursor); 4403 4404 /** Sets the cursor for the window. 4405 * 4406 * This function sets the cursor image to be used when the cursor is over the 4407 * content area of the specified window. The set cursor will only be visible 4408 * when the [cursor mode](@ref cursor_mode) of the window is 4409 * `GLFW_CURSOR_NORMAL`. 4410 * 4411 * On some platforms, the set cursor may not be visible unless the window also 4412 * has input focus. 4413 * 4414 * Params: 4415 * window = The window to set the cursor for. 4416 * cursor = The cursor to set, or `null` to switch back to the default 4417 * arrow cursor. 4418 * 4419 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 4420 * GLFW_PLATFORM_ERROR. 4421 * 4422 * Thread_Safety: This function must only be called from the main thread. 4423 * 4424 * @sa @ref cursor_object 4425 * 4426 * Since: Added in version 3.1. 4427 * 4428 * Ingroup: input 4429 */ 4430 void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); 4431 4432 /** Sets the key callback. 4433 * 4434 * This function sets the key callback of the specified window, which is called 4435 * when a key is pressed, repeated or released. 4436 * 4437 * The key functions deal with physical keys, with layout independent 4438 * [key tokens](@ref keys) named after their values in the standard US keyboard 4439 * layout. If you want to input text, use the 4440 * [character callback](@ref glfwSetCharCallback) instead. 4441 * 4442 * When a window loses input focus, it will generate synthetic key release 4443 * events for all pressed keys. You can tell these events from user-generated 4444 * events by the fact that the synthetic ones are generated after the focus 4445 * loss event has been processed, i.e. after the 4446 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. 4447 * 4448 * The scancode of a key is specific to that platform or sometimes even to that 4449 * machine. Scancodes are intended to allow users to bind keys that don't have 4450 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their 4451 * state is not saved and so it cannot be queried with @ref glfwGetKey. 4452 * 4453 * Sometimes GLFW needs to generate synthetic key events, in which case the 4454 * scancode may be zero. 4455 * 4456 * Params: 4457 * window = The window whose callback to set. 4458 * callback = The new key callback, or `null` to remove the currently 4459 * set callback. 4460 * Returns: The previously set callback, or `null` if no callback was set or the 4461 * library had not been [initialized](@ref intro_init). 4462 * 4463 * @callback_signature 4464 * ``` 4465 * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods) 4466 * ``` 4467 * For more information about the callback parameters, see the 4468 * [function pointer type](@ref GLFWkeyfun). 4469 * 4470 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4471 * 4472 * Thread_Safety: This function must only be called from the main thread. 4473 * 4474 * @sa @ref input_key 4475 * 4476 * Since: Added in version 1.0. 4477 * @glfw3 Added window handle parameter and return value. 4478 * 4479 * Ingroup: input 4480 */ 4481 GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback); 4482 4483 /** Sets the Unicode character callback. 4484 * 4485 * This function sets the character callback of the specified window, which is 4486 * called when a Unicode character is input. 4487 * 4488 * The character callback is intended for Unicode text input. As it deals with 4489 * characters, it is keyboard layout dependent, whereas the 4490 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 4491 * to physical keys, as a key may produce zero, one or more characters. If you 4492 * want to know whether a specific physical key was pressed or released, see 4493 * the key callback instead. 4494 * 4495 * The character callback behaves as system text input normally does and will 4496 * not be called if modifier keys are held down that would prevent normal text 4497 * input on that platform, for example a Super (Command) key on macOS or Alt key 4498 * on Windows. 4499 * 4500 * Params: 4501 * window = The window whose callback to set. 4502 * callback = The new callback, or `null` to remove the currently set 4503 * callback. 4504 * Returns: The previously set callback, or `null` if no callback was set or the 4505 * library had not been [initialized](@ref intro_init). 4506 * 4507 * @callback_signature 4508 * ``` 4509 * void function_name(GLFWwindow* window, unsigned int codepoint) 4510 * ``` 4511 * For more information about the callback parameters, see the 4512 * [function pointer type](@ref GLFWcharfun). 4513 * 4514 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4515 * 4516 * Thread_Safety: This function must only be called from the main thread. 4517 * 4518 * @sa @ref input_char 4519 * 4520 * Since: Added in version 2.4. 4521 * @glfw3 Added window handle parameter and return value. 4522 * 4523 * Ingroup: input 4524 */ 4525 GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback); 4526 4527 /** Sets the Unicode character with modifiers callback. 4528 * 4529 * This function sets the character with modifiers callback of the specified 4530 * window, which is called when a Unicode character is input regardless of what 4531 * modifier keys are used. 4532 * 4533 * The character with modifiers callback is intended for implementing custom 4534 * Unicode character input. For regular Unicode text input, see the 4535 * [character callback](@ref glfwSetCharCallback). Like the character 4536 * callback, the character with modifiers callback deals with characters and is 4537 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as 4538 * a key may produce zero, one or more characters. If you want to know whether 4539 * a specific physical key was pressed or released, see the 4540 * [key callback](@ref glfwSetKeyCallback) instead. 4541 * 4542 * Params: 4543 * window = The window whose callback to set. 4544 * callback = The new callback, or `null` to remove the currently set 4545 * callback. 4546 * Returns: The previously set callback, or `null` if no callback was set or an 4547 * [error](@ref error_handling) occurred. 4548 * 4549 * @callback_signature 4550 * ``` 4551 * void function_name(GLFWwindow* window, unsigned int codepoint, int mods) 4552 * ``` 4553 * For more information about the callback parameters, see the 4554 * [function pointer type](@ref GLFWcharmodsfun). 4555 * 4556 * @deprecated Scheduled for removal in version 4.0. 4557 * 4558 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4559 * 4560 * Thread_Safety: This function must only be called from the main thread. 4561 * 4562 * @sa @ref input_char 4563 * 4564 * Since: Added in version 3.1. 4565 * 4566 * Ingroup: input 4567 */ 4568 GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback); 4569 4570 /** Sets the mouse button callback. 4571 * 4572 * This function sets the mouse button callback of the specified window, which 4573 * is called when a mouse button is pressed or released. 4574 * 4575 * When a window loses input focus, it will generate synthetic mouse button 4576 * release events for all pressed mouse buttons. You can tell these events 4577 * from user-generated events by the fact that the synthetic ones are generated 4578 * after the focus loss event has been processed, i.e. after the 4579 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. 4580 * 4581 * Params: 4582 * window = The window whose callback to set. 4583 * callback = The new callback, or `null` to remove the currently set 4584 * callback. 4585 * Returns: The previously set callback, or `null` if no callback was set or the 4586 * library had not been [initialized](@ref intro_init). 4587 * 4588 * @callback_signature 4589 * ``` 4590 * void function_name(GLFWwindow* window, int button, int action, int mods) 4591 * ``` 4592 * For more information about the callback parameters, see the 4593 * [function pointer type](@ref GLFWmousebuttonfun). 4594 * 4595 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4596 * 4597 * Thread_Safety: This function must only be called from the main thread. 4598 * 4599 * @sa @ref input_mouse_button 4600 * 4601 * Since: Added in version 1.0. 4602 * @glfw3 Added window handle parameter and return value. 4603 * 4604 * Ingroup: input 4605 */ 4606 GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback); 4607 4608 /** Sets the cursor position callback. 4609 * 4610 * This function sets the cursor position callback of the specified window, 4611 * which is called when the cursor is moved. The callback is provided with the 4612 * position, in screen coordinates, relative to the upper-left corner of the 4613 * content area of the window. 4614 * 4615 * Params: 4616 * window = The window whose callback to set. 4617 * callback = The new callback, or `null` to remove the currently set 4618 * callback. 4619 * Returns: The previously set callback, or `null` if no callback was set or the 4620 * library had not been [initialized](@ref intro_init). 4621 * 4622 * @callback_signature 4623 * ``` 4624 * void function_name(GLFWwindow* window, double xpos, double ypos); 4625 * ``` 4626 * For more information about the callback parameters, see the 4627 * [function pointer type](@ref GLFWcursorposfun). 4628 * 4629 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4630 * 4631 * Thread_Safety: This function must only be called from the main thread. 4632 * 4633 * @sa @ref cursor_pos 4634 * 4635 * Since: Added in version 3.0. Replaces `glfwSetMousePosCallback`. 4636 * 4637 * Ingroup: input 4638 */ 4639 GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback); 4640 4641 /** Sets the cursor enter/leave callback. 4642 * 4643 * This function sets the cursor boundary crossing callback of the specified 4644 * window, which is called when the cursor enters or leaves the content area of 4645 * the window. 4646 * 4647 * Params: 4648 * window = The window whose callback to set. 4649 * callback = The new callback, or `null` to remove the currently set 4650 * callback. 4651 * Returns: The previously set callback, or `null` if no callback was set or the 4652 * library had not been [initialized](@ref intro_init). 4653 * 4654 * @callback_signature 4655 * ``` 4656 * void function_name(GLFWwindow* window, int entered) 4657 * ``` 4658 * For more information about the callback parameters, see the 4659 * [function pointer type](@ref GLFWcursorenterfun). 4660 * 4661 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4662 * 4663 * Thread_Safety: This function must only be called from the main thread. 4664 * 4665 * @sa @ref cursor_enter 4666 * 4667 * Since: Added in version 3.0. 4668 * 4669 * Ingroup: input 4670 */ 4671 GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback); 4672 4673 /** Sets the scroll callback. 4674 * 4675 * This function sets the scroll callback of the specified window, which is 4676 * called when a scrolling device is used, such as a mouse wheel or scrolling 4677 * area of a touchpad. 4678 * 4679 * The scroll callback receives all scrolling input, like that from a mouse 4680 * wheel or a touchpad scrolling area. 4681 * 4682 * Params: 4683 * window = The window whose callback to set. 4684 * callback = The new scroll callback, or `null` to remove the 4685 * currently set callback. 4686 * Returns: The previously set callback, or `null` if no callback was set or the 4687 * library had not been [initialized](@ref intro_init). 4688 * 4689 * @callback_signature 4690 * ``` 4691 * void function_name(GLFWwindow* window, double xoffset, double yoffset) 4692 * ``` 4693 * For more information about the callback parameters, see the 4694 * [function pointer type](@ref GLFWscrollfun). 4695 * 4696 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4697 * 4698 * Thread_Safety: This function must only be called from the main thread. 4699 * 4700 * @sa @ref scrolling 4701 * 4702 * Since: Added in version 3.0. Replaces `glfwSetMouseWheelCallback`. 4703 * 4704 * Ingroup: input 4705 */ 4706 GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback); 4707 4708 /** Sets the path drop callback. 4709 * 4710 * This function sets the path drop callback of the specified window, which is 4711 * called when one or more dragged paths are dropped on the window. 4712 * 4713 * Because the path array and its strings may have been generated specifically 4714 * for that event, they are not guaranteed to be valid after the callback has 4715 * returned. If you wish to use them after the callback returns, you need to 4716 * make a deep copy. 4717 * 4718 * Params: 4719 * window = The window whose callback to set. 4720 * callback = The new file drop callback, or `null` to remove the 4721 * currently set callback. 4722 * Returns: The previously set callback, or `null` if no callback was set or the 4723 * library had not been [initialized](@ref intro_init). 4724 * 4725 * @callback_signature 4726 * ``` 4727 * void function_name(GLFWwindow* window, int path_count, const char* paths[]) 4728 * ``` 4729 * For more information about the callback parameters, see the 4730 * [function pointer type](@ref GLFWdropfun). 4731 * 4732 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4733 * 4734 * @remark @wayland File drop is currently unimplemented. 4735 * 4736 * Thread_Safety: This function must only be called from the main thread. 4737 * 4738 * @sa @ref path_drop 4739 * 4740 * Since: Added in version 3.1. 4741 * 4742 * Ingroup: input 4743 */ 4744 GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback); 4745 4746 /** Returns whether the specified joystick is present. 4747 * 4748 * This function returns whether the specified joystick is present. 4749 * 4750 * There is no need to call this function before other functions that accept 4751 * a joystick ID, as they all check for presence before performing any other 4752 * work. 4753 * 4754 * Params: 4755 * jid = The [joystick](@ref joysticks) to query. 4756 * Returns: `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. 4757 * 4758 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4759 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4760 * 4761 * Thread_Safety: This function must only be called from the main thread. 4762 * 4763 * @sa @ref joystick 4764 * 4765 * Since: Added in version 3.0. Replaces `glfwGetJoystickParam`. 4766 * 4767 * Ingroup: input 4768 */ 4769 int glfwJoystickPresent(int jid); 4770 4771 /** Returns the values of all axes of the specified joystick. 4772 * 4773 * This function returns the values of all axes of the specified joystick. 4774 * Each element in the array is a value between -1.0 and 1.0. 4775 * 4776 * If the specified joystick is not present this function will return `null` 4777 * but will not generate an error. This can be used instead of first calling 4778 * @ref glfwJoystickPresent. 4779 * 4780 * Params: 4781 * jid = The [joystick](@ref joysticks) to query. 4782 * count = Where to store the number of axis values in the returned 4783 * array. This is set to zero if the joystick is not present or an error 4784 * occurred. 4785 * Returns: An array of axis values, or `null` if the joystick is not present or 4786 * an [error](@ref error_handling) occurred. 4787 * 4788 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4789 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4790 * 4791 * Pointer_lifetime: The returned array is allocated and freed by GLFW. You 4792 * should not free it yourself. It is valid until the specified joystick is 4793 * disconnected or the library is terminated. 4794 * 4795 * Thread_Safety: This function must only be called from the main thread. 4796 * 4797 * @sa @ref joystick_axis 4798 * 4799 * Since: Added in version 3.0. Replaces `glfwGetJoystickPos`. 4800 * 4801 * Ingroup: input 4802 */ 4803 const(float)* glfwGetJoystickAxes(int jid, int* count); 4804 4805 /** Returns the state of all buttons of the specified joystick. 4806 * 4807 * This function returns the state of all buttons of the specified joystick. 4808 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. 4809 * 4810 * For backward compatibility with earlier versions that did not have @ref 4811 * glfwGetJoystickHats, the button array also includes all hats, each 4812 * represented as four buttons. The hats are in the same order as returned by 4813 * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and 4814 * _left_. To disable these extra buttons, set the @ref 4815 * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization. 4816 * 4817 * If the specified joystick is not present this function will return `null` 4818 * but will not generate an error. This can be used instead of first calling 4819 * @ref glfwJoystickPresent. 4820 * 4821 * Params: 4822 * jid = The [joystick](@ref joysticks) to query. 4823 * count = Where to store the number of button states in the returned 4824 * array. This is set to zero if the joystick is not present or an error 4825 * occurred. 4826 * Returns: An array of button states, or `null` if the joystick is not present 4827 * or an [error](@ref error_handling) occurred. 4828 * 4829 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4830 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4831 * 4832 * Pointer_lifetime: The returned array is allocated and freed by GLFW. You 4833 * should not free it yourself. It is valid until the specified joystick is 4834 * disconnected or the library is terminated. 4835 * 4836 * Thread_Safety: This function must only be called from the main thread. 4837 * 4838 * @sa @ref joystick_button 4839 * 4840 * Since: Added in version 2.2. 4841 * @glfw3 Changed to return a dynamic array. 4842 * 4843 * Ingroup: input 4844 */ 4845 const(ubyte)* glfwGetJoystickButtons(int jid, int* count); 4846 4847 /** Returns the state of all hats of the specified joystick. 4848 * 4849 * This function returns the state of all hats of the specified joystick. 4850 * Each element in the array is one of the following values: 4851 * 4852 * Name | Value 4853 * ---- | ----- 4854 * `GLFW_HAT_CENTERED` | 0 4855 * `GLFW_HAT_UP` | 1 4856 * `GLFW_HAT_RIGHT` | 2 4857 * `GLFW_HAT_DOWN` | 4 4858 * `GLFW_HAT_LEFT` | 8 4859 * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` 4860 * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` 4861 * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` 4862 * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` 4863 * 4864 * The diagonal directions are bitwise combinations of the primary (up, right, 4865 * down and left) directions and you can test for these individually by ANDing 4866 * it with the corresponding direction. 4867 * 4868 * ``` 4869 * if (hats[2] & GLFW_HAT_RIGHT) 4870 * { 4871 * // State of hat 2 could be right-up, right or right-down 4872 * } 4873 * ``` 4874 * 4875 * If the specified joystick is not present this function will return `null` 4876 * but will not generate an error. This can be used instead of first calling 4877 * @ref glfwJoystickPresent. 4878 * 4879 * Params: 4880 * jid = The [joystick](@ref joysticks) to query. 4881 * count = Where to store the number of hat states in the returned 4882 * array. This is set to zero if the joystick is not present or an error 4883 * occurred. 4884 * Returns: An array of hat states, or `null` if the joystick is not present 4885 * or an [error](@ref error_handling) occurred. 4886 * 4887 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4888 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4889 * 4890 * Pointer_lifetime: The returned array is allocated and freed by GLFW. You 4891 * should not free it yourself. It is valid until the specified joystick is 4892 * disconnected, this function is called again for that joystick or the library 4893 * is terminated. 4894 * 4895 * Thread_Safety: This function must only be called from the main thread. 4896 * 4897 * @sa @ref joystick_hat 4898 * 4899 * Since: Added in version 3.3. 4900 * 4901 * Ingroup: input 4902 */ 4903 const(ubyte)* glfwGetJoystickHats(int jid, int* count); 4904 4905 /** Returns the name of the specified joystick. 4906 * 4907 * This function returns the name, encoded as UTF-8, of the specified joystick. 4908 * The returned string is allocated and freed by GLFW. You should not free it 4909 * yourself. 4910 * 4911 * If the specified joystick is not present this function will return `null` 4912 * but will not generate an error. This can be used instead of first calling 4913 * @ref glfwJoystickPresent. 4914 * 4915 * Params: 4916 * jid = The [joystick](@ref joysticks) to query. 4917 * Returns: The UTF-8 encoded name of the joystick, or `null` if the joystick 4918 * is not present or an [error](@ref error_handling) occurred. 4919 * 4920 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4921 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4922 * 4923 * Pointer_lifetime: The returned string is allocated and freed by GLFW. You 4924 * should not free it yourself. It is valid until the specified joystick is 4925 * disconnected or the library is terminated. 4926 * 4927 * Thread_Safety: This function must only be called from the main thread. 4928 * 4929 * @sa @ref joystick_name 4930 * 4931 * Since: Added in version 3.0. 4932 * 4933 * Ingroup: input 4934 */ 4935 const(char)* glfwGetJoystickName(int jid); 4936 4937 /** Returns the SDL compatible GUID of the specified joystick. 4938 * 4939 * This function returns the SDL compatible GUID, as a UTF-8 encoded 4940 * hexadecimal string, of the specified joystick. The returned string is 4941 * allocated and freed by GLFW. You should not free it yourself. 4942 * 4943 * The GUID is what connects a joystick to a gamepad mapping. A connected 4944 * joystick will always have a GUID even if there is no gamepad mapping 4945 * assigned to it. 4946 * 4947 * If the specified joystick is not present this function will return `null` 4948 * but will not generate an error. This can be used instead of first calling 4949 * @ref glfwJoystickPresent. 4950 * 4951 * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to 4952 * uniquely identify the make and model of a joystick but does not identify 4953 * a specific unit, e.g. all wired Xbox 360 controllers will have the same 4954 * GUID on that platform. The GUID for a unit may vary between platforms 4955 * depending on what hardware information the platform specific APIs provide. 4956 * 4957 * Params: 4958 * jid = The [joystick](@ref joysticks) to query. 4959 * Returns: The UTF-8 encoded GUID of the joystick, or `null` if the joystick 4960 * is not present or an [error](@ref error_handling) occurred. 4961 * 4962 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 4963 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. 4964 * 4965 * Pointer_lifetime: The returned string is allocated and freed by GLFW. You 4966 * should not free it yourself. It is valid until the specified joystick is 4967 * disconnected or the library is terminated. 4968 * 4969 * Thread_Safety: This function must only be called from the main thread. 4970 * 4971 * @sa @ref gamepad 4972 * 4973 * Since: Added in version 3.3. 4974 * 4975 * Ingroup: input 4976 */ 4977 const(char)* glfwGetJoystickGUID(int jid); 4978 4979 /** Sets the user pointer of the specified joystick. 4980 * 4981 * This function sets the user-defined pointer of the specified joystick. The 4982 * current value is retained until the joystick is disconnected. The initial 4983 * value is `null`. 4984 * 4985 * This function may be called from the joystick callback, even for a joystick 4986 * that is being disconnected. 4987 * 4988 * Params: 4989 * jid = The joystick whose pointer to set. 4990 * pointer = The new value. 4991 * 4992 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 4993 * 4994 * Thread_Safety: This function may be called from any thread. Access is not 4995 * synchronized. 4996 * 4997 * @sa @ref joystick_userptr 4998 * @sa @ref glfwGetJoystickUserPointer 4999 * 5000 * Since: Added in version 3.3. 5001 * 5002 * Ingroup: input 5003 */ 5004 void glfwSetJoystickUserPointer(int jid, void* pointer); 5005 5006 /** Returns the user pointer of the specified joystick. 5007 * 5008 * This function returns the current value of the user-defined pointer of the 5009 * specified joystick. The initial value is `null`. 5010 * 5011 * This function may be called from the joystick callback, even for a joystick 5012 * that is being disconnected. 5013 * 5014 * Params: 5015 * jid = The joystick whose pointer to return. 5016 * 5017 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 5018 * 5019 * Thread_Safety: This function may be called from any thread. Access is not 5020 * synchronized. 5021 * 5022 * @sa @ref joystick_userptr 5023 * @sa @ref glfwSetJoystickUserPointer 5024 * 5025 * Since: Added in version 3.3. 5026 * 5027 * Ingroup: input 5028 */ 5029 void* glfwGetJoystickUserPointer(int jid); 5030 5031 /** Returns whether the specified joystick has a gamepad mapping. 5032 * 5033 * This function returns whether the specified joystick is both present and has 5034 * a gamepad mapping. 5035 * 5036 * If the specified joystick is present but does not have a gamepad mapping 5037 * this function will return `GLFW_FALSE` but will not generate an error. Call 5038 * @ref glfwJoystickPresent to check if a joystick is present regardless of 5039 * whether it has a mapping. 5040 * 5041 * Params: 5042 * jid = The [joystick](@ref joysticks) to query. 5043 * Returns: `GLFW_TRUE` if a joystick is both present and has a gamepad mapping, 5044 * or `GLFW_FALSE` otherwise. 5045 * 5046 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5047 * GLFW_INVALID_ENUM. 5048 * 5049 * Thread_Safety: This function must only be called from the main thread. 5050 * 5051 * @sa @ref gamepad 5052 * @sa @ref glfwGetGamepadState 5053 * 5054 * Since: Added in version 3.3. 5055 * 5056 * Ingroup: input 5057 */ 5058 int glfwJoystickIsGamepad(int jid); 5059 5060 /** Sets the joystick configuration callback. 5061 * 5062 * This function sets the joystick configuration callback, or removes the 5063 * currently set callback. This is called when a joystick is connected to or 5064 * disconnected from the system. 5065 * 5066 * For joystick connection and disconnection events to be delivered on all 5067 * platforms, you need to call one of the [event processing](@ref events) 5068 * functions. Joystick disconnection may also be detected and the callback 5069 * called by joystick functions. The function will then return whatever it 5070 * returns if the joystick is not present. 5071 * 5072 * Params: 5073 * callback = The new callback, or `null` to remove the currently set 5074 * callback. 5075 * Returns: The previously set callback, or `null` if no callback was set or the 5076 * library had not been [initialized](@ref intro_init). 5077 * 5078 * @callback_signature 5079 * ``` 5080 * void function_name(int jid, int event) 5081 * ``` 5082 * For more information about the callback parameters, see the 5083 * [function pointer type](@ref GLFWjoystickfun). 5084 * 5085 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 5086 * 5087 * Thread_Safety: This function must only be called from the main thread. 5088 * 5089 * @sa @ref joystick_event 5090 * 5091 * Since: Added in version 3.2. 5092 * 5093 * Ingroup: input 5094 */ 5095 GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback); 5096 5097 /** Adds the specified SDL_GameControllerDB gamepad mappings. 5098 * 5099 * This function parses the specified ASCII encoded string and updates the 5100 * internal list with any gamepad mappings it finds. This string may 5101 * contain either a single gamepad mapping or many mappings separated by 5102 * newlines. The parser supports the full format of the `gamecontrollerdb.txt` 5103 * source file including empty lines and comments. 5104 * 5105 * See @ref gamepad_mapping for a description of the format. 5106 * 5107 * If there is already a gamepad mapping for a given GUID in the internal list, 5108 * it will be replaced by the one passed to this function. If the library is 5109 * terminated and re-initialized the internal list will revert to the built-in 5110 * default. 5111 * 5112 * Params: 5113 * string = The string containing the gamepad mappings. 5114 * Returns: `GLFW_TRUE` if successful, or `GLFW_FALSE` if an 5115 * [error](@ref error_handling) occurred. 5116 * 5117 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5118 * GLFW_INVALID_VALUE. 5119 * 5120 * Thread_Safety: This function must only be called from the main thread. 5121 * 5122 * @sa @ref gamepad 5123 * @sa @ref glfwJoystickIsGamepad 5124 * @sa @ref glfwGetGamepadName 5125 * 5126 * Since: Added in version 3.3. 5127 * 5128 * Ingroup: input 5129 */ 5130 int glfwUpdateGamepadMappings(const(char)* string); 5131 5132 /** Returns the human-readable gamepad name for the specified joystick. 5133 * 5134 * This function returns the human-readable name of the gamepad from the 5135 * gamepad mapping assigned to the specified joystick. 5136 * 5137 * If the specified joystick is not present or does not have a gamepad mapping 5138 * this function will return `null` but will not generate an error. Call 5139 * @ref glfwJoystickPresent to check whether it is present regardless of 5140 * whether it has a mapping. 5141 * 5142 * Params: 5143 * jid = The [joystick](@ref joysticks) to query. 5144 * Returns: The UTF-8 encoded name of the gamepad, or `null` if the 5145 * joystick is not present, does not have a mapping or an 5146 * [error](@ref error_handling) occurred. 5147 * 5148 * Pointer_lifetime: The returned string is allocated and freed by GLFW. You 5149 * should not free it yourself. It is valid until the specified joystick is 5150 * disconnected, the gamepad mappings are updated or the library is terminated. 5151 * 5152 * Thread_Safety: This function must only be called from the main thread. 5153 * 5154 * @sa @ref gamepad 5155 * @sa @ref glfwJoystickIsGamepad 5156 * 5157 * Since: Added in version 3.3. 5158 * 5159 * Ingroup: input 5160 */ 5161 const(char)* glfwGetGamepadName(int jid); 5162 5163 /** Retrieves the state of the specified joystick remapped as a gamepad. 5164 * 5165 * This function retrieves the state of the specified joystick remapped to 5166 * an Xbox-like gamepad. 5167 * 5168 * If the specified joystick is not present or does not have a gamepad mapping 5169 * this function will return `GLFW_FALSE` but will not generate an error. Call 5170 * @ref glfwJoystickPresent to check whether it is present regardless of 5171 * whether it has a mapping. 5172 * 5173 * The Guide button may not be available for input as it is often hooked by the 5174 * system or the Steam client. 5175 * 5176 * Not all devices have all the buttons or axes provided by @ref 5177 * GLFWgamepadstate. Unavailable buttons and axes will always report 5178 * `GLFW_RELEASE` and 0.0 respectively. 5179 * 5180 * Params: 5181 * jid = The [joystick](@ref joysticks) to query. 5182 * state = The gamepad input state of the joystick. 5183 * Returns: `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is 5184 * connected, it has no gamepad mapping or an [error](@ref error_handling) 5185 * occurred. 5186 * 5187 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5188 * GLFW_INVALID_ENUM. 5189 * 5190 * Thread_Safety: This function must only be called from the main thread. 5191 * 5192 * @sa @ref gamepad 5193 * @sa @ref glfwUpdateGamepadMappings 5194 * @sa @ref glfwJoystickIsGamepad 5195 * 5196 * Since: Added in version 3.3. 5197 * 5198 * Ingroup: input 5199 */ 5200 int glfwGetGamepadState(int jid, GLFWgamepadstate* state); 5201 5202 // This version identifier needs to be defined because there might be breaking API changes, 5203 // as of writing the pull request is not merged in the GLFW repository: 5204 // https://github.com/glfw/glfw/pull/1678 5205 version(GLFW_PREVIEW_JOYSTICK_RUMBLE) 5206 /** Sets the intensity of a joystick's rumble effect. 5207 * 5208 * This function sends vibration data to joysticks that implement haptic feedback 5209 * effects using two vibration motors: a low-frequency motor, and a 5210 * high-frequency motor. 5211 * 5212 * Vibration intensity is a value between 0.0 and 1.0 inclusive, where 0.0 is no 5213 * vibration, and 1.0 is maximum vibration. It is set separately for the 5214 * joystick's low frequency and high frequency rumble motors. 5215 * 5216 * If the specified joystick is not present or does not support the rumble effect, 5217 * this function will return `GLFW_FALSE` but will not generate an error. 5218 * 5219 * Params: 5220 * jid = The [joystick](@ref joysticks) to vibrate. 5221 * slowMotorIntensity = The low frequency vibration intensity. 5222 * fastMotorIntensity = The high frequency vibration intensity. 5223 * Returns: `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is connected, 5224 * or the joystick does not support the rumble effect. 5225 * 5226 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5227 * GLFW_INVALID_ENUM. 5228 * 5229 * Thread_Safety: This function must only be called from the main thread. 5230 * 5231 * Note: @win32 This function is only implemented for XInput devices. 5232 * Note: @macos This function is not implemented. 5233 * 5234 * Ingroup: input 5235 */ 5236 int glfwSetJoystickRumble(int jid, float slowMotorIntensity, float fastMotorIntensity); 5237 5238 /** Sets the clipboard to the specified string. 5239 * 5240 * This function sets the system clipboard to the specified, UTF-8 encoded 5241 * string. 5242 * 5243 * Params: 5244 * window = Deprecated. Any valid window or `null`. 5245 * string = A UTF-8 encoded string. 5246 * 5247 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5248 * GLFW_PLATFORM_ERROR. 5249 * 5250 * Pointer_lifetime: The specified string is copied before this function 5251 * returns. 5252 * 5253 * Thread_Safety: This function must only be called from the main thread. 5254 * 5255 * @sa @ref clipboard 5256 * @sa @ref glfwGetClipboardString 5257 * 5258 * Since: Added in version 3.0. 5259 * 5260 * Ingroup: input 5261 */ 5262 void glfwSetClipboardString(GLFWwindow* window, const(char)* string); 5263 5264 /** Returns the contents of the clipboard as a string. 5265 * 5266 * This function returns the contents of the system clipboard, if it contains 5267 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or 5268 * if its contents cannot be converted, `null` is returned and a @ref 5269 * GLFW_FORMAT_UNAVAILABLE error is generated. 5270 * 5271 * Params: 5272 * window = Deprecated. Any valid window or `null`. 5273 * Returns: The contents of the clipboard as a UTF-8 encoded string, or `null` 5274 * if an [error](@ref error_handling) occurred. 5275 * 5276 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5277 * GLFW_PLATFORM_ERROR. 5278 * 5279 * Pointer_lifetime: The returned string is allocated and freed by GLFW. You 5280 * should not free it yourself. It is valid until the next call to @ref 5281 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library 5282 * is terminated. 5283 * 5284 * Thread_Safety: This function must only be called from the main thread. 5285 * 5286 * @sa @ref clipboard 5287 * @sa @ref glfwSetClipboardString 5288 * 5289 * Since: Added in version 3.0. 5290 * 5291 * Ingroup: input 5292 */ 5293 const(char)* glfwGetClipboardString(GLFWwindow* window); 5294 5295 /** Returns the GLFW time. 5296 * 5297 * This function returns the current GLFW time, in seconds. Unless the time 5298 * has been set using @ref glfwSetTime it measures time elapsed since GLFW was 5299 * initialized. 5300 * 5301 * This function and @ref glfwSetTime are helper functions on top of @ref 5302 * glfwGetTimerFrequency and @ref glfwGetTimerValue. 5303 * 5304 * The resolution of the timer is system dependent, but is usually on the order 5305 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic 5306 * time source on each supported platform. 5307 * 5308 * Returns: The current time, in seconds, or zero if an 5309 * [error](@ref error_handling) occurred. 5310 * 5311 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 5312 * 5313 * Thread_Safety: This function may be called from any thread. Reading and 5314 * writing of the internal base time is not atomic, so it needs to be 5315 * externally synchronized with calls to @ref glfwSetTime. 5316 * 5317 * @sa @ref time 5318 * 5319 * Since: Added in version 1.0. 5320 * 5321 * Ingroup: input 5322 */ 5323 double glfwGetTime(); 5324 5325 /** Sets the GLFW time. 5326 * 5327 * This function sets the current GLFW time, in seconds. The value must be 5328 * a positive finite number less than or equal to 18446744073.0, which is 5329 * approximately 584.5 years. 5330 * 5331 * This function and @ref glfwGetTime are helper functions on top of @ref 5332 * glfwGetTimerFrequency and @ref glfwGetTimerValue. 5333 * 5334 * Params: 5335 * time = The new value, in seconds. 5336 * 5337 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5338 * GLFW_INVALID_VALUE. 5339 * 5340 * @remark The upper limit of GLFW time is calculated as 5341 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations 5342 * storing nanoseconds in 64 bits. The limit may be increased in the future. 5343 * 5344 * Thread_Safety: This function may be called from any thread. Reading and 5345 * writing of the internal base time is not atomic, so it needs to be 5346 * externally synchronized with calls to @ref glfwGetTime. 5347 * 5348 * @sa @ref time 5349 * 5350 * Since: Added in version 2.2. 5351 * 5352 * Ingroup: input 5353 */ 5354 void glfwSetTime(double time); 5355 5356 /** Returns the current value of the raw timer. 5357 * 5358 * This function returns the current value of the raw timer, measured in 5359 * 1 / frequency seconds. To get the frequency, call @ref 5360 * glfwGetTimerFrequency. 5361 * 5362 * Returns: The value of the timer, or zero if an 5363 * [error](@ref error_handling) occurred. 5364 * 5365 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 5366 * 5367 * Thread_Safety: This function may be called from any thread. 5368 * 5369 * @sa @ref time 5370 * @sa @ref glfwGetTimerFrequency 5371 * 5372 * Since: Added in version 3.2. 5373 * 5374 * Ingroup: input 5375 */ 5376 ulong glfwGetTimerValue(); 5377 5378 /** Returns the frequency, in Hz, of the raw timer. 5379 * 5380 * This function returns the frequency, in Hz, of the raw timer. 5381 * 5382 * Returns: The frequency of the timer, in Hz, or zero if an 5383 * [error](@ref error_handling) occurred. 5384 * 5385 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 5386 * 5387 * Thread_Safety: This function may be called from any thread. 5388 * 5389 * @sa @ref time 5390 * @sa @ref glfwGetTimerValue 5391 * 5392 * Since: Added in version 3.2. 5393 * 5394 * Ingroup: input 5395 */ 5396 ulong glfwGetTimerFrequency(); 5397 5398 /** Makes the context of the specified window current for the calling 5399 * thread. 5400 * 5401 * This function makes the OpenGL or OpenGL ES context of the specified window 5402 * current on the calling thread. A context must only be made current on 5403 * a single thread at a time and each thread can have only a single current 5404 * context at a time. 5405 * 5406 * When moving a context between threads, you must make it non-current on the 5407 * old thread before making it current on the new one. 5408 * 5409 * By default, making a context non-current implicitly forces a pipeline flush. 5410 * On machines that support `GL_KHR_context_flush_control`, you can control 5411 * whether a context performs this flush by setting the 5412 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) 5413 * hint. 5414 * 5415 * The specified window must have an OpenGL or OpenGL ES context. Specifying 5416 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT 5417 * error. 5418 * 5419 * Params: 5420 * window = The window whose context to make current, or `null` to 5421 * detach the current context. 5422 * 5423 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 5424 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. 5425 * 5426 * Thread_Safety: This function may be called from any thread. 5427 * 5428 * @sa @ref context_current 5429 * @sa @ref glfwGetCurrentContext 5430 * 5431 * Since: Added in version 3.0. 5432 * 5433 * Ingroup: context 5434 */ 5435 void glfwMakeContextCurrent(GLFWwindow* window); 5436 5437 /** Returns the window whose context is current on the calling thread. 5438 * 5439 * This function returns the window whose OpenGL or OpenGL ES context is 5440 * current on the calling thread. 5441 * 5442 * Returns: The window whose context is current, or `null` if no window's 5443 * context is current. 5444 * 5445 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 5446 * 5447 * Thread_Safety: This function may be called from any thread. 5448 * 5449 * @sa @ref context_current 5450 * @sa @ref glfwMakeContextCurrent 5451 * 5452 * Since: Added in version 3.0. 5453 * 5454 * Ingroup: context 5455 */ 5456 GLFWwindow* glfwGetCurrentContext(); 5457 5458 /** Swaps the front and back buffers of the specified window. 5459 * 5460 * This function swaps the front and back buffers of the specified window when 5461 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than 5462 * zero, the GPU driver waits the specified number of screen updates before 5463 * swapping the buffers. 5464 * 5465 * The specified window must have an OpenGL or OpenGL ES context. Specifying 5466 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT 5467 * error. 5468 * 5469 * This function does not apply to Vulkan. If you are rendering with Vulkan, 5470 * see `vkQueuePresentKHR` instead. 5471 * 5472 * Params: 5473 * window = The window whose buffers to swap. 5474 * 5475 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 5476 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. 5477 * 5478 * @remark __EGL:__ The context of the specified window must be current on the 5479 * calling thread. 5480 * 5481 * Thread_Safety: This function may be called from any thread. 5482 * 5483 * @sa @ref buffer_swap 5484 * @sa @ref glfwSwapInterval 5485 * 5486 * Since: Added in version 1.0. 5487 * @glfw3 Added window handle parameter. 5488 * 5489 * Ingroup: window 5490 */ 5491 void glfwSwapBuffers(GLFWwindow* window); 5492 5493 /** Sets the swap interval for the current context. 5494 * 5495 * This function sets the swap interval for the current OpenGL or OpenGL ES 5496 * context, i.e. the number of screen updates to wait from the time @ref 5497 * glfwSwapBuffers was called before swapping the buffers and returning. This 5498 * is sometimes called _vertical synchronization_, _vertical retrace 5499 * synchronization_ or just _vsync_. 5500 * 5501 * A context that supports either of the `WGL_EXT_swap_control_tear` and 5502 * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap 5503 * intervals, which allows the driver to swap immediately even if a frame 5504 * arrives a little bit late. You can check for these extensions with @ref 5505 * glfwExtensionSupported. 5506 * 5507 * A context must be current on the calling thread. Calling this function 5508 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. 5509 * 5510 * This function does not apply to Vulkan. If you are rendering with Vulkan, 5511 * see the present mode of your swapchain instead. 5512 * 5513 * Params: 5514 * interval = The minimum number of screen updates to wait for 5515 * until the buffers are swapped by @ref glfwSwapBuffers. 5516 * 5517 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 5518 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. 5519 * 5520 * @remark This function is not called during context creation, leaving the 5521 * swap interval set to whatever is the default on that platform. This is done 5522 * because some swap interval extensions used by GLFW do not allow the swap 5523 * interval to be reset to zero once it has been set to a non-zero value. 5524 * 5525 * @remark Some GPU drivers do not honor the requested swap interval, either 5526 * because of a user setting that overrides the application's request or due to 5527 * bugs in the driver. 5528 * 5529 * Thread_Safety: This function may be called from any thread. 5530 * 5531 * @sa @ref buffer_swap 5532 * @sa @ref glfwSwapBuffers 5533 * 5534 * Since: Added in version 1.0. 5535 * 5536 * Ingroup: context 5537 */ 5538 void glfwSwapInterval(int interval); 5539 5540 /** Returns whether the specified extension is available. 5541 * 5542 * This function returns whether the specified 5543 * [API extension](@ref context_glext) is supported by the current OpenGL or 5544 * OpenGL ES context. It searches both for client API extension and context 5545 * creation API extensions. 5546 * 5547 * A context must be current on the calling thread. Calling this function 5548 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. 5549 * 5550 * As this functions retrieves and searches one or more extension strings each 5551 * call, it is recommended that you cache its results if it is going to be used 5552 * frequently. The extension strings will not change during the lifetime of 5553 * a context, so there is no danger in doing this. 5554 * 5555 * This function does not apply to Vulkan. If you are using Vulkan, see @ref 5556 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties` 5557 * and `vkEnumerateDeviceExtensionProperties` instead. 5558 * 5559 * Params: 5560 * extension = The ASCII encoded name of the extension. 5561 * Returns: `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` 5562 * otherwise. 5563 * 5564 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 5565 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref 5566 * GLFW_PLATFORM_ERROR. 5567 * 5568 * Thread_Safety: This function may be called from any thread. 5569 * 5570 * @sa @ref context_glext 5571 * @sa @ref glfwGetProcAddress 5572 * 5573 * Since: Added in version 1.0. 5574 * 5575 * Ingroup: context 5576 */ 5577 int glfwExtensionSupported(const(char)* extension); 5578 5579 /** Returns the address of the specified function for the current 5580 * context. 5581 * 5582 * This function returns the address of the specified OpenGL or OpenGL ES 5583 * [core or extension function](@ref context_glext), if it is supported 5584 * by the current context. 5585 * 5586 * A context must be current on the calling thread. Calling this function 5587 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. 5588 * 5589 * This function does not apply to Vulkan. If you are rendering with Vulkan, 5590 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and 5591 * `vkGetDeviceProcAddr` instead. 5592 * 5593 * Params: 5594 * procname = The ASCII encoded name of the function. 5595 * Returns: The address of the function, or `null` if an 5596 * [error](@ref error_handling) occurred. 5597 * 5598 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 5599 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. 5600 * 5601 * @remark The address of a given function is not guaranteed to be the same 5602 * between contexts. 5603 * 5604 * @remark This function may return a non-`null` address despite the 5605 * associated version or extension not being available. Always check the 5606 * context version or extension string first. 5607 * 5608 * Pointer_lifetime: The returned function pointer is valid until the context 5609 * is destroyed or the library is terminated. 5610 * 5611 * Thread_Safety: This function may be called from any thread. 5612 * 5613 * @sa @ref context_glext 5614 * @sa @ref glfwExtensionSupported 5615 * 5616 * Since: Added in version 1.0. 5617 * 5618 * Ingroup: context 5619 */ 5620 GLFWglproc glfwGetProcAddress(const(char)* procname); 5621 5622 /** Returns whether the Vulkan loader and an ICD have been found. 5623 * 5624 * This function returns whether the Vulkan loader and any minimally functional 5625 * ICD have been found. 5626 * 5627 * The availability of a Vulkan loader and even an ICD does not by itself 5628 * guarantee that surface creation or even instance creation is possible. 5629 * For example, on Fermi systems Nvidia will install an ICD that provides no 5630 * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check 5631 * whether the extensions necessary for Vulkan surface creation are available 5632 * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue 5633 * family of a physical device supports image presentation. 5634 * 5635 * Returns: `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` 5636 * otherwise. 5637 * 5638 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED. 5639 * 5640 * Thread_Safety: This function may be called from any thread. 5641 * 5642 * @sa @ref vulkan_support 5643 * 5644 * Since: Added in version 3.2. 5645 * 5646 * Ingroup: vulkan 5647 */ 5648 int glfwVulkanSupported(); 5649 5650 /** Returns the Vulkan instance extensions required by GLFW. 5651 * 5652 * This function returns an array of names of Vulkan instance extensions required 5653 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the 5654 * list will always contain `VK_KHR_surface`, so if you don't require any 5655 * additional extensions you can pass this list directly to the 5656 * `VkInstanceCreateInfo` struct. 5657 * 5658 * If Vulkan is not available on the machine, this function returns `null` and 5659 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported 5660 * to check whether Vulkan is at least minimally available. 5661 * 5662 * If Vulkan is available but no set of extensions allowing window surface 5663 * creation was found, this function returns `null`. You may still use Vulkan 5664 * for off-screen rendering and compute work. 5665 * 5666 * Params: 5667 * count = Where to store the number of extensions in the returned 5668 * array. This is set to zero if an error occurred. 5669 * Returns: An array of ASCII encoded extension names, or `null` if an 5670 * [error](@ref error_handling) occurred. 5671 * 5672 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5673 * GLFW_API_UNAVAILABLE. 5674 * 5675 * @remark Additional extensions may be required by future versions of GLFW. 5676 * You should check if any extensions you wish to enable are already in the 5677 * returned array, as it is an error to specify an extension more than once in 5678 * the `VkInstanceCreateInfo` struct. 5679 * 5680 * @remark @macos This function currently supports either the 5681 * `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface` 5682 * extension. 5683 * 5684 * Pointer_lifetime: The returned array is allocated and freed by GLFW. You 5685 * should not free it yourself. It is guaranteed to be valid only until the 5686 * library is terminated. 5687 * 5688 * Thread_Safety: This function may be called from any thread. 5689 * 5690 * @sa @ref vulkan_ext 5691 * @sa @ref glfwCreateWindowSurface 5692 * 5693 * Since: Added in version 3.2. 5694 * 5695 * Ingroup: vulkan 5696 */ 5697 const(char)** glfwGetRequiredInstanceExtensions(uint* count); 5698 5699 version (VK_VERSION_1_0) { 5700 5701 import glfw3.vulkan; 5702 import glfw3.internal; 5703 5704 /** Returns the address of the specified Vulkan instance function. 5705 * 5706 * This function returns the address of the specified Vulkan core or extension 5707 * function for the specified instance. If instance is set to `null` it can 5708 * return any function exported from the Vulkan loader, including at least the 5709 * following functions: 5710 * 5711 * - `vkEnumerateInstanceExtensionProperties` 5712 * - `vkEnumerateInstanceLayerProperties` 5713 * - `vkCreateInstance` 5714 * - `vkGetInstanceProcAddr` 5715 * 5716 * If Vulkan is not available on the machine, this function returns `null` and 5717 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported 5718 * to check whether Vulkan is at least minimally available. 5719 * 5720 * This function is equivalent to calling `vkGetInstanceProcAddr` with 5721 * a platform-specific query of the Vulkan loader as a fallback. 5722 * 5723 * Params: 5724 * instance = The Vulkan instance to query, or `null` to retrieve 5725 * functions related to instance creation. 5726 * procname = The ASCII encoded name of the function. 5727 * Returns: The address of the function, or `null` if an 5728 * [error](@ref error_handling) occurred. 5729 * 5730 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED and @ref 5731 * GLFW_API_UNAVAILABLE. 5732 * 5733 * Pointer_lifetime: The returned function pointer is valid until the library 5734 * is terminated. 5735 * 5736 * Thread_Safety: This function may be called from any thread. 5737 * 5738 * @sa @ref vulkan_proc 5739 * 5740 * Since: Added in version 3.2. 5741 * 5742 * Ingroup: vulkan 5743 */ 5744 GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const(char)* procname); 5745 5746 /** Returns whether the specified queue family can present images. 5747 * 5748 * This function returns whether the specified queue family of the specified 5749 * physical device supports presentation to the platform GLFW was built for. 5750 * 5751 * If Vulkan or the required window surface creation instance extensions are 5752 * not available on the machine, or if the specified instance was not created 5753 * with the required extensions, this function returns `GLFW_FALSE` and 5754 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported 5755 * to check whether Vulkan is at least minimally available and @ref 5756 * glfwGetRequiredInstanceExtensions to check what instance extensions are 5757 * required. 5758 * 5759 * Params: 5760 * instance = The instance that the physical device belongs to. 5761 * device = The physical device that the queue family belongs to. 5762 * queuefamily = The index of the queue family to query. 5763 * Returns: `GLFW_TRUE` if the queue family supports presentation, or 5764 * `GLFW_FALSE` otherwise. 5765 * 5766 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 5767 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. 5768 * 5769 * @remark @macos This function currently always returns `GLFW_TRUE`, as the 5770 * `VK_MVK_macos_surface` extension does not provide 5771 * a `vkGetPhysicalDevice*PresentationSupport` type function. 5772 * 5773 * Thread_Safety: This function may be called from any thread. For 5774 * synchronization details of Vulkan objects, see the Vulkan specification. 5775 * 5776 * @sa @ref vulkan_present 5777 * 5778 * Since: Added in version 3.2. 5779 * 5780 * Ingroup: vulkan 5781 */ 5782 int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint queuefamily); 5783 5784 /** Creates a Vulkan surface for the specified window. 5785 * 5786 * This function creates a Vulkan surface for the specified window. 5787 * 5788 * If the Vulkan loader or at least one minimally functional ICD were not found, 5789 * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref 5790 * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether 5791 * Vulkan is at least minimally available. 5792 * 5793 * If the required window surface creation instance extensions are not 5794 * available or if the specified instance was not created with these extensions 5795 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and 5796 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref 5797 * glfwGetRequiredInstanceExtensions to check what instance extensions are 5798 * required. 5799 * 5800 * The window surface cannot be shared with another API so the window must 5801 * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib) 5802 * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error 5803 * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`. 5804 * 5805 * The window surface must be destroyed before the specified Vulkan instance. 5806 * It is the responsibility of the caller to destroy the window surface. GLFW 5807 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the 5808 * surface. 5809 * 5810 * Params: 5811 * instance = The Vulkan instance to create the surface in. 5812 * window = The window to create the surface for. 5813 * allocator = The allocator to use, or `null` to use the default 5814 * allocator. 5815 * surface = Where to store the handle of the surface. This is set 5816 * to `VK_null_HANDLE` if an error occurred. 5817 * Returns: `VK_SUCCESS` if successful, or a Vulkan error code if an 5818 * [error](@ref error_handling) occurred. 5819 * 5820 * Errors: Possible errors include @ref GLFW_NOT_INITIALIZED, @ref 5821 * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE 5822 * 5823 * @remark If an error occurs before the creation call is made, GLFW returns 5824 * the Vulkan error code most appropriate for the error. Appropriate use of 5825 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should 5826 * eliminate almost all occurrences of these errors. 5827 * 5828 * @remark @macos This function currently only supports the 5829 * `VK_MVK_macos_surface` extension from MoltenVK. 5830 * 5831 * @remark @macos This function creates and sets a `CAMetalLayer` instance for 5832 * the window content view, which is required for MoltenVK to function. 5833 * 5834 * Thread_Safety: This function may be called from any thread. For 5835 * synchronization details of Vulkan objects, see the Vulkan specification. 5836 * 5837 * @sa @ref vulkan_surface 5838 * @sa @ref glfwGetRequiredInstanceExtensions 5839 * 5840 * Since: Added in version 3.2. 5841 * 5842 * Ingroup: vulkan 5843 */ 5844 VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const(VkAllocationCallbacks)* allocator, VkSurfaceKHR* surface); 5845 5846 } /*VK_VERSION_1_0*/