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