/*************************************************************************1* GLFW 3.3 - www.glfw.org2* A library for OpenGL, window and input3*------------------------------------------------------------------------4* Copyright (c) 2002-2006 Marcus Geelnard5* Copyright (c) 2006-2019 Camilla Löwy <[email protected]>6*7* This software is provided 'as-is', without any express or implied8* warranty. In no event will the authors be held liable for any damages9* arising from the use of this software.10*11* Permission is granted to anyone to use this software for any purpose,12* including commercial applications, and to alter it and redistribute it13* freely, subject to the following restrictions:14*15* 1. The origin of this software must not be misrepresented; you must not16* claim that you wrote the original software. If you use this software17* in a product, an acknowledgment in the product documentation would18* be appreciated but is not required.19*20* 2. Altered source versions must be plainly marked as such, and must not21* be misrepresented as being the original software.22*23* 3. This notice may not be removed or altered from any source24* distribution.25*26*************************************************************************/2728#ifndef _glfw3_h_29#define _glfw3_h_3031#ifdef __cplusplus32extern "C" {33#endif343536/*************************************************************************37* Doxygen documentation38*************************************************************************/3940/*! @file glfw3.h41* @brief The header of the GLFW 3 API.42*43* This is the header file of the GLFW 3 API. It defines all its types and44* declares all its functions.45*46* For more information about how to use this file, see @ref build_include.47*/48/*! @defgroup context Context reference49* @brief Functions and types related to OpenGL and OpenGL ES contexts.50*51* This is the reference documentation for OpenGL and OpenGL ES context related52* functions. For more task-oriented information, see the @ref context_guide.53*/54/*! @defgroup vulkan Vulkan support reference55* @brief Functions and types related to Vulkan.56*57* This is the reference documentation for Vulkan related functions and types.58* For more task-oriented information, see the @ref vulkan_guide.59*/60/*! @defgroup init Initialization, version and error reference61* @brief Functions and types related to initialization and error handling.62*63* This is the reference documentation for initialization and termination of64* the library, version management and error handling. For more task-oriented65* information, see the @ref intro_guide.66*/67/*! @defgroup input Input reference68* @brief Functions and types related to input handling.69*70* This is the reference documentation for input related functions and types.71* For more task-oriented information, see the @ref input_guide.72*/73/*! @defgroup monitor Monitor reference74* @brief Functions and types related to monitors.75*76* This is the reference documentation for monitor related functions and types.77* For more task-oriented information, see the @ref monitor_guide.78*/79/*! @defgroup window Window reference80* @brief Functions and types related to windows.81*82* This is the reference documentation for window related functions and types,83* including creation, deletion and event polling. For more task-oriented84* information, see the @ref window_guide.85*/868788/*************************************************************************89* Compiler- and platform-specific preprocessor work90*************************************************************************/9192/* If we are we on Windows, we want a single define for it.93*/94#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))95#define _WIN3296#endif /* _WIN32 */9798/* Include because most Windows GLU headers need wchar_t and99* the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.100* Include it unconditionally to avoid surprising side-effects.101*/102#include <stddef.h>103104/* Include because it is needed by Vulkan and related functions.105* Include it unconditionally to avoid surprising side-effects.106*/107#include <stdint.h>108109#if defined(GLFW_INCLUDE_VULKAN)110#include <vulkan/vulkan.h>111#endif /* Vulkan header */112113/* The Vulkan header may have indirectly included windows.h (because of114* VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it.115*/116117/* It is customary to use APIENTRY for OpenGL function pointer declarations on118* all platforms. Additionally, the Windows OpenGL header needs APIENTRY.119*/120#if !defined(APIENTRY)121#if defined(_WIN32)122#define APIENTRY __stdcall123#else124#define APIENTRY125#endif126#define GLFW_APIENTRY_DEFINED127#endif /* APIENTRY */128129/* Some Windows OpenGL headers need this.130*/131#if !defined(WINGDIAPI) && defined(_WIN32)132#define WINGDIAPI __declspec(dllimport)133#define GLFW_WINGDIAPI_DEFINED134#endif /* WINGDIAPI */135136/* Some Windows GLU headers need this.137*/138#if !defined(CALLBACK) && defined(_WIN32)139#define CALLBACK __stdcall140#define GLFW_CALLBACK_DEFINED141#endif /* CALLBACK */142143/* Include the chosen OpenGL or OpenGL ES headers.144*/145#if defined(GLFW_INCLUDE_ES1)146147#include <GLES/gl.h>148#if defined(GLFW_INCLUDE_GLEXT)149#include <GLES/glext.h>150#endif151152#elif defined(GLFW_INCLUDE_ES2)153154#include <GLES2/gl2.h>155#if defined(GLFW_INCLUDE_GLEXT)156#include <GLES2/gl2ext.h>157#endif158159#elif defined(GLFW_INCLUDE_ES3)160161#include <GLES3/gl3.h>162#if defined(GLFW_INCLUDE_GLEXT)163#include <GLES2/gl2ext.h>164#endif165166#elif defined(GLFW_INCLUDE_ES31)167168#include <GLES3/gl31.h>169#if defined(GLFW_INCLUDE_GLEXT)170#include <GLES2/gl2ext.h>171#endif172173#elif defined(GLFW_INCLUDE_ES32)174175#include <GLES3/gl32.h>176#if defined(GLFW_INCLUDE_GLEXT)177#include <GLES2/gl2ext.h>178#endif179180#elif defined(GLFW_INCLUDE_GLCOREARB)181182#if defined(__APPLE__)183184#include <OpenGL/gl3.h>185#if defined(GLFW_INCLUDE_GLEXT)186#include <OpenGL/gl3ext.h>187#endif /*GLFW_INCLUDE_GLEXT*/188189#else /*__APPLE__*/190191#include <GL/glcorearb.h>192#if defined(GLFW_INCLUDE_GLEXT)193#include <GL/glext.h>194#endif195196#endif /*__APPLE__*/197198#elif defined(GLFW_INCLUDE_GLU)199200#if defined(__APPLE__)201202#if defined(GLFW_INCLUDE_GLU)203#include <OpenGL/glu.h>204#endif205206#else /*__APPLE__*/207208#if defined(GLFW_INCLUDE_GLU)209#include <GL/glu.h>210#endif211212#endif /*__APPLE__*/213214#elif !defined(GLFW_INCLUDE_NONE) && \215!defined(__gl_h_) && \216!defined(__gles1_gl_h_) && \217!defined(__gles2_gl2_h_) && \218!defined(__gles2_gl3_h_) && \219!defined(__gles2_gl31_h_) && \220!defined(__gles2_gl32_h_) && \221!defined(__gl_glcorearb_h_) && \222!defined(__gl2_h_) /*legacy*/ && \223!defined(__gl3_h_) /*legacy*/ && \224!defined(__gl31_h_) /*legacy*/ && \225!defined(__gl32_h_) /*legacy*/ && \226!defined(__glcorearb_h_) /*legacy*/ && \227!defined(__GL_H__) /*non-standard*/ && \228!defined(__gltypes_h_) /*non-standard*/ && \229!defined(__glee_h_) /*non-standard*/230231#if defined(__APPLE__)232233#if !defined(GLFW_INCLUDE_GLEXT)234#define GL_GLEXT_LEGACY235#endif236#include <OpenGL/gl.h>237238#else /*__APPLE__*/239240#include <GL/gl.h>241#if defined(GLFW_INCLUDE_GLEXT)242#include <GL/glext.h>243#endif244245#endif /*__APPLE__*/246247#endif /* OpenGL and OpenGL ES headers */248249#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)250/* GLFW_DLL must be defined by applications that are linking against the DLL251* version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW252* configuration header when compiling the DLL version of the library.253*/254#error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"255#endif256257/* GLFWAPI is used to declare public API functions for export258* from the DLL / shared library / dynamic library.259*/260#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)261/* We are building GLFW as a Win32 DLL */262#define GLFWAPI __declspec(dllexport)263#elif defined(_WIN32) && defined(GLFW_DLL)264/* We are calling a GLFW Win32 DLL */265#define GLFWAPI __declspec(dllimport)266#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)267/* We are building GLFW as a Unix shared library */268#define GLFWAPI __attribute__((visibility("default")))269#else270#define GLFWAPI271#endif272273274/*************************************************************************275* GLFW API tokens276*************************************************************************/277278/*! @name GLFW version macros279* @{ */280/*! @brief The major version number of the GLFW header.281*282* The major version number of the GLFW header. This is incremented when the283* API is changed in non-compatible ways.284* @ingroup init285*/286#define GLFW_VERSION_MAJOR 3287/*! @brief The minor version number of the GLFW header.288*289* The minor version number of the GLFW header. This is incremented when290* features are added to the API but it remains backward-compatible.291* @ingroup init292*/293#define GLFW_VERSION_MINOR 3294/*! @brief The revision number of the GLFW header.295*296* The revision number of the GLFW header. This is incremented when a bug fix297* release is made that does not contain any API changes.298* @ingroup init299*/300#define GLFW_VERSION_REVISION 8301/*! @} */302303/*! @brief One.304*305* This is only semantic sugar for the number 1. You can instead use `1` or306* `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal307* to one.308*309* @ingroup init310*/311#define GLFW_TRUE 1312/*! @brief Zero.313*314* This is only semantic sugar for the number 0. You can instead use `0` or315* `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is316* equal to zero.317*318* @ingroup init319*/320#define GLFW_FALSE 0321322/*! @name Key and button actions323* @{ */324/*! @brief The key or mouse button was released.325*326* The key or mouse button was released.327*328* @ingroup input329*/330#define GLFW_RELEASE 0331/*! @brief The key or mouse button was pressed.332*333* The key or mouse button was pressed.334*335* @ingroup input336*/337#define GLFW_PRESS 1338/*! @brief The key was held down until it repeated.339*340* The key was held down until it repeated.341*342* @ingroup input343*/344#define GLFW_REPEAT 2345/*! @} */346347/*! @defgroup hat_state Joystick hat states348* @brief Joystick hat states.349*350* See [joystick hat input](@ref joystick_hat) for how these are used.351*352* @ingroup input353* @{ */354#define GLFW_HAT_CENTERED 0355#define GLFW_HAT_UP 1356#define GLFW_HAT_RIGHT 2357#define GLFW_HAT_DOWN 4358#define GLFW_HAT_LEFT 8359#define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP)360#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)361#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)362#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)363/*! @} */364365/*! @defgroup keys Keyboard keys366* @brief Keyboard key IDs.367*368* See [key input](@ref input_key) for how these are used.369*370* These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),371* but re-arranged to map to 7-bit ASCII for printable keys (function keys are372* put in the 256+ range).373*374* The naming of the key codes follow these rules:375* - The US keyboard layout is used376* - Names of printable alpha-numeric characters are used (e.g. "A", "R",377* "3", etc.)378* - For non-alphanumeric characters, Unicode:ish names are used (e.g.379* "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not380* correspond to the Unicode standard (usually for brevity)381* - Keys that lack a clear US mapping are named "WORLD_x"382* - For non-printable keys, custom names are used (e.g. "F4",383* "BACKSPACE", etc.)384*385* @ingroup input386* @{387*/388389/* The unknown key */390#define GLFW_KEY_UNKNOWN -1391392/* Printable keys */393#define GLFW_KEY_SPACE 32394#define GLFW_KEY_APOSTROPHE 39 /* ' */395#define GLFW_KEY_COMMA 44 /* , */396#define GLFW_KEY_MINUS 45 /* - */397#define GLFW_KEY_PERIOD 46 /* . */398#define GLFW_KEY_SLASH 47 /* / */399#define GLFW_KEY_0 48400#define GLFW_KEY_1 49401#define GLFW_KEY_2 50402#define GLFW_KEY_3 51403#define GLFW_KEY_4 52404#define GLFW_KEY_5 53405#define GLFW_KEY_6 54406#define GLFW_KEY_7 55407#define GLFW_KEY_8 56408#define GLFW_KEY_9 57409#define GLFW_KEY_SEMICOLON 59 /* ; */410#define GLFW_KEY_EQUAL 61 /* = */411#define GLFW_KEY_A 65412#define GLFW_KEY_B 66413#define GLFW_KEY_C 67414#define GLFW_KEY_D 68415#define GLFW_KEY_E 69416#define GLFW_KEY_F 70417#define GLFW_KEY_G 71418#define GLFW_KEY_H 72419#define GLFW_KEY_I 73420#define GLFW_KEY_J 74421#define GLFW_KEY_K 75422#define GLFW_KEY_L 76423#define GLFW_KEY_M 77424#define GLFW_KEY_N 78425#define GLFW_KEY_O 79426#define GLFW_KEY_P 80427#define GLFW_KEY_Q 81428#define GLFW_KEY_R 82429#define GLFW_KEY_S 83430#define GLFW_KEY_T 84431#define GLFW_KEY_U 85432#define GLFW_KEY_V 86433#define GLFW_KEY_W 87434#define GLFW_KEY_X 88435#define GLFW_KEY_Y 89436#define GLFW_KEY_Z 90437#define GLFW_KEY_LEFT_BRACKET 91 /* [ */438#define GLFW_KEY_BACKSLASH 92 /* \ */439#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */440#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */441#define GLFW_KEY_WORLD_1 161 /* non-US #1 */442#define GLFW_KEY_WORLD_2 162 /* non-US #2 */443444/* Function keys */445#define GLFW_KEY_ESCAPE 256446#define GLFW_KEY_ENTER 257447#define GLFW_KEY_TAB 258448#define GLFW_KEY_BACKSPACE 259449#define GLFW_KEY_INSERT 260450#define GLFW_KEY_DELETE 261451#define GLFW_KEY_RIGHT 262452#define GLFW_KEY_LEFT 263453#define GLFW_KEY_DOWN 264454#define GLFW_KEY_UP 265455#define GLFW_KEY_PAGE_UP 266456#define GLFW_KEY_PAGE_DOWN 267457#define GLFW_KEY_HOME 268458#define GLFW_KEY_END 269459#define GLFW_KEY_CAPS_LOCK 280460#define GLFW_KEY_SCROLL_LOCK 281461#define GLFW_KEY_NUM_LOCK 282462#define GLFW_KEY_PRINT_SCREEN 283463#define GLFW_KEY_PAUSE 284464#define GLFW_KEY_F1 290465#define GLFW_KEY_F2 291466#define GLFW_KEY_F3 292467#define GLFW_KEY_F4 293468#define GLFW_KEY_F5 294469#define GLFW_KEY_F6 295470#define GLFW_KEY_F7 296471#define GLFW_KEY_F8 297472#define GLFW_KEY_F9 298473#define GLFW_KEY_F10 299474#define GLFW_KEY_F11 300475#define GLFW_KEY_F12 301476#define GLFW_KEY_F13 302477#define GLFW_KEY_F14 303478#define GLFW_KEY_F15 304479#define GLFW_KEY_F16 305480#define GLFW_KEY_F17 306481#define GLFW_KEY_F18 307482#define GLFW_KEY_F19 308483#define GLFW_KEY_F20 309484#define GLFW_KEY_F21 310485#define GLFW_KEY_F22 311486#define GLFW_KEY_F23 312487#define GLFW_KEY_F24 313488#define GLFW_KEY_F25 314489#define GLFW_KEY_KP_0 320490#define GLFW_KEY_KP_1 321491#define GLFW_KEY_KP_2 322492#define GLFW_KEY_KP_3 323493#define GLFW_KEY_KP_4 324494#define GLFW_KEY_KP_5 325495#define GLFW_KEY_KP_6 326496#define GLFW_KEY_KP_7 327497#define GLFW_KEY_KP_8 328498#define GLFW_KEY_KP_9 329499#define GLFW_KEY_KP_DECIMAL 330500#define GLFW_KEY_KP_DIVIDE 331501#define GLFW_KEY_KP_MULTIPLY 332502#define GLFW_KEY_KP_SUBTRACT 333503#define GLFW_KEY_KP_ADD 334504#define GLFW_KEY_KP_ENTER 335505#define GLFW_KEY_KP_EQUAL 336506#define GLFW_KEY_LEFT_SHIFT 340507#define GLFW_KEY_LEFT_CONTROL 341508#define GLFW_KEY_LEFT_ALT 342509#define GLFW_KEY_LEFT_SUPER 343510#define GLFW_KEY_RIGHT_SHIFT 344511#define GLFW_KEY_RIGHT_CONTROL 345512#define GLFW_KEY_RIGHT_ALT 346513#define GLFW_KEY_RIGHT_SUPER 347514#define GLFW_KEY_MENU 348515516#define GLFW_KEY_LAST GLFW_KEY_MENU517518/*! @} */519520/*! @defgroup mods Modifier key flags521* @brief Modifier key flags.522*523* See [key input](@ref input_key) for how these are used.524*525* @ingroup input526* @{ */527528/*! @brief If this bit is set one or more Shift keys were held down.529*530* If this bit is set one or more Shift keys were held down.531*/532#define GLFW_MOD_SHIFT 0x0001533/*! @brief If this bit is set one or more Control keys were held down.534*535* If this bit is set one or more Control keys were held down.536*/537#define GLFW_MOD_CONTROL 0x0002538/*! @brief If this bit is set one or more Alt keys were held down.539*540* If this bit is set one or more Alt keys were held down.541*/542#define GLFW_MOD_ALT 0x0004543/*! @brief If this bit is set one or more Super keys were held down.544*545* If this bit is set one or more Super keys were held down.546*/547#define GLFW_MOD_SUPER 0x0008548/*! @brief If this bit is set the Caps Lock key is enabled.549*550* If this bit is set the Caps Lock key is enabled and the @ref551* GLFW_LOCK_KEY_MODS input mode is set.552*/553#define GLFW_MOD_CAPS_LOCK 0x0010554/*! @brief If this bit is set the Num Lock key is enabled.555*556* If this bit is set the Num Lock key is enabled and the @ref557* GLFW_LOCK_KEY_MODS input mode is set.558*/559#define GLFW_MOD_NUM_LOCK 0x0020560561/*! @} */562563/*! @defgroup buttons Mouse buttons564* @brief Mouse button IDs.565*566* See [mouse button input](@ref input_mouse_button) for how these are used.567*568* @ingroup input569* @{ */570#define GLFW_MOUSE_BUTTON_1 0571#define GLFW_MOUSE_BUTTON_2 1572#define GLFW_MOUSE_BUTTON_3 2573#define GLFW_MOUSE_BUTTON_4 3574#define GLFW_MOUSE_BUTTON_5 4575#define GLFW_MOUSE_BUTTON_6 5576#define GLFW_MOUSE_BUTTON_7 6577#define GLFW_MOUSE_BUTTON_8 7578#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8579#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1580#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2581#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3582/*! @} */583584/*! @defgroup joysticks Joysticks585* @brief Joystick IDs.586*587* See [joystick input](@ref joystick) for how these are used.588*589* @ingroup input590* @{ */591#define GLFW_JOYSTICK_1 0592#define GLFW_JOYSTICK_2 1593#define GLFW_JOYSTICK_3 2594#define GLFW_JOYSTICK_4 3595#define GLFW_JOYSTICK_5 4596#define GLFW_JOYSTICK_6 5597#define GLFW_JOYSTICK_7 6598#define GLFW_JOYSTICK_8 7599#define GLFW_JOYSTICK_9 8600#define GLFW_JOYSTICK_10 9601#define GLFW_JOYSTICK_11 10602#define GLFW_JOYSTICK_12 11603#define GLFW_JOYSTICK_13 12604#define GLFW_JOYSTICK_14 13605#define GLFW_JOYSTICK_15 14606#define GLFW_JOYSTICK_16 15607#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16608/*! @} */609610/*! @defgroup gamepad_buttons Gamepad buttons611* @brief Gamepad buttons.612*613* See @ref gamepad for how these are used.614*615* @ingroup input616* @{ */617#define GLFW_GAMEPAD_BUTTON_A 0618#define GLFW_GAMEPAD_BUTTON_B 1619#define GLFW_GAMEPAD_BUTTON_X 2620#define GLFW_GAMEPAD_BUTTON_Y 3621#define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4622#define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5623#define GLFW_GAMEPAD_BUTTON_BACK 6624#define GLFW_GAMEPAD_BUTTON_START 7625#define GLFW_GAMEPAD_BUTTON_GUIDE 8626#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9627#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10628#define GLFW_GAMEPAD_BUTTON_DPAD_UP 11629#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12630#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13631#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14632#define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT633634#define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A635#define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B636#define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X637#define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y638/*! @} */639640/*! @defgroup gamepad_axes Gamepad axes641* @brief Gamepad axes.642*643* See @ref gamepad for how these are used.644*645* @ingroup input646* @{ */647#define GLFW_GAMEPAD_AXIS_LEFT_X 0648#define GLFW_GAMEPAD_AXIS_LEFT_Y 1649#define GLFW_GAMEPAD_AXIS_RIGHT_X 2650#define GLFW_GAMEPAD_AXIS_RIGHT_Y 3651#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4652#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5653#define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER654/*! @} */655656/*! @defgroup errors Error codes657* @brief Error codes.658*659* See [error handling](@ref error_handling) for how these are used.660*661* @ingroup init662* @{ */663/*! @brief No error has occurred.664*665* No error has occurred.666*667* @analysis Yay.668*/669#define GLFW_NO_ERROR 0670/*! @brief GLFW has not been initialized.671*672* This occurs if a GLFW function was called that must not be called unless the673* library is [initialized](@ref intro_init).674*675* @analysis Application programmer error. Initialize GLFW before calling any676* function that requires initialization.677*/678#define GLFW_NOT_INITIALIZED 0x00010001679/*! @brief No context is current for this thread.680*681* This occurs if a GLFW function was called that needs and operates on the682* current OpenGL or OpenGL ES context but no context is current on the calling683* thread. One such function is @ref glfwSwapInterval.684*685* @analysis Application programmer error. Ensure a context is current before686* calling functions that require a current context.687*/688#define GLFW_NO_CURRENT_CONTEXT 0x00010002689/*! @brief One of the arguments to the function was an invalid enum value.690*691* One of the arguments to the function was an invalid enum value, for example692* requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.693*694* @analysis Application programmer error. Fix the offending call.695*/696#define GLFW_INVALID_ENUM 0x00010003697/*! @brief One of the arguments to the function was an invalid value.698*699* One of the arguments to the function was an invalid value, for example700* requesting a non-existent OpenGL or OpenGL ES version like 2.7.701*702* Requesting a valid but unavailable OpenGL or OpenGL ES version will instead703* result in a @ref GLFW_VERSION_UNAVAILABLE error.704*705* @analysis Application programmer error. Fix the offending call.706*/707#define GLFW_INVALID_VALUE 0x00010004708/*! @brief A memory allocation failed.709*710* A memory allocation failed.711*712* @analysis A bug in GLFW or the underlying operating system. Report the bug713* to our [issue tracker](https://github.com/glfw/glfw/issues).714*/715#define GLFW_OUT_OF_MEMORY 0x00010005716/*! @brief GLFW could not find support for the requested API on the system.717*718* GLFW could not find support for the requested API on the system.719*720* @analysis The installed graphics driver does not support the requested721* API, or does not support it via the chosen context creation backend.722* Below are a few examples.723*724* @par725* Some pre-installed Windows graphics drivers do not support OpenGL. AMD only726* supports OpenGL ES via EGL, while Nvidia and Intel only support it via727* a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa728* EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary729* driver. Older graphics drivers do not support Vulkan.730*/731#define GLFW_API_UNAVAILABLE 0x00010006732/*! @brief The requested OpenGL or OpenGL ES version is not available.733*734* The requested OpenGL or OpenGL ES version (including any requested context735* or framebuffer hints) is not available on this machine.736*737* @analysis The machine does not support your requirements. If your738* application is sufficiently flexible, downgrade your requirements and try739* again. Otherwise, inform the user that their machine does not match your740* requirements.741*742* @par743* Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0744* comes out before the 4.x series gets that far, also fail with this error and745* not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions746* will exist.747*/748#define GLFW_VERSION_UNAVAILABLE 0x00010007749/*! @brief A platform-specific error occurred that does not match any of the750* more specific categories.751*752* A platform-specific error occurred that does not match any of the more753* specific categories.754*755* @analysis A bug or configuration error in GLFW, the underlying operating756* system or its drivers, or a lack of required resources. Report the issue to757* our [issue tracker](https://github.com/glfw/glfw/issues).758*/759#define GLFW_PLATFORM_ERROR 0x00010008760/*! @brief The requested format is not supported or available.761*762* If emitted during window creation, the requested pixel format is not763* supported.764*765* If emitted when querying the clipboard, the contents of the clipboard could766* not be converted to the requested format.767*768* @analysis If emitted during window creation, one or more769* [hard constraints](@ref window_hints_hard) did not match any of the770* available pixel formats. If your application is sufficiently flexible,771* downgrade your requirements and try again. Otherwise, inform the user that772* their machine does not match your requirements.773*774* @par775* If emitted when querying the clipboard, ignore the error or report it to776* the user, as appropriate.777*/778#define GLFW_FORMAT_UNAVAILABLE 0x00010009779/*! @brief The specified window does not have an OpenGL or OpenGL ES context.780*781* A window that does not have an OpenGL or OpenGL ES context was passed to782* a function that requires it to have one.783*784* @analysis Application programmer error. Fix the offending call.785*/786#define GLFW_NO_WINDOW_CONTEXT 0x0001000A787/*! @} */788789/*! @addtogroup window790* @{ */791/*! @brief Input focus window hint and attribute792*793* Input focus [window hint](@ref GLFW_FOCUSED_hint) or794* [window attribute](@ref GLFW_FOCUSED_attrib).795*/796#define GLFW_FOCUSED 0x00020001797/*! @brief Window iconification window attribute798*799* Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).800*/801#define GLFW_ICONIFIED 0x00020002802/*! @brief Window resize-ability window hint and attribute803*804* Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and805* [window attribute](@ref GLFW_RESIZABLE_attrib).806*/807#define GLFW_RESIZABLE 0x00020003808/*! @brief Window visibility window hint and attribute809*810* Window visibility [window hint](@ref GLFW_VISIBLE_hint) and811* [window attribute](@ref GLFW_VISIBLE_attrib).812*/813#define GLFW_VISIBLE 0x00020004814/*! @brief Window decoration window hint and attribute815*816* Window decoration [window hint](@ref GLFW_DECORATED_hint) and817* [window attribute](@ref GLFW_DECORATED_attrib).818*/819#define GLFW_DECORATED 0x00020005820/*! @brief Window auto-iconification window hint and attribute821*822* Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and823* [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).824*/825#define GLFW_AUTO_ICONIFY 0x00020006826/*! @brief Window decoration window hint and attribute827*828* Window decoration [window hint](@ref GLFW_FLOATING_hint) and829* [window attribute](@ref GLFW_FLOATING_attrib).830*/831#define GLFW_FLOATING 0x00020007832/*! @brief Window maximization window hint and attribute833*834* Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and835* [window attribute](@ref GLFW_MAXIMIZED_attrib).836*/837#define GLFW_MAXIMIZED 0x00020008838/*! @brief Cursor centering window hint839*840* Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).841*/842#define GLFW_CENTER_CURSOR 0x00020009843/*! @brief Window framebuffer transparency hint and attribute844*845* Window framebuffer transparency846* [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and847* [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib).848*/849#define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A850/*! @brief Mouse cursor hover window attribute.851*852* Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib).853*/854#define GLFW_HOVERED 0x0002000B855/*! @brief Input focus on calling show window hint and attribute856*857* Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or858* [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib).859*/860#define GLFW_FOCUS_ON_SHOW 0x0002000C861862/*! @brief Framebuffer bit depth hint.863*864* Framebuffer bit depth [hint](@ref GLFW_RED_BITS).865*/866#define GLFW_RED_BITS 0x00021001867/*! @brief Framebuffer bit depth hint.868*869* Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).870*/871#define GLFW_GREEN_BITS 0x00021002872/*! @brief Framebuffer bit depth hint.873*874* Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).875*/876#define GLFW_BLUE_BITS 0x00021003877/*! @brief Framebuffer bit depth hint.878*879* Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).880*/881#define GLFW_ALPHA_BITS 0x00021004882/*! @brief Framebuffer bit depth hint.883*884* Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).885*/886#define GLFW_DEPTH_BITS 0x00021005887/*! @brief Framebuffer bit depth hint.888*889* Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).890*/891#define GLFW_STENCIL_BITS 0x00021006892/*! @brief Framebuffer bit depth hint.893*894* Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).895*/896#define GLFW_ACCUM_RED_BITS 0x00021007897/*! @brief Framebuffer bit depth hint.898*899* Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).900*/901#define GLFW_ACCUM_GREEN_BITS 0x00021008902/*! @brief Framebuffer bit depth hint.903*904* Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).905*/906#define GLFW_ACCUM_BLUE_BITS 0x00021009907/*! @brief Framebuffer bit depth hint.908*909* Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).910*/911#define GLFW_ACCUM_ALPHA_BITS 0x0002100A912/*! @brief Framebuffer auxiliary buffer hint.913*914* Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).915*/916#define GLFW_AUX_BUFFERS 0x0002100B917/*! @brief OpenGL stereoscopic rendering hint.918*919* OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).920*/921#define GLFW_STEREO 0x0002100C922/*! @brief Framebuffer MSAA samples hint.923*924* Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).925*/926#define GLFW_SAMPLES 0x0002100D927/*! @brief Framebuffer sRGB hint.928*929* Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).930*/931#define GLFW_SRGB_CAPABLE 0x0002100E932/*! @brief Monitor refresh rate hint.933*934* Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).935*/936#define GLFW_REFRESH_RATE 0x0002100F937/*! @brief Framebuffer double buffering hint.938*939* Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).940*/941#define GLFW_DOUBLEBUFFER 0x00021010942943/*! @brief Context client API hint and attribute.944*945* Context client API [hint](@ref GLFW_CLIENT_API_hint) and946* [attribute](@ref GLFW_CLIENT_API_attrib).947*/948#define GLFW_CLIENT_API 0x00022001949/*! @brief Context client API major version hint and attribute.950*951* Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint)952* and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib).953*/954#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002955/*! @brief Context client API minor version hint and attribute.956*957* Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint)958* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).959*/960#define GLFW_CONTEXT_VERSION_MINOR 0x00022003961/*! @brief Context client API revision number attribute.962*963* Context client API revision number964* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).965*/966#define GLFW_CONTEXT_REVISION 0x00022004967/*! @brief Context robustness hint and attribute.968*969* Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint)970* and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib).971*/972#define GLFW_CONTEXT_ROBUSTNESS 0x00022005973/*! @brief OpenGL forward-compatibility hint and attribute.974*975* OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint)976* and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).977*/978#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006979/*! @brief Debug mode context hint and attribute.980*981* Debug mode context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and982* [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).983*/984#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007985/*! @brief OpenGL profile hint and attribute.986*987* OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and988* [attribute](@ref GLFW_OPENGL_PROFILE_attrib).989*/990#define GLFW_OPENGL_PROFILE 0x00022008991/*! @brief Context flush-on-release hint and attribute.992*993* Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and994* [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib).995*/996#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009997/*! @brief Context error suppression hint and attribute.998*999* Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and1000* [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib).1001*/1002#define GLFW_CONTEXT_NO_ERROR 0x0002200A1003/*! @brief Context creation API hint and attribute.1004*1005* Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and1006* [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib).1007*/1008#define GLFW_CONTEXT_CREATION_API 0x0002200B1009/*! @brief Window content area scaling window1010* [window hint](@ref GLFW_SCALE_TO_MONITOR).1011*/1012#define GLFW_SCALE_TO_MONITOR 0x0002200C1013/*! @brief macOS specific1014* [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).1015*/1016#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x000230011017/*! @brief macOS specific1018* [window hint](@ref GLFW_COCOA_FRAME_NAME_hint).1019*/1020#define GLFW_COCOA_FRAME_NAME 0x000230021021/*! @brief macOS specific1022* [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint).1023*/1024#define GLFW_COCOA_GRAPHICS_SWITCHING 0x000230031025/*! @brief X11 specific1026* [window hint](@ref GLFW_X11_CLASS_NAME_hint).1027*/1028#define GLFW_X11_CLASS_NAME 0x000240011029/*! @brief X11 specific1030* [window hint](@ref GLFW_X11_CLASS_NAME_hint).1031*/1032#define GLFW_X11_INSTANCE_NAME 0x000240021033/*! @} */10341035#define GLFW_NO_API 01036#define GLFW_OPENGL_API 0x000300011037#define GLFW_OPENGL_ES_API 0x0003000210381039#define GLFW_NO_ROBUSTNESS 01040#define GLFW_NO_RESET_NOTIFICATION 0x000310011041#define GLFW_LOSE_CONTEXT_ON_RESET 0x0003100210421043#define GLFW_OPENGL_ANY_PROFILE 01044#define GLFW_OPENGL_CORE_PROFILE 0x000320011045#define GLFW_OPENGL_COMPAT_PROFILE 0x0003200210461047#define GLFW_CURSOR 0x000330011048#define GLFW_STICKY_KEYS 0x000330021049#define GLFW_STICKY_MOUSE_BUTTONS 0x000330031050#define GLFW_LOCK_KEY_MODS 0x000330041051#define GLFW_RAW_MOUSE_MOTION 0x0003300510521053#define GLFW_CURSOR_NORMAL 0x000340011054#define GLFW_CURSOR_HIDDEN 0x000340021055#define GLFW_CURSOR_DISABLED 0x0003400310561057#define GLFW_ANY_RELEASE_BEHAVIOR 01058#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x000350011059#define GLFW_RELEASE_BEHAVIOR_NONE 0x0003500210601061#define GLFW_NATIVE_CONTEXT_API 0x000360011062#define GLFW_EGL_CONTEXT_API 0x000360021063#define GLFW_OSMESA_CONTEXT_API 0x0003600310641065/*! @defgroup shapes Standard cursor shapes1066* @brief Standard system cursor shapes.1067*1068* See [standard cursor creation](@ref cursor_standard) for how these are used.1069*1070* @ingroup input1071* @{ */10721073/*! @brief The regular arrow cursor shape.1074*1075* The regular arrow cursor.1076*/1077#define GLFW_ARROW_CURSOR 0x000360011078/*! @brief The text input I-beam cursor shape.1079*1080* The text input I-beam cursor shape.1081*/1082#define GLFW_IBEAM_CURSOR 0x000360021083/*! @brief The crosshair shape.1084*1085* The crosshair shape.1086*/1087#define GLFW_CROSSHAIR_CURSOR 0x000360031088/*! @brief The hand shape.1089*1090* The hand shape.1091*/1092#define GLFW_HAND_CURSOR 0x000360041093/*! @brief The horizontal resize arrow shape.1094*1095* The horizontal resize arrow shape.1096*/1097#define GLFW_HRESIZE_CURSOR 0x000360051098/*! @brief The vertical resize arrow shape.1099*1100* The vertical resize arrow shape.1101*/1102#define GLFW_VRESIZE_CURSOR 0x000360061103/*! @} */11041105#define GLFW_CONNECTED 0x000400011106#define GLFW_DISCONNECTED 0x0004000211071108/*! @addtogroup init1109* @{ */1110/*! @brief Joystick hat buttons init hint.1111*1112* Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS).1113*/1114#define GLFW_JOYSTICK_HAT_BUTTONS 0x000500011115/*! @brief macOS specific init hint.1116*1117* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).1118*/1119#define GLFW_COCOA_CHDIR_RESOURCES 0x000510011120/*! @brief macOS specific init hint.1121*1122* macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).1123*/1124#define GLFW_COCOA_MENUBAR 0x000510021125/*! @} */11261127#define GLFW_DONT_CARE -1112811291130/*************************************************************************1131* GLFW API types1132*************************************************************************/11331134/*! @brief Client API function pointer type.1135*1136* Generic function pointer used for returning client API function pointers1137* without forcing a cast from a regular pointer.1138*1139* @sa @ref context_glext1140* @sa @ref glfwGetProcAddress1141*1142* @since Added in version 3.0.1143*1144* @ingroup context1145*/1146typedef void (*GLFWglproc)(void);11471148/*! @brief Vulkan API function pointer type.1149*1150* Generic function pointer used for returning Vulkan API function pointers1151* without forcing a cast from a regular pointer.1152*1153* @sa @ref vulkan_proc1154* @sa @ref glfwGetInstanceProcAddress1155*1156* @since Added in version 3.2.1157*1158* @ingroup vulkan1159*/1160typedef void (*GLFWvkproc)(void);11611162/*! @brief Opaque monitor object.1163*1164* Opaque monitor object.1165*1166* @see @ref monitor_object1167*1168* @since Added in version 3.0.1169*1170* @ingroup monitor1171*/1172typedef struct GLFWmonitor GLFWmonitor;11731174/*! @brief Opaque window object.1175*1176* Opaque window object.1177*1178* @see @ref window_object1179*1180* @since Added in version 3.0.1181*1182* @ingroup window1183*/1184typedef struct GLFWwindow GLFWwindow;11851186/*! @brief Opaque cursor object.1187*1188* Opaque cursor object.1189*1190* @see @ref cursor_object1191*1192* @since Added in version 3.1.1193*1194* @ingroup input1195*/1196typedef struct GLFWcursor GLFWcursor;11971198/*! @brief The function pointer type for error callbacks.1199*1200* This is the function pointer type for error callbacks. An error callback1201* function has the following signature:1202* @code1203* void callback_name(int error_code, const char* description)1204* @endcode1205*1206* @param[in] error_code An [error code](@ref errors). Future releases may add1207* more error codes.1208* @param[in] description A UTF-8 encoded string describing the error.1209*1210* @pointer_lifetime The error description string is valid until the callback1211* function returns.1212*1213* @sa @ref error_handling1214* @sa @ref glfwSetErrorCallback1215*1216* @since Added in version 3.0.1217*1218* @ingroup init1219*/1220typedef void (* GLFWerrorfun)(int error_code, const char* description);12211222/*! @brief The function pointer type for window position callbacks.1223*1224* This is the function pointer type for window position callbacks. A window1225* position callback function has the following signature:1226* @code1227* void callback_name(GLFWwindow* window, int xpos, int ypos)1228* @endcode1229*1230* @param[in] window The window that was moved.1231* @param[in] xpos The new x-coordinate, in screen coordinates, of the1232* upper-left corner of the content area of the window.1233* @param[in] ypos The new y-coordinate, in screen coordinates, of the1234* upper-left corner of the content area of the window.1235*1236* @sa @ref window_pos1237* @sa @ref glfwSetWindowPosCallback1238*1239* @since Added in version 3.0.1240*1241* @ingroup window1242*/1243typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);12441245/*! @brief The function pointer type for window size callbacks.1246*1247* This is the function pointer type for window size callbacks. A window size1248* callback function has the following signature:1249* @code1250* void callback_name(GLFWwindow* window, int width, int height)1251* @endcode1252*1253* @param[in] window The window that was resized.1254* @param[in] width The new width, in screen coordinates, of the window.1255* @param[in] height The new height, in screen coordinates, of the window.1256*1257* @sa @ref window_size1258* @sa @ref glfwSetWindowSizeCallback1259*1260* @since Added in version 1.0.1261* @glfw3 Added window handle parameter.1262*1263* @ingroup window1264*/1265typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);12661267/*! @brief The function pointer type for window close callbacks.1268*1269* This is the function pointer type for window close callbacks. A window1270* close callback function has the following signature:1271* @code1272* void function_name(GLFWwindow* window)1273* @endcode1274*1275* @param[in] window The window that the user attempted to close.1276*1277* @sa @ref window_close1278* @sa @ref glfwSetWindowCloseCallback1279*1280* @since Added in version 2.5.1281* @glfw3 Added window handle parameter.1282*1283* @ingroup window1284*/1285typedef void (* GLFWwindowclosefun)(GLFWwindow* window);12861287/*! @brief The function pointer type for window content refresh callbacks.1288*1289* This is the function pointer type for window content refresh callbacks.1290* A window content refresh callback function has the following signature:1291* @code1292* void function_name(GLFWwindow* window);1293* @endcode1294*1295* @param[in] window The window whose content needs to be refreshed.1296*1297* @sa @ref window_refresh1298* @sa @ref glfwSetWindowRefreshCallback1299*1300* @since Added in version 2.5.1301* @glfw3 Added window handle parameter.1302*1303* @ingroup window1304*/1305typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window);13061307/*! @brief The function pointer type for window focus callbacks.1308*1309* This is the function pointer type for window focus callbacks. A window1310* focus callback function has the following signature:1311* @code1312* void function_name(GLFWwindow* window, int focused)1313* @endcode1314*1315* @param[in] window The window that gained or lost input focus.1316* @param[in] focused `GLFW_TRUE` if the window was given input focus, or1317* `GLFW_FALSE` if it lost it.1318*1319* @sa @ref window_focus1320* @sa @ref glfwSetWindowFocusCallback1321*1322* @since Added in version 3.0.1323*1324* @ingroup window1325*/1326typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused);13271328/*! @brief The function pointer type for window iconify callbacks.1329*1330* This is the function pointer type for window iconify callbacks. A window1331* iconify callback function has the following signature:1332* @code1333* void function_name(GLFWwindow* window, int iconified)1334* @endcode1335*1336* @param[in] window The window that was iconified or restored.1337* @param[in] iconified `GLFW_TRUE` if the window was iconified, or1338* `GLFW_FALSE` if it was restored.1339*1340* @sa @ref window_iconify1341* @sa @ref glfwSetWindowIconifyCallback1342*1343* @since Added in version 3.0.1344*1345* @ingroup window1346*/1347typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);13481349/*! @brief The function pointer type for window maximize callbacks.1350*1351* This is the function pointer type for window maximize callbacks. A window1352* maximize callback function has the following signature:1353* @code1354* void function_name(GLFWwindow* window, int maximized)1355* @endcode1356*1357* @param[in] window The window that was maximized or restored.1358* @param[in] maximized `GLFW_TRUE` if the window was maximized, or1359* `GLFW_FALSE` if it was restored.1360*1361* @sa @ref window_maximize1362* @sa glfwSetWindowMaximizeCallback1363*1364* @since Added in version 3.3.1365*1366* @ingroup window1367*/1368typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized);13691370/*! @brief The function pointer type for framebuffer size callbacks.1371*1372* This is the function pointer type for framebuffer size callbacks.1373* A framebuffer size callback function has the following signature:1374* @code1375* void function_name(GLFWwindow* window, int width, int height)1376* @endcode1377*1378* @param[in] window The window whose framebuffer was resized.1379* @param[in] width The new width, in pixels, of the framebuffer.1380* @param[in] height The new height, in pixels, of the framebuffer.1381*1382* @sa @ref window_fbsize1383* @sa @ref glfwSetFramebufferSizeCallback1384*1385* @since Added in version 3.0.1386*1387* @ingroup window1388*/1389typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height);13901391/*! @brief The function pointer type for window content scale callbacks.1392*1393* This is the function pointer type for window content scale callbacks.1394* A window content scale callback function has the following signature:1395* @code1396* void function_name(GLFWwindow* window, float xscale, float yscale)1397* @endcode1398*1399* @param[in] window The window whose content scale changed.1400* @param[in] xscale The new x-axis content scale of the window.1401* @param[in] yscale The new y-axis content scale of the window.1402*1403* @sa @ref window_scale1404* @sa @ref glfwSetWindowContentScaleCallback1405*1406* @since Added in version 3.3.1407*1408* @ingroup window1409*/1410typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale);14111412/*! @brief The function pointer type for mouse button callbacks.1413*1414* This is the function pointer type for mouse button callback functions.1415* A mouse button callback function has the following signature:1416* @code1417* void function_name(GLFWwindow* window, int button, int action, int mods)1418* @endcode1419*1420* @param[in] window The window that received the event.1421* @param[in] button The [mouse button](@ref buttons) that was pressed or1422* released.1423* @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. Future releases1424* may add more actions.1425* @param[in] mods Bit field describing which [modifier keys](@ref mods) were1426* held down.1427*1428* @sa @ref input_mouse_button1429* @sa @ref glfwSetMouseButtonCallback1430*1431* @since Added in version 1.0.1432* @glfw3 Added window handle and modifier mask parameters.1433*1434* @ingroup input1435*/1436typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods);14371438/*! @brief The function pointer type for cursor position callbacks.1439*1440* This is the function pointer type for cursor position callbacks. A cursor1441* position callback function has the following signature:1442* @code1443* void function_name(GLFWwindow* window, double xpos, double ypos);1444* @endcode1445*1446* @param[in] window The window that received the event.1447* @param[in] xpos The new cursor x-coordinate, relative to the left edge of1448* the content area.1449* @param[in] ypos The new cursor y-coordinate, relative to the top edge of the1450* content area.1451*1452* @sa @ref cursor_pos1453* @sa @ref glfwSetCursorPosCallback1454*1455* @since Added in version 3.0. Replaces `GLFWmouseposfun`.1456*1457* @ingroup input1458*/1459typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos);14601461/*! @brief The function pointer type for cursor enter/leave callbacks.1462*1463* This is the function pointer type for cursor enter/leave callbacks.1464* A cursor enter/leave callback function has the following signature:1465* @code1466* void function_name(GLFWwindow* window, int entered)1467* @endcode1468*1469* @param[in] window The window that received the event.1470* @param[in] entered `GLFW_TRUE` if the cursor entered the window's content1471* area, or `GLFW_FALSE` if it left it.1472*1473* @sa @ref cursor_enter1474* @sa @ref glfwSetCursorEnterCallback1475*1476* @since Added in version 3.0.1477*1478* @ingroup input1479*/1480typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);14811482/*! @brief The function pointer type for scroll callbacks.1483*1484* This is the function pointer type for scroll callbacks. A scroll callback1485* function has the following signature:1486* @code1487* void function_name(GLFWwindow* window, double xoffset, double yoffset)1488* @endcode1489*1490* @param[in] window The window that received the event.1491* @param[in] xoffset The scroll offset along the x-axis.1492* @param[in] yoffset The scroll offset along the y-axis.1493*1494* @sa @ref scrolling1495* @sa @ref glfwSetScrollCallback1496*1497* @since Added in version 3.0. Replaces `GLFWmousewheelfun`.1498*1499* @ingroup input1500*/1501typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset);15021503/*! @brief The function pointer type for keyboard key callbacks.1504*1505* This is the function pointer type for keyboard key callbacks. A keyboard1506* key callback function has the following signature:1507* @code1508* void function_name(GLFWwindow* window, int key, int scancode, int action, int mods)1509* @endcode1510*1511* @param[in] window The window that received the event.1512* @param[in] key The [keyboard key](@ref keys) that was pressed or released.1513* @param[in] scancode The system-specific scancode of the key.1514* @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. Future1515* releases may add more actions.1516* @param[in] mods Bit field describing which [modifier keys](@ref mods) were1517* held down.1518*1519* @sa @ref input_key1520* @sa @ref glfwSetKeyCallback1521*1522* @since Added in version 1.0.1523* @glfw3 Added window handle, scancode and modifier mask parameters.1524*1525* @ingroup input1526*/1527typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods);15281529/*! @brief The function pointer type for Unicode character callbacks.1530*1531* This is the function pointer type for Unicode character callbacks.1532* A Unicode character callback function has the following signature:1533* @code1534* void function_name(GLFWwindow* window, unsigned int codepoint)1535* @endcode1536*1537* @param[in] window The window that received the event.1538* @param[in] codepoint The Unicode code point of the character.1539*1540* @sa @ref input_char1541* @sa @ref glfwSetCharCallback1542*1543* @since Added in version 2.4.1544* @glfw3 Added window handle parameter.1545*1546* @ingroup input1547*/1548typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint);15491550/*! @brief The function pointer type for Unicode character with modifiers1551* callbacks.1552*1553* This is the function pointer type for Unicode character with modifiers1554* callbacks. It is called for each input character, regardless of what1555* modifier keys are held down. A Unicode character with modifiers callback1556* function has the following signature:1557* @code1558* void function_name(GLFWwindow* window, unsigned int codepoint, int mods)1559* @endcode1560*1561* @param[in] window The window that received the event.1562* @param[in] codepoint The Unicode code point of the character.1563* @param[in] mods Bit field describing which [modifier keys](@ref mods) were1564* held down.1565*1566* @sa @ref input_char1567* @sa @ref glfwSetCharModsCallback1568*1569* @deprecated Scheduled for removal in version 4.0.1570*1571* @since Added in version 3.1.1572*1573* @ingroup input1574*/1575typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods);15761577/*! @brief The function pointer type for path drop callbacks.1578*1579* This is the function pointer type for path drop callbacks. A path drop1580* callback function has the following signature:1581* @code1582* void function_name(GLFWwindow* window, int path_count, const char* paths[])1583* @endcode1584*1585* @param[in] window The window that received the event.1586* @param[in] path_count The number of dropped paths.1587* @param[in] paths The UTF-8 encoded file and/or directory path names.1588*1589* @pointer_lifetime The path array and its strings are valid until the1590* callback function returns.1591*1592* @sa @ref path_drop1593* @sa @ref glfwSetDropCallback1594*1595* @since Added in version 3.1.1596*1597* @ingroup input1598*/1599typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]);16001601/*! @brief The function pointer type for monitor configuration callbacks.1602*1603* This is the function pointer type for monitor configuration callbacks.1604* A monitor callback function has the following signature:1605* @code1606* void function_name(GLFWmonitor* monitor, int event)1607* @endcode1608*1609* @param[in] monitor The monitor that was connected or disconnected.1610* @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future1611* releases may add more events.1612*1613* @sa @ref monitor_event1614* @sa @ref glfwSetMonitorCallback1615*1616* @since Added in version 3.0.1617*1618* @ingroup monitor1619*/1620typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event);16211622/*! @brief The function pointer type for joystick configuration callbacks.1623*1624* This is the function pointer type for joystick configuration callbacks.1625* A joystick configuration callback function has the following signature:1626* @code1627* void function_name(int jid, int event)1628* @endcode1629*1630* @param[in] jid The joystick that was connected or disconnected.1631* @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future1632* releases may add more events.1633*1634* @sa @ref joystick_event1635* @sa @ref glfwSetJoystickCallback1636*1637* @since Added in version 3.2.1638*1639* @ingroup input1640*/1641typedef void (* GLFWjoystickfun)(int jid, int event);16421643/*! @brief Video mode type.1644*1645* This describes a single video mode.1646*1647* @sa @ref monitor_modes1648* @sa @ref glfwGetVideoMode1649* @sa @ref glfwGetVideoModes1650*1651* @since Added in version 1.0.1652* @glfw3 Added refresh rate member.1653*1654* @ingroup monitor1655*/1656typedef struct GLFWvidmode1657{1658/*! The width, in screen coordinates, of the video mode.1659*/1660int width;1661/*! The height, in screen coordinates, of the video mode.1662*/1663int height;1664/*! The bit depth of the red channel of the video mode.1665*/1666int redBits;1667/*! The bit depth of the green channel of the video mode.1668*/1669int greenBits;1670/*! The bit depth of the blue channel of the video mode.1671*/1672int blueBits;1673/*! The refresh rate, in Hz, of the video mode.1674*/1675int refreshRate;1676} GLFWvidmode;16771678/*! @brief Gamma ramp.1679*1680* This describes the gamma ramp for a monitor.1681*1682* @sa @ref monitor_gamma1683* @sa @ref glfwGetGammaRamp1684* @sa @ref glfwSetGammaRamp1685*1686* @since Added in version 3.0.1687*1688* @ingroup monitor1689*/1690typedef struct GLFWgammaramp1691{1692/*! An array of value describing the response of the red channel.1693*/1694unsigned short* red;1695/*! An array of value describing the response of the green channel.1696*/1697unsigned short* green;1698/*! An array of value describing the response of the blue channel.1699*/1700unsigned short* blue;1701/*! The number of elements in each array.1702*/1703unsigned int size;1704} GLFWgammaramp;17051706/*! @brief Image data.1707*1708* This describes a single 2D image. See the documentation for each related1709* function what the expected pixel format is.1710*1711* @sa @ref cursor_custom1712* @sa @ref window_icon1713*1714* @since Added in version 2.1.1715* @glfw3 Removed format and bytes-per-pixel members.1716*1717* @ingroup window1718*/1719typedef struct GLFWimage1720{1721/*! The width, in pixels, of this image.1722*/1723int width;1724/*! The height, in pixels, of this image.1725*/1726int height;1727/*! The pixel data of this image, arranged left-to-right, top-to-bottom.1728*/1729unsigned char* pixels;1730} GLFWimage;17311732/*! @brief Gamepad input state1733*1734* This describes the input state of a gamepad.1735*1736* @sa @ref gamepad1737* @sa @ref glfwGetGamepadState1738*1739* @since Added in version 3.3.1740*1741* @ingroup input1742*/1743typedef struct GLFWgamepadstate1744{1745/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`1746* or `GLFW_RELEASE`.1747*/1748unsigned char buttons[15];1749/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.01750* to 1.0 inclusive.1751*/1752float axes[6];1753} GLFWgamepadstate;175417551756/*************************************************************************1757* GLFW API functions1758*************************************************************************/17591760/*! @brief Initializes the GLFW library.1761*1762* This function initializes the GLFW library. Before most GLFW functions can1763* be used, GLFW must be initialized, and before an application terminates GLFW1764* should be terminated in order to free any resources allocated during or1765* after initialization.1766*1767* If this function fails, it calls @ref glfwTerminate before returning. If it1768* succeeds, you should call @ref glfwTerminate before the application exits.1769*1770* Additional calls to this function after successful initialization but before1771* termination will return `GLFW_TRUE` immediately.1772*1773* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an1774* [error](@ref error_handling) occurred.1775*1776* @errors Possible errors include @ref GLFW_PLATFORM_ERROR.1777*1778* @remark @macos This function will change the current directory of the1779* application to the `Contents/Resources` subdirectory of the application's1780* bundle, if present. This can be disabled with the @ref1781* GLFW_COCOA_CHDIR_RESOURCES init hint.1782*1783* @remark @x11 This function will set the `LC_CTYPE` category of the1784* application locale according to the current environment if that category is1785* still "C". This is because the "C" locale breaks Unicode text input.1786*1787* @thread_safety This function must only be called from the main thread.1788*1789* @sa @ref intro_init1790* @sa @ref glfwTerminate1791*1792* @since Added in version 1.0.1793*1794* @ingroup init1795*/1796GLFWAPI int glfwInit(void);17971798/*! @brief Terminates the GLFW library.1799*1800* This function destroys all remaining windows and cursors, restores any1801* modified gamma ramps and frees any other allocated resources. Once this1802* function is called, you must again call @ref glfwInit successfully before1803* you will be able to use most GLFW functions.1804*1805* If GLFW has been successfully initialized, this function should be called1806* before the application exits. If initialization fails, there is no need to1807* call this function, as it is called by @ref glfwInit before it returns1808* failure.1809*1810* This function has no effect if GLFW is not initialized.1811*1812* @errors Possible errors include @ref GLFW_PLATFORM_ERROR.1813*1814* @remark This function may be called before @ref glfwInit.1815*1816* @warning The contexts of any remaining windows must not be current on any1817* other thread when this function is called.1818*1819* @reentrancy This function must not be called from a callback.1820*1821* @thread_safety This function must only be called from the main thread.1822*1823* @sa @ref intro_init1824* @sa @ref glfwInit1825*1826* @since Added in version 1.0.1827*1828* @ingroup init1829*/1830GLFWAPI void glfwTerminate(void);18311832/*! @brief Sets the specified init hint to the desired value.1833*1834* This function sets hints for the next initialization of GLFW.1835*1836* The values you set hints to are never reset by GLFW, but they only take1837* effect during initialization. Once GLFW has been initialized, any values1838* you set will be ignored until the library is terminated and initialized1839* again.1840*1841* Some hints are platform specific. These may be set on any platform but they1842* will only affect their specific platform. Other platforms will ignore them.1843* Setting these hints requires no platform specific headers or functions.1844*1845* @param[in] hint The [init hint](@ref init_hints) to set.1846* @param[in] value The new value of the init hint.1847*1848* @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref1849* GLFW_INVALID_VALUE.1850*1851* @remarks This function may be called before @ref glfwInit.1852*1853* @thread_safety This function must only be called from the main thread.1854*1855* @sa init_hints1856* @sa glfwInit1857*1858* @since Added in version 3.3.1859*1860* @ingroup init1861*/1862GLFWAPI void glfwInitHint(int hint, int value);18631864/*! @brief Retrieves the version of the GLFW library.1865*1866* This function retrieves the major, minor and revision numbers of the GLFW1867* library. It is intended for when you are using GLFW as a shared library and1868* want to ensure that you are using the minimum required version.1869*1870* Any or all of the version arguments may be `NULL`.1871*1872* @param[out] major Where to store the major version number, or `NULL`.1873* @param[out] minor Where to store the minor version number, or `NULL`.1874* @param[out] rev Where to store the revision number, or `NULL`.1875*1876* @errors None.1877*1878* @remark This function may be called before @ref glfwInit.1879*1880* @thread_safety This function may be called from any thread.1881*1882* @sa @ref intro_version1883* @sa @ref glfwGetVersionString1884*1885* @since Added in version 1.0.1886*1887* @ingroup init1888*/1889GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);18901891/*! @brief Returns a string describing the compile-time configuration.1892*1893* This function returns the compile-time generated1894* [version string](@ref intro_version_string) of the GLFW library binary. It1895* describes the version, platform, compiler and any platform-specific1896* compile-time options. It should not be confused with the OpenGL or OpenGL1897* ES version string, queried with `glGetString`.1898*1899* __Do not use the version string__ to parse the GLFW library version. The1900* @ref glfwGetVersion function provides the version of the running library1901* binary in numerical format.1902*1903* @return The ASCII encoded GLFW version string.1904*1905* @errors None.1906*1907* @remark This function may be called before @ref glfwInit.1908*1909* @pointer_lifetime The returned string is static and compile-time generated.1910*1911* @thread_safety This function may be called from any thread.1912*1913* @sa @ref intro_version1914* @sa @ref glfwGetVersion1915*1916* @since Added in version 3.0.1917*1918* @ingroup init1919*/1920GLFWAPI const char* glfwGetVersionString(void);19211922/*! @brief Returns and clears the last error for the calling thread.1923*1924* This function returns and clears the [error code](@ref errors) of the last1925* error that occurred on the calling thread, and optionally a UTF-8 encoded1926* human-readable description of it. If no error has occurred since the last1927* call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is1928* set to `NULL`.1929*1930* @param[in] description Where to store the error description pointer, or `NULL`.1931* @return The last error code for the calling thread, or @ref GLFW_NO_ERROR1932* (zero).1933*1934* @errors None.1935*1936* @pointer_lifetime The returned string is allocated and freed by GLFW. You1937* should not free it yourself. It is guaranteed to be valid only until the1938* next error occurs or the library is terminated.1939*1940* @remark This function may be called before @ref glfwInit.1941*1942* @thread_safety This function may be called from any thread.1943*1944* @sa @ref error_handling1945* @sa @ref glfwSetErrorCallback1946*1947* @since Added in version 3.3.1948*1949* @ingroup init1950*/1951GLFWAPI int glfwGetError(const char** description);19521953/*! @brief Sets the error callback.1954*1955* This function sets the error callback, which is called with an error code1956* and a human-readable description each time a GLFW error occurs.1957*1958* The error code is set before the callback is called. Calling @ref1959* glfwGetError from the error callback will return the same value as the error1960* code argument.1961*1962* The error callback is called on the thread where the error occurred. If you1963* are using GLFW from multiple threads, your error callback needs to be1964* written accordingly.1965*1966* Because the description string may have been generated specifically for that1967* error, it is not guaranteed to be valid after the callback has returned. If1968* you wish to use it after the callback returns, you need to make a copy.1969*1970* Once set, the error callback remains set even after the library has been1971* terminated.1972*1973* @param[in] callback The new callback, or `NULL` to remove the currently set1974* callback.1975* @return The previously set callback, or `NULL` if no callback was set.1976*1977* @callback_signature1978* @code1979* void callback_name(int error_code, const char* description)1980* @endcode1981* For more information about the callback parameters, see the1982* [callback pointer type](@ref GLFWerrorfun).1983*1984* @errors None.1985*1986* @remark This function may be called before @ref glfwInit.1987*1988* @thread_safety This function must only be called from the main thread.1989*1990* @sa @ref error_handling1991* @sa @ref glfwGetError1992*1993* @since Added in version 3.0.1994*1995* @ingroup init1996*/1997GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);19981999/*! @brief Returns the currently connected monitors.2000*2001* This function returns an array of handles for all currently connected2002* monitors. The primary monitor is always first in the returned array. If no2003* monitors were found, this function returns `NULL`.2004*2005* @param[out] count Where to store the number of monitors in the returned2006* array. This is set to zero if an error occurred.2007* @return An array of monitor handles, or `NULL` if no monitors were found or2008* if an [error](@ref error_handling) occurred.2009*2010* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2011*2012* @pointer_lifetime The returned array is allocated and freed by GLFW. You2013* should not free it yourself. It is guaranteed to be valid only until the2014* monitor configuration changes or the library is terminated.2015*2016* @thread_safety This function must only be called from the main thread.2017*2018* @sa @ref monitor_monitors2019* @sa @ref monitor_event2020* @sa @ref glfwGetPrimaryMonitor2021*2022* @since Added in version 3.0.2023*2024* @ingroup monitor2025*/2026GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);20272028/*! @brief Returns the primary monitor.2029*2030* This function returns the primary monitor. This is usually the monitor2031* where elements like the task bar or global menu bar are located.2032*2033* @return The primary monitor, or `NULL` if no monitors were found or if an2034* [error](@ref error_handling) occurred.2035*2036* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2037*2038* @thread_safety This function must only be called from the main thread.2039*2040* @remark The primary monitor is always first in the array returned by @ref2041* glfwGetMonitors.2042*2043* @sa @ref monitor_monitors2044* @sa @ref glfwGetMonitors2045*2046* @since Added in version 3.0.2047*2048* @ingroup monitor2049*/2050GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);20512052/*! @brief Returns the position of the monitor's viewport on the virtual screen.2053*2054* This function returns the position, in screen coordinates, of the upper-left2055* corner of the specified monitor.2056*2057* Any or all of the position arguments may be `NULL`. If an error occurs, all2058* non-`NULL` position arguments will be set to zero.2059*2060* @param[in] monitor The monitor to query.2061* @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.2062* @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.2063*2064* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2065* GLFW_PLATFORM_ERROR.2066*2067* @thread_safety This function must only be called from the main thread.2068*2069* @sa @ref monitor_properties2070*2071* @since Added in version 3.0.2072*2073* @ingroup monitor2074*/2075GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);20762077/*! @brief Retrieves the work area of the monitor.2078*2079* This function returns the position, in screen coordinates, of the upper-left2080* corner of the work area of the specified monitor along with the work area2081* size in screen coordinates. The work area is defined as the area of the2082* monitor not occluded by the operating system task bar where present. If no2083* task bar exists then the work area is the monitor resolution in screen2084* coordinates.2085*2086* Any or all of the position and size arguments may be `NULL`. If an error2087* occurs, all non-`NULL` position and size arguments will be set to zero.2088*2089* @param[in] monitor The monitor to query.2090* @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.2091* @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.2092* @param[out] width Where to store the monitor width, or `NULL`.2093* @param[out] height Where to store the monitor height, or `NULL`.2094*2095* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2096* GLFW_PLATFORM_ERROR.2097*2098* @thread_safety This function must only be called from the main thread.2099*2100* @sa @ref monitor_workarea2101*2102* @since Added in version 3.3.2103*2104* @ingroup monitor2105*/2106GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);21072108/*! @brief Returns the physical size of the monitor.2109*2110* This function returns the size, in millimetres, of the display area of the2111* specified monitor.2112*2113* Some systems do not provide accurate monitor size information, either2114* because the monitor2115* [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)2116* data is incorrect or because the driver does not report it accurately.2117*2118* Any or all of the size arguments may be `NULL`. If an error occurs, all2119* non-`NULL` size arguments will be set to zero.2120*2121* @param[in] monitor The monitor to query.2122* @param[out] widthMM Where to store the width, in millimetres, of the2123* monitor's display area, or `NULL`.2124* @param[out] heightMM Where to store the height, in millimetres, of the2125* monitor's display area, or `NULL`.2126*2127* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2128*2129* @remark @win32 On Windows 8 and earlier the physical size is calculated from2130* the current resolution and system DPI instead of querying the monitor EDID data.2131*2132* @thread_safety This function must only be called from the main thread.2133*2134* @sa @ref monitor_properties2135*2136* @since Added in version 3.0.2137*2138* @ingroup monitor2139*/2140GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);21412142/*! @brief Retrieves the content scale for the specified monitor.2143*2144* This function retrieves the content scale for the specified monitor. The2145* content scale is the ratio between the current DPI and the platform's2146* default DPI. This is especially important for text and any UI elements. If2147* the pixel dimensions of your UI scaled by this look appropriate on your2148* machine then it should appear at a reasonable size on other machines2149* regardless of their DPI and scaling settings. This relies on the system DPI2150* and scaling settings being somewhat correct.2151*2152* The content scale may depend on both the monitor resolution and pixel2153* density and on user settings. It may be very different from the raw DPI2154* calculated from the physical size and current resolution.2155*2156* @param[in] monitor The monitor to query.2157* @param[out] xscale Where to store the x-axis content scale, or `NULL`.2158* @param[out] yscale Where to store the y-axis content scale, or `NULL`.2159*2160* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2161* GLFW_PLATFORM_ERROR.2162*2163* @thread_safety This function must only be called from the main thread.2164*2165* @sa @ref monitor_scale2166* @sa @ref glfwGetWindowContentScale2167*2168* @since Added in version 3.3.2169*2170* @ingroup monitor2171*/2172GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale);21732174/*! @brief Returns the name of the specified monitor.2175*2176* This function returns a human-readable name, encoded as UTF-8, of the2177* specified monitor. The name typically reflects the make and model of the2178* monitor and is not guaranteed to be unique among the connected monitors.2179*2180* @param[in] monitor The monitor to query.2181* @return The UTF-8 encoded name of the monitor, or `NULL` if an2182* [error](@ref error_handling) occurred.2183*2184* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2185*2186* @pointer_lifetime The returned string is allocated and freed by GLFW. You2187* should not free it yourself. It is valid until the specified monitor is2188* disconnected or the library is terminated.2189*2190* @thread_safety This function must only be called from the main thread.2191*2192* @sa @ref monitor_properties2193*2194* @since Added in version 3.0.2195*2196* @ingroup monitor2197*/2198GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);21992200/*! @brief Sets the user pointer of the specified monitor.2201*2202* This function sets the user-defined pointer of the specified monitor. The2203* current value is retained until the monitor is disconnected. The initial2204* value is `NULL`.2205*2206* This function may be called from the monitor callback, even for a monitor2207* that is being disconnected.2208*2209* @param[in] monitor The monitor whose pointer to set.2210* @param[in] pointer The new value.2211*2212* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2213*2214* @thread_safety This function may be called from any thread. Access is not2215* synchronized.2216*2217* @sa @ref monitor_userptr2218* @sa @ref glfwGetMonitorUserPointer2219*2220* @since Added in version 3.3.2221*2222* @ingroup monitor2223*/2224GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);22252226/*! @brief Returns the user pointer of the specified monitor.2227*2228* This function returns the current value of the user-defined pointer of the2229* specified monitor. The initial value is `NULL`.2230*2231* This function may be called from the monitor callback, even for a monitor2232* that is being disconnected.2233*2234* @param[in] monitor The monitor whose pointer to return.2235*2236* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2237*2238* @thread_safety This function may be called from any thread. Access is not2239* synchronized.2240*2241* @sa @ref monitor_userptr2242* @sa @ref glfwSetMonitorUserPointer2243*2244* @since Added in version 3.3.2245*2246* @ingroup monitor2247*/2248GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);22492250/*! @brief Sets the monitor configuration callback.2251*2252* This function sets the monitor configuration callback, or removes the2253* currently set callback. This is called when a monitor is connected to or2254* disconnected from the system.2255*2256* @param[in] callback The new callback, or `NULL` to remove the currently set2257* callback.2258* @return The previously set callback, or `NULL` if no callback was set or the2259* library had not been [initialized](@ref intro_init).2260*2261* @callback_signature2262* @code2263* void function_name(GLFWmonitor* monitor, int event)2264* @endcode2265* For more information about the callback parameters, see the2266* [function pointer type](@ref GLFWmonitorfun).2267*2268* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2269*2270* @thread_safety This function must only be called from the main thread.2271*2272* @sa @ref monitor_event2273*2274* @since Added in version 3.0.2275*2276* @ingroup monitor2277*/2278GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);22792280/*! @brief Returns the available video modes for the specified monitor.2281*2282* This function returns an array of all video modes supported by the specified2283* monitor. The returned array is sorted in ascending order, first by color2284* bit depth (the sum of all channel depths), then by resolution area (the2285* product of width and height), then resolution width and finally by refresh2286* rate.2287*2288* @param[in] monitor The monitor to query.2289* @param[out] count Where to store the number of video modes in the returned2290* array. This is set to zero if an error occurred.2291* @return An array of video modes, or `NULL` if an2292* [error](@ref error_handling) occurred.2293*2294* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2295* GLFW_PLATFORM_ERROR.2296*2297* @pointer_lifetime The returned array is allocated and freed by GLFW. You2298* should not free it yourself. It is valid until the specified monitor is2299* disconnected, this function is called again for that monitor or the library2300* is terminated.2301*2302* @thread_safety This function must only be called from the main thread.2303*2304* @sa @ref monitor_modes2305* @sa @ref glfwGetVideoMode2306*2307* @since Added in version 1.0.2308* @glfw3 Changed to return an array of modes for a specific monitor.2309*2310* @ingroup monitor2311*/2312GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);23132314/*! @brief Returns the current mode of the specified monitor.2315*2316* This function returns the current video mode of the specified monitor. If2317* you have created a full screen window for that monitor, the return value2318* will depend on whether that window is iconified.2319*2320* @param[in] monitor The monitor to query.2321* @return The current mode of the monitor, or `NULL` if an2322* [error](@ref error_handling) occurred.2323*2324* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2325* GLFW_PLATFORM_ERROR.2326*2327* @pointer_lifetime The returned array is allocated and freed by GLFW. You2328* should not free it yourself. It is valid until the specified monitor is2329* disconnected or the library is terminated.2330*2331* @thread_safety This function must only be called from the main thread.2332*2333* @sa @ref monitor_modes2334* @sa @ref glfwGetVideoModes2335*2336* @since Added in version 3.0. Replaces `glfwGetDesktopMode`.2337*2338* @ingroup monitor2339*/2340GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);23412342/*! @brief Generates a gamma ramp and sets it for the specified monitor.2343*2344* This function generates an appropriately sized gamma ramp from the specified2345* exponent and then calls @ref glfwSetGammaRamp with it. The value must be2346* a finite number greater than zero.2347*2348* The software controlled gamma ramp is applied _in addition_ to the hardware2349* gamma correction, which today is usually an approximation of sRGB gamma.2350* This means that setting a perfectly linear ramp, or gamma 1.0, will produce2351* the default (usually sRGB-like) behavior.2352*2353* For gamma correct rendering with OpenGL or OpenGL ES, see the @ref2354* GLFW_SRGB_CAPABLE hint.2355*2356* @param[in] monitor The monitor whose gamma ramp to set.2357* @param[in] gamma The desired exponent.2358*2359* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref2360* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.2361*2362* @remark @wayland Gamma handling is a privileged protocol, this function2363* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.2364*2365* @thread_safety This function must only be called from the main thread.2366*2367* @sa @ref monitor_gamma2368*2369* @since Added in version 3.0.2370*2371* @ingroup monitor2372*/2373GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);23742375/*! @brief Returns the current gamma ramp for the specified monitor.2376*2377* This function returns the current gamma ramp of the specified monitor.2378*2379* @param[in] monitor The monitor to query.2380* @return The current gamma ramp, or `NULL` if an2381* [error](@ref error_handling) occurred.2382*2383* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2384* GLFW_PLATFORM_ERROR.2385*2386* @remark @wayland Gamma handling is a privileged protocol, this function2387* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while2388* returning `NULL`.2389*2390* @pointer_lifetime The returned structure and its arrays are allocated and2391* freed by GLFW. You should not free them yourself. They are valid until the2392* specified monitor is disconnected, this function is called again for that2393* monitor or the library is terminated.2394*2395* @thread_safety This function must only be called from the main thread.2396*2397* @sa @ref monitor_gamma2398*2399* @since Added in version 3.0.2400*2401* @ingroup monitor2402*/2403GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);24042405/*! @brief Sets the current gamma ramp for the specified monitor.2406*2407* This function sets the current gamma ramp for the specified monitor. The2408* original gamma ramp for that monitor is saved by GLFW the first time this2409* function is called and is restored by @ref glfwTerminate.2410*2411* The software controlled gamma ramp is applied _in addition_ to the hardware2412* gamma correction, which today is usually an approximation of sRGB gamma.2413* This means that setting a perfectly linear ramp, or gamma 1.0, will produce2414* the default (usually sRGB-like) behavior.2415*2416* For gamma correct rendering with OpenGL or OpenGL ES, see the @ref2417* GLFW_SRGB_CAPABLE hint.2418*2419* @param[in] monitor The monitor whose gamma ramp to set.2420* @param[in] ramp The gamma ramp to use.2421*2422* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2423* GLFW_PLATFORM_ERROR.2424*2425* @remark The size of the specified gamma ramp should match the size of the2426* current ramp for that monitor.2427*2428* @remark @win32 The gamma ramp size must be 256.2429*2430* @remark @wayland Gamma handling is a privileged protocol, this function2431* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.2432*2433* @pointer_lifetime The specified gamma ramp is copied before this function2434* returns.2435*2436* @thread_safety This function must only be called from the main thread.2437*2438* @sa @ref monitor_gamma2439*2440* @since Added in version 3.0.2441*2442* @ingroup monitor2443*/2444GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);24452446/*! @brief Resets all window hints to their default values.2447*2448* This function resets all window hints to their2449* [default values](@ref window_hints_values).2450*2451* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2452*2453* @thread_safety This function must only be called from the main thread.2454*2455* @sa @ref window_hints2456* @sa @ref glfwWindowHint2457* @sa @ref glfwWindowHintString2458*2459* @since Added in version 3.0.2460*2461* @ingroup window2462*/2463GLFWAPI void glfwDefaultWindowHints(void);24642465/*! @brief Sets the specified window hint to the desired value.2466*2467* This function sets hints for the next call to @ref glfwCreateWindow. The2468* hints, once set, retain their values until changed by a call to this2469* function or @ref glfwDefaultWindowHints, or until the library is terminated.2470*2471* Only integer value hints can be set with this function. String value hints2472* are set with @ref glfwWindowHintString.2473*2474* This function does not check whether the specified hint values are valid.2475* If you set hints to invalid values this will instead be reported by the next2476* call to @ref glfwCreateWindow.2477*2478* Some hints are platform specific. These may be set on any platform but they2479* will only affect their specific platform. Other platforms will ignore them.2480* Setting these hints requires no platform specific headers or functions.2481*2482* @param[in] hint The [window hint](@ref window_hints) to set.2483* @param[in] value The new value of the window hint.2484*2485* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2486* GLFW_INVALID_ENUM.2487*2488* @thread_safety This function must only be called from the main thread.2489*2490* @sa @ref window_hints2491* @sa @ref glfwWindowHintString2492* @sa @ref glfwDefaultWindowHints2493*2494* @since Added in version 3.0. Replaces `glfwOpenWindowHint`.2495*2496* @ingroup window2497*/2498GLFWAPI void glfwWindowHint(int hint, int value);24992500/*! @brief Sets the specified window hint to the desired value.2501*2502* This function sets hints for the next call to @ref glfwCreateWindow. The2503* hints, once set, retain their values until changed by a call to this2504* function or @ref glfwDefaultWindowHints, or until the library is terminated.2505*2506* Only string type hints can be set with this function. Integer value hints2507* are set with @ref glfwWindowHint.2508*2509* This function does not check whether the specified hint values are valid.2510* If you set hints to invalid values this will instead be reported by the next2511* call to @ref glfwCreateWindow.2512*2513* Some hints are platform specific. These may be set on any platform but they2514* will only affect their specific platform. Other platforms will ignore them.2515* Setting these hints requires no platform specific headers or functions.2516*2517* @param[in] hint The [window hint](@ref window_hints) to set.2518* @param[in] value The new value of the window hint.2519*2520* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2521* GLFW_INVALID_ENUM.2522*2523* @pointer_lifetime The specified string is copied before this function2524* returns.2525*2526* @thread_safety This function must only be called from the main thread.2527*2528* @sa @ref window_hints2529* @sa @ref glfwWindowHint2530* @sa @ref glfwDefaultWindowHints2531*2532* @since Added in version 3.3.2533*2534* @ingroup window2535*/2536GLFWAPI void glfwWindowHintString(int hint, const char* value);25372538/*! @brief Creates a window and its associated context.2539*2540* This function creates a window and its associated OpenGL or OpenGL ES2541* context. Most of the options controlling how the window and its context2542* should be created are specified with [window hints](@ref window_hints).2543*2544* Successful creation does not change which context is current. Before you2545* can use the newly created context, you need to2546* [make it current](@ref context_current). For information about the `share`2547* parameter, see @ref context_sharing.2548*2549* The created window, framebuffer and context may differ from what you2550* requested, as not all parameters and hints are2551* [hard constraints](@ref window_hints_hard). This includes the size of the2552* window, especially for full screen windows. To query the actual attributes2553* of the created window, framebuffer and context, see @ref2554* glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.2555*2556* To create a full screen window, you need to specify the monitor the window2557* will cover. If no monitor is specified, the window will be windowed mode.2558* Unless you have a way for the user to choose a specific monitor, it is2559* recommended that you pick the primary monitor. For more information on how2560* to query connected monitors, see @ref monitor_monitors.2561*2562* For full screen windows, the specified size becomes the resolution of the2563* window's _desired video mode_. As long as a full screen window is not2564* iconified, the supported video mode most closely matching the desired video2565* mode is set for the specified monitor. For more information about full2566* screen windows, including the creation of so called _windowed full screen_2567* or _borderless full screen_ windows, see @ref window_windowed_full_screen.2568*2569* Once you have created the window, you can switch it between windowed and2570* full screen mode with @ref glfwSetWindowMonitor. This will not affect its2571* OpenGL or OpenGL ES context.2572*2573* By default, newly created windows use the placement recommended by the2574* window system. To create the window at a specific position, make it2575* initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window2576* hint, set its [position](@ref window_pos) and then [show](@ref window_hide)2577* it.2578*2579* As long as at least one full screen window is not iconified, the screensaver2580* is prohibited from starting.2581*2582* Window systems put limits on window sizes. Very large or very small window2583* dimensions may be overridden by the window system on creation. Check the2584* actual [size](@ref window_size) after creation.2585*2586* The [swap interval](@ref buffer_swap) is not set during window creation and2587* the initial value may vary depending on driver settings and defaults.2588*2589* @param[in] width The desired width, in screen coordinates, of the window.2590* This must be greater than zero.2591* @param[in] height The desired height, in screen coordinates, of the window.2592* This must be greater than zero.2593* @param[in] title The initial, UTF-8 encoded window title.2594* @param[in] monitor The monitor to use for full screen mode, or `NULL` for2595* windowed mode.2596* @param[in] share The window whose context to share resources with, or `NULL`2597* to not share resources.2598* @return The handle of the created window, or `NULL` if an2599* [error](@ref error_handling) occurred.2600*2601* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref2602* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref2603* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref2604* GLFW_PLATFORM_ERROR.2605*2606* @remark @win32 Window creation will fail if the Microsoft GDI software2607* OpenGL implementation is the only one available.2608*2609* @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it2610* will be set as the initial icon for the window. If no such icon is present,2611* the `IDI_APPLICATION` icon will be used instead. To set a different icon,2612* see @ref glfwSetWindowIcon.2613*2614* @remark @win32 The context to share resources with must not be current on2615* any other thread.2616*2617* @remark @macos The OS only supports forward-compatible core profile contexts2618* for OpenGL versions 3.2 and later. Before creating an OpenGL context of2619* version 3.2 or later you must set the2620* [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and2621* [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.2622* OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.2623*2624* @remark @macos The GLFW window has no icon, as it is not a document2625* window, but the dock icon will be the same as the application bundle's icon.2626* For more information on bundles, see the2627* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)2628* in the Mac Developer Library.2629*2630* @remark @macos The first time a window is created the menu bar is created.2631* If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu2632* bar. Otherwise a minimal menu bar is created manually with common commands2633* like Hide, Quit and About. The About entry opens a minimal about dialog2634* with information from the application's bundle. Menu bar creation can be2635* disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint.2636*2637* @remark @macos On OS X 10.10 and later the window frame will not be rendered2638* at full resolution on Retina displays unless the2639* [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)2640* hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the2641* application bundle's `Info.plist`. For more information, see2642* [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)2643* in the Mac Developer Library. The GLFW test and example programs use2644* a custom `Info.plist` template for this, which can be found as2645* `CMake/MacOSXBundleInfo.plist.in` in the source tree.2646*2647* @remark @macos When activating frame autosaving with2648* [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified2649* window size and position may be overridden by previously saved values.2650*2651* @remark @x11 Some window managers will not respect the placement of2652* initially hidden windows.2653*2654* @remark @x11 Due to the asynchronous nature of X11, it may take a moment for2655* a window to reach its requested state. This means you may not be able to2656* query the final size, position or other attributes directly after window2657* creation.2658*2659* @remark @x11 The class part of the `WM_CLASS` window property will by2660* default be set to the window title passed to this function. The instance2661* part will use the contents of the `RESOURCE_NAME` environment variable, if2662* present and not empty, or fall back to the window title. Set the2663* [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and2664* [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to2665* override this.2666*2667* @remark @wayland Compositors should implement the xdg-decoration protocol2668* for GLFW to decorate the window properly. If this protocol isn't2669* supported, or if the compositor prefers client-side decorations, a very2670* simple fallback frame will be drawn using the wp_viewporter protocol. A2671* compositor can still emit close, maximize or fullscreen events, using for2672* instance a keybind mechanism. If neither of these protocols is supported,2673* the window won't be decorated.2674*2675* @remark @wayland A full screen window will not attempt to change the mode,2676* no matter what the requested size or refresh rate.2677*2678* @remark @wayland Screensaver inhibition requires the idle-inhibit protocol2679* to be implemented in the user's compositor.2680*2681* @thread_safety This function must only be called from the main thread.2682*2683* @sa @ref window_creation2684* @sa @ref glfwDestroyWindow2685*2686* @since Added in version 3.0. Replaces `glfwOpenWindow`.2687*2688* @ingroup window2689*/2690GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);26912692/*! @brief Destroys the specified window and its context.2693*2694* This function destroys the specified window and its context. On calling2695* this function, no further callbacks will be called for that window.2696*2697* If the context of the specified window is current on the main thread, it is2698* detached before being destroyed.2699*2700* @param[in] window The window to destroy.2701*2702* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2703* GLFW_PLATFORM_ERROR.2704*2705* @note The context of the specified window must not be current on any other2706* thread when this function is called.2707*2708* @reentrancy This function must not be called from a callback.2709*2710* @thread_safety This function must only be called from the main thread.2711*2712* @sa @ref window_creation2713* @sa @ref glfwCreateWindow2714*2715* @since Added in version 3.0. Replaces `glfwCloseWindow`.2716*2717* @ingroup window2718*/2719GLFWAPI void glfwDestroyWindow(GLFWwindow* window);27202721/*! @brief Checks the close flag of the specified window.2722*2723* This function returns the value of the close flag of the specified window.2724*2725* @param[in] window The window to query.2726* @return The value of the close flag.2727*2728* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2729*2730* @thread_safety This function may be called from any thread. Access is not2731* synchronized.2732*2733* @sa @ref window_close2734*2735* @since Added in version 3.0.2736*2737* @ingroup window2738*/2739GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);27402741/*! @brief Sets the close flag of the specified window.2742*2743* This function sets the value of the close flag of the specified window.2744* This can be used to override the user's attempt to close the window, or2745* to signal that it should be closed.2746*2747* @param[in] window The window whose flag to change.2748* @param[in] value The new value.2749*2750* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.2751*2752* @thread_safety This function may be called from any thread. Access is not2753* synchronized.2754*2755* @sa @ref window_close2756*2757* @since Added in version 3.0.2758*2759* @ingroup window2760*/2761GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);27622763/*! @brief Sets the title of the specified window.2764*2765* This function sets the window title, encoded as UTF-8, of the specified2766* window.2767*2768* @param[in] window The window whose title to change.2769* @param[in] title The UTF-8 encoded window title.2770*2771* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2772* GLFW_PLATFORM_ERROR.2773*2774* @remark @macos The window title will not be updated until the next time you2775* process events.2776*2777* @thread_safety This function must only be called from the main thread.2778*2779* @sa @ref window_title2780*2781* @since Added in version 1.0.2782* @glfw3 Added window handle parameter.2783*2784* @ingroup window2785*/2786GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);27872788/*! @brief Sets the icon for the specified window.2789*2790* This function sets the icon of the specified window. If passed an array of2791* candidate images, those of or closest to the sizes desired by the system are2792* selected. If no images are specified, the window reverts to its default2793* icon.2794*2795* The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight2796* bits per channel with the red channel first. They are arranged canonically2797* as packed sequential rows, starting from the top-left corner.2798*2799* The desired image sizes varies depending on platform and system settings.2800* The selected images will be rescaled as needed. Good sizes include 16x16,2801* 32x32 and 48x48.2802*2803* @param[in] window The window whose icon to set.2804* @param[in] count The number of images in the specified array, or zero to2805* revert to the default window icon.2806* @param[in] images The images to create the icon from. This is ignored if2807* count is zero.2808*2809* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref2810* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.2811*2812* @pointer_lifetime The specified image data is copied before this function2813* returns.2814*2815* @remark @macos The GLFW window has no icon, as it is not a document2816* window, so this function does nothing. The dock icon will be the same as2817* the application bundle's icon. For more information on bundles, see the2818* [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)2819* in the Mac Developer Library.2820*2821* @remark @wayland There is no existing protocol to change an icon, the2822* window will thus inherit the one defined in the application's desktop file.2823* This function always emits @ref GLFW_PLATFORM_ERROR.2824*2825* @thread_safety This function must only be called from the main thread.2826*2827* @sa @ref window_icon2828*2829* @since Added in version 3.2.2830*2831* @ingroup window2832*/2833GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);28342835/*! @brief Retrieves the position of the content area of the specified window.2836*2837* This function retrieves the position, in screen coordinates, of the2838* upper-left corner of the content area of the specified window.2839*2840* Any or all of the position arguments may be `NULL`. If an error occurs, all2841* non-`NULL` position arguments will be set to zero.2842*2843* @param[in] window The window to query.2844* @param[out] xpos Where to store the x-coordinate of the upper-left corner of2845* the content area, or `NULL`.2846* @param[out] ypos Where to store the y-coordinate of the upper-left corner of2847* the content area, or `NULL`.2848*2849* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2850* GLFW_PLATFORM_ERROR.2851*2852* @remark @wayland There is no way for an application to retrieve the global2853* position of its windows, this function will always emit @ref2854* GLFW_PLATFORM_ERROR.2855*2856* @thread_safety This function must only be called from the main thread.2857*2858* @sa @ref window_pos2859* @sa @ref glfwSetWindowPos2860*2861* @since Added in version 3.0.2862*2863* @ingroup window2864*/2865GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);28662867/*! @brief Sets the position of the content area of the specified window.2868*2869* This function sets the position, in screen coordinates, of the upper-left2870* corner of the content area of the specified windowed mode window. If the2871* window is a full screen window, this function does nothing.2872*2873* __Do not use this function__ to move an already visible window unless you2874* have very good reasons for doing so, as it will confuse and annoy the user.2875*2876* The window manager may put limits on what positions are allowed. GLFW2877* cannot and should not override these limits.2878*2879* @param[in] window The window to query.2880* @param[in] xpos The x-coordinate of the upper-left corner of the content area.2881* @param[in] ypos The y-coordinate of the upper-left corner of the content area.2882*2883* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2884* GLFW_PLATFORM_ERROR.2885*2886* @remark @wayland There is no way for an application to set the global2887* position of its windows, this function will always emit @ref2888* GLFW_PLATFORM_ERROR.2889*2890* @thread_safety This function must only be called from the main thread.2891*2892* @sa @ref window_pos2893* @sa @ref glfwGetWindowPos2894*2895* @since Added in version 1.0.2896* @glfw3 Added window handle parameter.2897*2898* @ingroup window2899*/2900GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);29012902/*! @brief Retrieves the size of the content area of the specified window.2903*2904* This function retrieves the size, in screen coordinates, of the content area2905* of the specified window. If you wish to retrieve the size of the2906* framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.2907*2908* Any or all of the size arguments may be `NULL`. If an error occurs, all2909* non-`NULL` size arguments will be set to zero.2910*2911* @param[in] window The window whose size to retrieve.2912* @param[out] width Where to store the width, in screen coordinates, of the2913* content area, or `NULL`.2914* @param[out] height Where to store the height, in screen coordinates, of the2915* content area, or `NULL`.2916*2917* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref2918* GLFW_PLATFORM_ERROR.2919*2920* @thread_safety This function must only be called from the main thread.2921*2922* @sa @ref window_size2923* @sa @ref glfwSetWindowSize2924*2925* @since Added in version 1.0.2926* @glfw3 Added window handle parameter.2927*2928* @ingroup window2929*/2930GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);29312932/*! @brief Sets the size limits of the specified window.2933*2934* This function sets the size limits of the content area of the specified2935* window. If the window is full screen, the size limits only take effect2936* once it is made windowed. If the window is not resizable, this function2937* does nothing.2938*2939* The size limits are applied immediately to a windowed mode window and may2940* cause it to be resized.2941*2942* The maximum dimensions must be greater than or equal to the minimum2943* dimensions and all must be greater than or equal to zero.2944*2945* @param[in] window The window to set limits for.2946* @param[in] minwidth The minimum width, in screen coordinates, of the content2947* area, or `GLFW_DONT_CARE`.2948* @param[in] minheight The minimum height, in screen coordinates, of the2949* content area, or `GLFW_DONT_CARE`.2950* @param[in] maxwidth The maximum width, in screen coordinates, of the content2951* area, or `GLFW_DONT_CARE`.2952* @param[in] maxheight The maximum height, in screen coordinates, of the2953* content area, or `GLFW_DONT_CARE`.2954*2955* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref2956* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.2957*2958* @remark If you set size limits and an aspect ratio that conflict, the2959* results are undefined.2960*2961* @remark @wayland The size limits will not be applied until the window is2962* actually resized, either by the user or by the compositor.2963*2964* @thread_safety This function must only be called from the main thread.2965*2966* @sa @ref window_sizelimits2967* @sa @ref glfwSetWindowAspectRatio2968*2969* @since Added in version 3.2.2970*2971* @ingroup window2972*/2973GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);29742975/*! @brief Sets the aspect ratio of the specified window.2976*2977* This function sets the required aspect ratio of the content area of the2978* specified window. If the window is full screen, the aspect ratio only takes2979* effect once it is made windowed. If the window is not resizable, this2980* function does nothing.2981*2982* The aspect ratio is specified as a numerator and a denominator and both2983* values must be greater than zero. For example, the common 16:9 aspect ratio2984* is specified as 16 and 9, respectively.2985*2986* If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect2987* ratio limit is disabled.2988*2989* The aspect ratio is applied immediately to a windowed mode window and may2990* cause it to be resized.2991*2992* @param[in] window The window to set limits for.2993* @param[in] numer The numerator of the desired aspect ratio, or2994* `GLFW_DONT_CARE`.2995* @param[in] denom The denominator of the desired aspect ratio, or2996* `GLFW_DONT_CARE`.2997*2998* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref2999* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.3000*3001* @remark If you set size limits and an aspect ratio that conflict, the3002* results are undefined.3003*3004* @remark @wayland The aspect ratio will not be applied until the window is3005* actually resized, either by the user or by the compositor.3006*3007* @thread_safety This function must only be called from the main thread.3008*3009* @sa @ref window_sizelimits3010* @sa @ref glfwSetWindowSizeLimits3011*3012* @since Added in version 3.2.3013*3014* @ingroup window3015*/3016GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);30173018/*! @brief Sets the size of the content area of the specified window.3019*3020* This function sets the size, in screen coordinates, of the content area of3021* the specified window.3022*3023* For full screen windows, this function updates the resolution of its desired3024* video mode and switches to the video mode closest to it, without affecting3025* the window's context. As the context is unaffected, the bit depths of the3026* framebuffer remain unchanged.3027*3028* If you wish to update the refresh rate of the desired video mode in addition3029* to its resolution, see @ref glfwSetWindowMonitor.3030*3031* The window manager may put limits on what sizes are allowed. GLFW cannot3032* and should not override these limits.3033*3034* @param[in] window The window to resize.3035* @param[in] width The desired width, in screen coordinates, of the window3036* content area.3037* @param[in] height The desired height, in screen coordinates, of the window3038* content area.3039*3040* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3041* GLFW_PLATFORM_ERROR.3042*3043* @remark @wayland A full screen window will not attempt to change the mode,3044* no matter what the requested size.3045*3046* @thread_safety This function must only be called from the main thread.3047*3048* @sa @ref window_size3049* @sa @ref glfwGetWindowSize3050* @sa @ref glfwSetWindowMonitor3051*3052* @since Added in version 1.0.3053* @glfw3 Added window handle parameter.3054*3055* @ingroup window3056*/3057GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);30583059/*! @brief Retrieves the size of the framebuffer of the specified window.3060*3061* This function retrieves the size, in pixels, of the framebuffer of the3062* specified window. If you wish to retrieve the size of the window in screen3063* coordinates, see @ref glfwGetWindowSize.3064*3065* Any or all of the size arguments may be `NULL`. If an error occurs, all3066* non-`NULL` size arguments will be set to zero.3067*3068* @param[in] window The window whose framebuffer to query.3069* @param[out] width Where to store the width, in pixels, of the framebuffer,3070* or `NULL`.3071* @param[out] height Where to store the height, in pixels, of the framebuffer,3072* or `NULL`.3073*3074* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3075* GLFW_PLATFORM_ERROR.3076*3077* @thread_safety This function must only be called from the main thread.3078*3079* @sa @ref window_fbsize3080* @sa @ref glfwSetFramebufferSizeCallback3081*3082* @since Added in version 3.0.3083*3084* @ingroup window3085*/3086GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);30873088/*! @brief Retrieves the size of the frame of the window.3089*3090* This function retrieves the size, in screen coordinates, of each edge of the3091* frame of the specified window. This size includes the title bar, if the3092* window has one. The size of the frame may vary depending on the3093* [window-related hints](@ref window_hints_wnd) used to create it.3094*3095* Because this function retrieves the size of each window frame edge and not3096* the offset along a particular coordinate axis, the retrieved values will3097* always be zero or positive.3098*3099* Any or all of the size arguments may be `NULL`. If an error occurs, all3100* non-`NULL` size arguments will be set to zero.3101*3102* @param[in] window The window whose frame size to query.3103* @param[out] left Where to store the size, in screen coordinates, of the left3104* edge of the window frame, or `NULL`.3105* @param[out] top Where to store the size, in screen coordinates, of the top3106* edge of the window frame, or `NULL`.3107* @param[out] right Where to store the size, in screen coordinates, of the3108* right edge of the window frame, or `NULL`.3109* @param[out] bottom Where to store the size, in screen coordinates, of the3110* bottom edge of the window frame, or `NULL`.3111*3112* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3113* GLFW_PLATFORM_ERROR.3114*3115* @thread_safety This function must only be called from the main thread.3116*3117* @sa @ref window_size3118*3119* @since Added in version 3.1.3120*3121* @ingroup window3122*/3123GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);31243125/*! @brief Retrieves the content scale for the specified window.3126*3127* This function retrieves the content scale for the specified window. The3128* content scale is the ratio between the current DPI and the platform's3129* default DPI. This is especially important for text and any UI elements. If3130* the pixel dimensions of your UI scaled by this look appropriate on your3131* machine then it should appear at a reasonable size on other machines3132* regardless of their DPI and scaling settings. This relies on the system DPI3133* and scaling settings being somewhat correct.3134*3135* On systems where each monitors can have its own content scale, the window3136* content scale will depend on which monitor the system considers the window3137* to be on.3138*3139* @param[in] window The window to query.3140* @param[out] xscale Where to store the x-axis content scale, or `NULL`.3141* @param[out] yscale Where to store the y-axis content scale, or `NULL`.3142*3143* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3144* GLFW_PLATFORM_ERROR.3145*3146* @thread_safety This function must only be called from the main thread.3147*3148* @sa @ref window_scale3149* @sa @ref glfwSetWindowContentScaleCallback3150* @sa @ref glfwGetMonitorContentScale3151*3152* @since Added in version 3.3.3153*3154* @ingroup window3155*/3156GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);31573158/*! @brief Returns the opacity of the whole window.3159*3160* This function returns the opacity of the window, including any decorations.3161*3162* The opacity (or alpha) value is a positive finite number between zero and3163* one, where zero is fully transparent and one is fully opaque. If the system3164* does not support whole window transparency, this function always returns one.3165*3166* The initial opacity value for newly created windows is one.3167*3168* @param[in] window The window to query.3169* @return The opacity value of the specified window.3170*3171* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3172* GLFW_PLATFORM_ERROR.3173*3174* @thread_safety This function must only be called from the main thread.3175*3176* @sa @ref window_transparency3177* @sa @ref glfwSetWindowOpacity3178*3179* @since Added in version 3.3.3180*3181* @ingroup window3182*/3183GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window);31843185/*! @brief Sets the opacity of the whole window.3186*3187* This function sets the opacity of the window, including any decorations.3188*3189* The opacity (or alpha) value is a positive finite number between zero and3190* one, where zero is fully transparent and one is fully opaque.3191*3192* The initial opacity value for newly created windows is one.3193*3194* A window created with framebuffer transparency may not use whole window3195* transparency. The results of doing this are undefined.3196*3197* @param[in] window The window to set the opacity for.3198* @param[in] opacity The desired opacity of the specified window.3199*3200* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3201* GLFW_PLATFORM_ERROR.3202*3203* @thread_safety This function must only be called from the main thread.3204*3205* @sa @ref window_transparency3206* @sa @ref glfwGetWindowOpacity3207*3208* @since Added in version 3.3.3209*3210* @ingroup window3211*/3212GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);32133214/*! @brief Iconifies the specified window.3215*3216* This function iconifies (minimizes) the specified window if it was3217* previously restored. If the window is already iconified, this function does3218* nothing.3219*3220* If the specified window is a full screen window, GLFW restores the original3221* video mode of the monitor. The window's desired video mode is set again3222* when the window is restored.3223*3224* @param[in] window The window to iconify.3225*3226* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3227* GLFW_PLATFORM_ERROR.3228*3229* @thread_safety This function must only be called from the main thread.3230*3231* @sa @ref window_iconify3232* @sa @ref glfwRestoreWindow3233* @sa @ref glfwMaximizeWindow3234*3235* @since Added in version 2.1.3236* @glfw3 Added window handle parameter.3237*3238* @ingroup window3239*/3240GLFWAPI void glfwIconifyWindow(GLFWwindow* window);32413242/*! @brief Restores the specified window.3243*3244* This function restores the specified window if it was previously iconified3245* (minimized) or maximized. If the window is already restored, this function3246* does nothing.3247*3248* If the specified window is an iconified full screen window, its desired3249* video mode is set again for its monitor when the window is restored.3250*3251* @param[in] window The window to restore.3252*3253* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3254* GLFW_PLATFORM_ERROR.3255*3256* @thread_safety This function must only be called from the main thread.3257*3258* @sa @ref window_iconify3259* @sa @ref glfwIconifyWindow3260* @sa @ref glfwMaximizeWindow3261*3262* @since Added in version 2.1.3263* @glfw3 Added window handle parameter.3264*3265* @ingroup window3266*/3267GLFWAPI void glfwRestoreWindow(GLFWwindow* window);32683269/*! @brief Maximizes the specified window.3270*3271* This function maximizes the specified window if it was previously not3272* maximized. If the window is already maximized, this function does nothing.3273*3274* If the specified window is a full screen window, this function does nothing.3275*3276* @param[in] window The window to maximize.3277*3278* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3279* GLFW_PLATFORM_ERROR.3280*3281* @par Thread Safety3282* This function may only be called from the main thread.3283*3284* @sa @ref window_iconify3285* @sa @ref glfwIconifyWindow3286* @sa @ref glfwRestoreWindow3287*3288* @since Added in GLFW 3.2.3289*3290* @ingroup window3291*/3292GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);32933294/*! @brief Makes the specified window visible.3295*3296* This function makes the specified window visible if it was previously3297* hidden. If the window is already visible or is in full screen mode, this3298* function does nothing.3299*3300* By default, windowed mode windows are focused when shown3301* Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint3302* to change this behavior for all newly created windows, or change the3303* behavior for an existing window with @ref glfwSetWindowAttrib.3304*3305* @param[in] window The window to make visible.3306*3307* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3308* GLFW_PLATFORM_ERROR.3309*3310* @remark @wayland Because Wayland wants every frame of the desktop to be3311* complete, this function does not immediately make the window visible.3312* Instead it will become visible the next time the window framebuffer is3313* updated after this call.3314*3315* @thread_safety This function must only be called from the main thread.3316*3317* @sa @ref window_hide3318* @sa @ref glfwHideWindow3319*3320* @since Added in version 3.0.3321*3322* @ingroup window3323*/3324GLFWAPI void glfwShowWindow(GLFWwindow* window);33253326/*! @brief Hides the specified window.3327*3328* This function hides the specified window if it was previously visible. If3329* the window is already hidden or is in full screen mode, this function does3330* nothing.3331*3332* @param[in] window The window to hide.3333*3334* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3335* GLFW_PLATFORM_ERROR.3336*3337* @thread_safety This function must only be called from the main thread.3338*3339* @sa @ref window_hide3340* @sa @ref glfwShowWindow3341*3342* @since Added in version 3.0.3343*3344* @ingroup window3345*/3346GLFWAPI void glfwHideWindow(GLFWwindow* window);33473348/*! @brief Brings the specified window to front and sets input focus.3349*3350* This function brings the specified window to front and sets input focus.3351* The window should already be visible and not iconified.3352*3353* By default, both windowed and full screen mode windows are focused when3354* initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to3355* disable this behavior.3356*3357* Also by default, windowed mode windows are focused when shown3358* with @ref glfwShowWindow. Set the3359* [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior.3360*3361* __Do not use this function__ to steal focus from other applications unless3362* you are certain that is what the user wants. Focus stealing can be3363* extremely disruptive.3364*3365* For a less disruptive way of getting the user's attention, see3366* [attention requests](@ref window_attention).3367*3368* @param[in] window The window to give input focus.3369*3370* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3371* GLFW_PLATFORM_ERROR.3372*3373* @remark @wayland It is not possible for an application to bring its windows3374* to front, this function will always emit @ref GLFW_PLATFORM_ERROR.3375*3376* @thread_safety This function must only be called from the main thread.3377*3378* @sa @ref window_focus3379* @sa @ref window_attention3380*3381* @since Added in version 3.2.3382*3383* @ingroup window3384*/3385GLFWAPI void glfwFocusWindow(GLFWwindow* window);33863387/*! @brief Requests user attention to the specified window.3388*3389* This function requests user attention to the specified window. On3390* platforms where this is not supported, attention is requested to the3391* application as a whole.3392*3393* Once the user has given attention, usually by focusing the window or3394* application, the system will end the request automatically.3395*3396* @param[in] window The window to request attention to.3397*3398* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3399* GLFW_PLATFORM_ERROR.3400*3401* @remark @macos Attention is requested to the application as a whole, not the3402* specific window.3403*3404* @thread_safety This function must only be called from the main thread.3405*3406* @sa @ref window_attention3407*3408* @since Added in version 3.3.3409*3410* @ingroup window3411*/3412GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window);34133414/*! @brief Returns the monitor that the window uses for full screen mode.3415*3416* This function returns the handle of the monitor that the specified window is3417* in full screen on.3418*3419* @param[in] window The window to query.3420* @return The monitor, or `NULL` if the window is in windowed mode or an3421* [error](@ref error_handling) occurred.3422*3423* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3424*3425* @thread_safety This function must only be called from the main thread.3426*3427* @sa @ref window_monitor3428* @sa @ref glfwSetWindowMonitor3429*3430* @since Added in version 3.0.3431*3432* @ingroup window3433*/3434GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);34353436/*! @brief Sets the mode, monitor, video mode and placement of a window.3437*3438* This function sets the monitor that the window uses for full screen mode or,3439* if the monitor is `NULL`, makes it windowed mode.3440*3441* When setting a monitor, this function updates the width, height and refresh3442* rate of the desired video mode and switches to the video mode closest to it.3443* The window position is ignored when setting a monitor.3444*3445* When the monitor is `NULL`, the position, width and height are used to3446* place the window content area. The refresh rate is ignored when no monitor3447* is specified.3448*3449* If you only wish to update the resolution of a full screen window or the3450* size of a windowed mode window, see @ref glfwSetWindowSize.3451*3452* When a window transitions from full screen to windowed mode, this function3453* restores any previous window settings such as whether it is decorated,3454* floating, resizable, has size or aspect ratio limits, etc.3455*3456* @param[in] window The window whose monitor, size or video mode to set.3457* @param[in] monitor The desired monitor, or `NULL` to set windowed mode.3458* @param[in] xpos The desired x-coordinate of the upper-left corner of the3459* content area.3460* @param[in] ypos The desired y-coordinate of the upper-left corner of the3461* content area.3462* @param[in] width The desired with, in screen coordinates, of the content3463* area or video mode.3464* @param[in] height The desired height, in screen coordinates, of the content3465* area or video mode.3466* @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,3467* or `GLFW_DONT_CARE`.3468*3469* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3470* GLFW_PLATFORM_ERROR.3471*3472* @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise3473* affected by any resizing or mode switching, although you may need to update3474* your viewport if the framebuffer size has changed.3475*3476* @remark @wayland The desired window position is ignored, as there is no way3477* for an application to set this property.3478*3479* @remark @wayland Setting the window to full screen will not attempt to3480* change the mode, no matter what the requested size or refresh rate.3481*3482* @thread_safety This function must only be called from the main thread.3483*3484* @sa @ref window_monitor3485* @sa @ref window_full_screen3486* @sa @ref glfwGetWindowMonitor3487* @sa @ref glfwSetWindowSize3488*3489* @since Added in version 3.2.3490*3491* @ingroup window3492*/3493GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);34943495/*! @brief Returns an attribute of the specified window.3496*3497* This function returns the value of an attribute of the specified window or3498* its OpenGL or OpenGL ES context.3499*3500* @param[in] window The window to query.3501* @param[in] attrib The [window attribute](@ref window_attribs) whose value to3502* return.3503* @return The value of the attribute, or zero if an3504* [error](@ref error_handling) occurred.3505*3506* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref3507* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.3508*3509* @remark Framebuffer related hints are not window attributes. See @ref3510* window_attribs_fb for more information.3511*3512* @remark Zero is a valid value for many window and context related3513* attributes so you cannot use a return value of zero as an indication of3514* errors. However, this function should not fail as long as it is passed3515* valid arguments and the library has been [initialized](@ref intro_init).3516*3517* @remark @wayland The Wayland protocol provides no way to check whether a3518* window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`.3519*3520* @thread_safety This function must only be called from the main thread.3521*3522* @sa @ref window_attribs3523* @sa @ref glfwSetWindowAttrib3524*3525* @since Added in version 3.0. Replaces `glfwGetWindowParam` and3526* `glfwGetGLVersion`.3527*3528* @ingroup window3529*/3530GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);35313532/*! @brief Sets an attribute of the specified window.3533*3534* This function sets the value of an attribute of the specified window.3535*3536* The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),3537* [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),3538* [GLFW_FLOATING](@ref GLFW_FLOATING_attrib),3539* [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and3540* [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib).3541*3542* Some of these attributes are ignored for full screen windows. The new3543* value will take effect if the window is later made windowed.3544*3545* Some of these attributes are ignored for windowed mode windows. The new3546* value will take effect if the window is later made full screen.3547*3548* @param[in] window The window to set the attribute for.3549* @param[in] attrib A supported window attribute.3550* @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.3551*3552* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref3553* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.3554*3555* @remark Calling @ref glfwGetWindowAttrib will always return the latest3556* value, even if that value is ignored by the current mode of the window.3557*3558* @thread_safety This function must only be called from the main thread.3559*3560* @sa @ref window_attribs3561* @sa @ref glfwGetWindowAttrib3562*3563* @since Added in version 3.3.3564*3565* @ingroup window3566*/3567GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);35683569/*! @brief Sets the user pointer of the specified window.3570*3571* This function sets the user-defined pointer of the specified window. The3572* current value is retained until the window is destroyed. The initial value3573* is `NULL`.3574*3575* @param[in] window The window whose pointer to set.3576* @param[in] pointer The new value.3577*3578* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3579*3580* @thread_safety This function may be called from any thread. Access is not3581* synchronized.3582*3583* @sa @ref window_userptr3584* @sa @ref glfwGetWindowUserPointer3585*3586* @since Added in version 3.0.3587*3588* @ingroup window3589*/3590GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);35913592/*! @brief Returns the user pointer of the specified window.3593*3594* This function returns the current value of the user-defined pointer of the3595* specified window. The initial value is `NULL`.3596*3597* @param[in] window The window whose pointer to return.3598*3599* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3600*3601* @thread_safety This function may be called from any thread. Access is not3602* synchronized.3603*3604* @sa @ref window_userptr3605* @sa @ref glfwSetWindowUserPointer3606*3607* @since Added in version 3.0.3608*3609* @ingroup window3610*/3611GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);36123613/*! @brief Sets the position callback for the specified window.3614*3615* This function sets the position callback of the specified window, which is3616* called when the window is moved. The callback is provided with the3617* position, in screen coordinates, of the upper-left corner of the content3618* area of the window.3619*3620* @param[in] window The window whose callback to set.3621* @param[in] callback The new callback, or `NULL` to remove the currently set3622* callback.3623* @return The previously set callback, or `NULL` if no callback was set or the3624* library had not been [initialized](@ref intro_init).3625*3626* @callback_signature3627* @code3628* void function_name(GLFWwindow* window, int xpos, int ypos)3629* @endcode3630* For more information about the callback parameters, see the3631* [function pointer type](@ref GLFWwindowposfun).3632*3633* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3634*3635* @remark @wayland This callback will never be called, as there is no way for3636* an application to know its global position.3637*3638* @thread_safety This function must only be called from the main thread.3639*3640* @sa @ref window_pos3641*3642* @since Added in version 3.0.3643*3644* @ingroup window3645*/3646GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback);36473648/*! @brief Sets the size callback for the specified window.3649*3650* This function sets the size callback of the specified window, which is3651* called when the window is resized. The callback is provided with the size,3652* in screen coordinates, of the content area of the window.3653*3654* @param[in] window The window whose callback to set.3655* @param[in] callback The new callback, or `NULL` to remove the currently set3656* callback.3657* @return The previously set callback, or `NULL` if no callback was set or the3658* library had not been [initialized](@ref intro_init).3659*3660* @callback_signature3661* @code3662* void function_name(GLFWwindow* window, int width, int height)3663* @endcode3664* For more information about the callback parameters, see the3665* [function pointer type](@ref GLFWwindowsizefun).3666*3667* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3668*3669* @thread_safety This function must only be called from the main thread.3670*3671* @sa @ref window_size3672*3673* @since Added in version 1.0.3674* @glfw3 Added window handle parameter and return value.3675*3676* @ingroup window3677*/3678GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback);36793680/*! @brief Sets the close callback for the specified window.3681*3682* This function sets the close callback of the specified window, which is3683* called when the user attempts to close the window, for example by clicking3684* the close widget in the title bar.3685*3686* The close flag is set before this callback is called, but you can modify it3687* at any time with @ref glfwSetWindowShouldClose.3688*3689* The close callback is not triggered by @ref glfwDestroyWindow.3690*3691* @param[in] window The window whose callback to set.3692* @param[in] callback The new callback, or `NULL` to remove the currently set3693* callback.3694* @return The previously set callback, or `NULL` if no callback was set or the3695* library had not been [initialized](@ref intro_init).3696*3697* @callback_signature3698* @code3699* void function_name(GLFWwindow* window)3700* @endcode3701* For more information about the callback parameters, see the3702* [function pointer type](@ref GLFWwindowclosefun).3703*3704* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3705*3706* @remark @macos Selecting Quit from the application menu will trigger the3707* close callback for all windows.3708*3709* @thread_safety This function must only be called from the main thread.3710*3711* @sa @ref window_close3712*3713* @since Added in version 2.5.3714* @glfw3 Added window handle parameter and return value.3715*3716* @ingroup window3717*/3718GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback);37193720/*! @brief Sets the refresh callback for the specified window.3721*3722* This function sets the refresh callback of the specified window, which is3723* called when the content area of the window needs to be redrawn, for example3724* if the window has been exposed after having been covered by another window.3725*3726* On compositing window systems such as Aero, Compiz, Aqua or Wayland, where3727* the window contents are saved off-screen, this callback may be called only3728* very infrequently or never at all.3729*3730* @param[in] window The window whose callback to set.3731* @param[in] callback The new callback, or `NULL` to remove the currently set3732* callback.3733* @return The previously set callback, or `NULL` if no callback was set or the3734* library had not been [initialized](@ref intro_init).3735*3736* @callback_signature3737* @code3738* void function_name(GLFWwindow* window);3739* @endcode3740* For more information about the callback parameters, see the3741* [function pointer type](@ref GLFWwindowrefreshfun).3742*3743* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3744*3745* @thread_safety This function must only be called from the main thread.3746*3747* @sa @ref window_refresh3748*3749* @since Added in version 2.5.3750* @glfw3 Added window handle parameter and return value.3751*3752* @ingroup window3753*/3754GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback);37553756/*! @brief Sets the focus callback for the specified window.3757*3758* This function sets the focus callback of the specified window, which is3759* called when the window gains or loses input focus.3760*3761* After the focus callback is called for a window that lost input focus,3762* synthetic key and mouse button release events will be generated for all such3763* that had been pressed. For more information, see @ref glfwSetKeyCallback3764* and @ref glfwSetMouseButtonCallback.3765*3766* @param[in] window The window whose callback to set.3767* @param[in] callback The new callback, or `NULL` to remove the currently set3768* callback.3769* @return The previously set callback, or `NULL` if no callback was set or the3770* library had not been [initialized](@ref intro_init).3771*3772* @callback_signature3773* @code3774* void function_name(GLFWwindow* window, int focused)3775* @endcode3776* For more information about the callback parameters, see the3777* [function pointer type](@ref GLFWwindowfocusfun).3778*3779* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3780*3781* @thread_safety This function must only be called from the main thread.3782*3783* @sa @ref window_focus3784*3785* @since Added in version 3.0.3786*3787* @ingroup window3788*/3789GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback);37903791/*! @brief Sets the iconify callback for the specified window.3792*3793* This function sets the iconification callback of the specified window, which3794* is called when the window is iconified or restored.3795*3796* @param[in] window The window whose callback to set.3797* @param[in] callback The new callback, or `NULL` to remove the currently set3798* callback.3799* @return The previously set callback, or `NULL` if no callback was set or the3800* library had not been [initialized](@ref intro_init).3801*3802* @callback_signature3803* @code3804* void function_name(GLFWwindow* window, int iconified)3805* @endcode3806* For more information about the callback parameters, see the3807* [function pointer type](@ref GLFWwindowiconifyfun).3808*3809* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3810*3811* @remark @wayland The XDG-shell protocol has no event for iconification, so3812* this callback will never be called.3813*3814* @thread_safety This function must only be called from the main thread.3815*3816* @sa @ref window_iconify3817*3818* @since Added in version 3.0.3819*3820* @ingroup window3821*/3822GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback);38233824/*! @brief Sets the maximize callback for the specified window.3825*3826* This function sets the maximization callback of the specified window, which3827* is called when the window is maximized or restored.3828*3829* @param[in] window The window whose callback to set.3830* @param[in] callback The new callback, or `NULL` to remove the currently set3831* callback.3832* @return The previously set callback, or `NULL` if no callback was set or the3833* library had not been [initialized](@ref intro_init).3834*3835* @callback_signature3836* @code3837* void function_name(GLFWwindow* window, int maximized)3838* @endcode3839* For more information about the callback parameters, see the3840* [function pointer type](@ref GLFWwindowmaximizefun).3841*3842* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3843*3844* @thread_safety This function must only be called from the main thread.3845*3846* @sa @ref window_maximize3847*3848* @since Added in version 3.3.3849*3850* @ingroup window3851*/3852GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback);38533854/*! @brief Sets the framebuffer resize callback for the specified window.3855*3856* This function sets the framebuffer resize callback of the specified window,3857* which is called when the framebuffer of the specified window is resized.3858*3859* @param[in] window The window whose callback to set.3860* @param[in] callback The new callback, or `NULL` to remove the currently set3861* callback.3862* @return The previously set callback, or `NULL` if no callback was set or the3863* library had not been [initialized](@ref intro_init).3864*3865* @callback_signature3866* @code3867* void function_name(GLFWwindow* window, int width, int height)3868* @endcode3869* For more information about the callback parameters, see the3870* [function pointer type](@ref GLFWframebuffersizefun).3871*3872* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3873*3874* @thread_safety This function must only be called from the main thread.3875*3876* @sa @ref window_fbsize3877*3878* @since Added in version 3.0.3879*3880* @ingroup window3881*/3882GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback);38833884/*! @brief Sets the window content scale callback for the specified window.3885*3886* This function sets the window content scale callback of the specified window,3887* which is called when the content scale of the specified window changes.3888*3889* @param[in] window The window whose callback to set.3890* @param[in] callback The new callback, or `NULL` to remove the currently set3891* callback.3892* @return The previously set callback, or `NULL` if no callback was set or the3893* library had not been [initialized](@ref intro_init).3894*3895* @callback_signature3896* @code3897* void function_name(GLFWwindow* window, float xscale, float yscale)3898* @endcode3899* For more information about the callback parameters, see the3900* [function pointer type](@ref GLFWwindowcontentscalefun).3901*3902* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.3903*3904* @thread_safety This function must only be called from the main thread.3905*3906* @sa @ref window_scale3907* @sa @ref glfwGetWindowContentScale3908*3909* @since Added in version 3.3.3910*3911* @ingroup window3912*/3913GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback);39143915/*! @brief Processes all pending events.3916*3917* This function processes only those events that are already in the event3918* queue and then returns immediately. Processing events will cause the window3919* and input callbacks associated with those events to be called.3920*3921* On some platforms, a window move, resize or menu operation will cause event3922* processing to block. This is due to how event processing is designed on3923* those platforms. You can use the3924* [window refresh callback](@ref window_refresh) to redraw the contents of3925* your window when necessary during such operations.3926*3927* Do not assume that callbacks you set will _only_ be called in response to3928* event processing functions like this one. While it is necessary to poll for3929* events, window systems that require GLFW to register callbacks of its own3930* can pass events to GLFW in response to many window system function calls.3931* GLFW will pass those events on to the application callbacks before3932* returning.3933*3934* Event processing is not required for joystick input to work.3935*3936* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3937* GLFW_PLATFORM_ERROR.3938*3939* @reentrancy This function must not be called from a callback.3940*3941* @thread_safety This function must only be called from the main thread.3942*3943* @sa @ref events3944* @sa @ref glfwWaitEvents3945* @sa @ref glfwWaitEventsTimeout3946*3947* @since Added in version 1.0.3948*3949* @ingroup window3950*/3951GLFWAPI void glfwPollEvents(void);39523953/*! @brief Waits until events are queued and processes them.3954*3955* This function puts the calling thread to sleep until at least one event is3956* available in the event queue. Once one or more events are available,3957* it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue3958* are processed and the function then returns immediately. Processing events3959* will cause the window and input callbacks associated with those events to be3960* called.3961*3962* Since not all events are associated with callbacks, this function may return3963* without a callback having been called even if you are monitoring all3964* callbacks.3965*3966* On some platforms, a window move, resize or menu operation will cause event3967* processing to block. This is due to how event processing is designed on3968* those platforms. You can use the3969* [window refresh callback](@ref window_refresh) to redraw the contents of3970* your window when necessary during such operations.3971*3972* Do not assume that callbacks you set will _only_ be called in response to3973* event processing functions like this one. While it is necessary to poll for3974* events, window systems that require GLFW to register callbacks of its own3975* can pass events to GLFW in response to many window system function calls.3976* GLFW will pass those events on to the application callbacks before3977* returning.3978*3979* Event processing is not required for joystick input to work.3980*3981* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref3982* GLFW_PLATFORM_ERROR.3983*3984* @reentrancy This function must not be called from a callback.3985*3986* @thread_safety This function must only be called from the main thread.3987*3988* @sa @ref events3989* @sa @ref glfwPollEvents3990* @sa @ref glfwWaitEventsTimeout3991*3992* @since Added in version 2.5.3993*3994* @ingroup window3995*/3996GLFWAPI void glfwWaitEvents(void);39973998/*! @brief Waits with timeout until events are queued and processes them.3999*4000* This function puts the calling thread to sleep until at least one event is4001* available in the event queue, or until the specified timeout is reached. If4002* one or more events are available, it behaves exactly like @ref4003* glfwPollEvents, i.e. the events in the queue are processed and the function4004* then returns immediately. Processing events will cause the window and input4005* callbacks associated with those events to be called.4006*4007* The timeout value must be a positive finite number.4008*4009* Since not all events are associated with callbacks, this function may return4010* without a callback having been called even if you are monitoring all4011* callbacks.4012*4013* On some platforms, a window move, resize or menu operation will cause event4014* processing to block. This is due to how event processing is designed on4015* those platforms. You can use the4016* [window refresh callback](@ref window_refresh) to redraw the contents of4017* your window when necessary during such operations.4018*4019* Do not assume that callbacks you set will _only_ be called in response to4020* event processing functions like this one. While it is necessary to poll for4021* events, window systems that require GLFW to register callbacks of its own4022* can pass events to GLFW in response to many window system function calls.4023* GLFW will pass those events on to the application callbacks before4024* returning.4025*4026* Event processing is not required for joystick input to work.4027*4028* @param[in] timeout The maximum amount of time, in seconds, to wait.4029*4030* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4031* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.4032*4033* @reentrancy This function must not be called from a callback.4034*4035* @thread_safety This function must only be called from the main thread.4036*4037* @sa @ref events4038* @sa @ref glfwPollEvents4039* @sa @ref glfwWaitEvents4040*4041* @since Added in version 3.2.4042*4043* @ingroup window4044*/4045GLFWAPI void glfwWaitEventsTimeout(double timeout);40464047/*! @brief Posts an empty event to the event queue.4048*4049* This function posts an empty event from the current thread to the event4050* queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.4051*4052* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4053* GLFW_PLATFORM_ERROR.4054*4055* @thread_safety This function may be called from any thread.4056*4057* @sa @ref events4058* @sa @ref glfwWaitEvents4059* @sa @ref glfwWaitEventsTimeout4060*4061* @since Added in version 3.1.4062*4063* @ingroup window4064*/4065GLFWAPI void glfwPostEmptyEvent(void);40664067/*! @brief Returns the value of an input option for the specified window.4068*4069* This function returns the value of an input option for the specified window.4070* The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,4071* @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or4072* @ref GLFW_RAW_MOUSE_MOTION.4073*4074* @param[in] window The window to query.4075* @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,4076* `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or4077* `GLFW_RAW_MOUSE_MOTION`.4078*4079* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4080* GLFW_INVALID_ENUM.4081*4082* @thread_safety This function must only be called from the main thread.4083*4084* @sa @ref glfwSetInputMode4085*4086* @since Added in version 3.0.4087*4088* @ingroup input4089*/4090GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);40914092/*! @brief Sets an input option for the specified window.4093*4094* This function sets an input mode option for the specified window. The mode4095* must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,4096* @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or4097* @ref GLFW_RAW_MOUSE_MOTION.4098*4099* If the mode is `GLFW_CURSOR`, the value must be one of the following cursor4100* modes:4101* - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.4102* - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the4103* content area of the window but does not restrict the cursor from leaving.4104* - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual4105* and unlimited cursor movement. This is useful for implementing for4106* example 3D camera controls.4107*4108* If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to4109* enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are4110* enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`4111* the next time it is called even if the key had been released before the4112* call. This is useful when you are only interested in whether keys have been4113* pressed but not when or in which order.4114*4115* If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either4116* `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.4117* If sticky mouse buttons are enabled, a mouse button press will ensure that4118* @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even4119* if the mouse button had been released before the call. This is useful when4120* you are only interested in whether mouse buttons have been pressed but not4121* when or in which order.4122*4123* If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to4124* enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled,4125* callbacks that receive modifier bits will also have the @ref4126* GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on,4127* and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on.4128*4129* If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE`4130* to enable raw (unscaled and unaccelerated) mouse motion when the cursor is4131* disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported,4132* attempting to set this will emit @ref GLFW_PLATFORM_ERROR. Call @ref4133* glfwRawMouseMotionSupported to check for support.4134*4135* @param[in] window The window whose input mode to set.4136* @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,4137* `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or4138* `GLFW_RAW_MOUSE_MOTION`.4139* @param[in] value The new value of the specified input mode.4140*4141* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4142* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.4143*4144* @thread_safety This function must only be called from the main thread.4145*4146* @sa @ref glfwGetInputMode4147*4148* @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.4149*4150* @ingroup input4151*/4152GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);41534154/*! @brief Returns whether raw mouse motion is supported.4155*4156* This function returns whether raw mouse motion is supported on the current4157* system. This status does not change after GLFW has been initialized so you4158* only need to check this once. If you attempt to enable raw motion on4159* a system that does not support it, @ref GLFW_PLATFORM_ERROR will be emitted.4160*4161* Raw mouse motion is closer to the actual motion of the mouse across4162* a surface. It is not affected by the scaling and acceleration applied to4163* the motion of the desktop cursor. That processing is suitable for a cursor4164* while raw motion is better for controlling for example a 3D camera. Because4165* of this, raw mouse motion is only provided when the cursor is disabled.4166*4167* @return `GLFW_TRUE` if raw mouse motion is supported on the current machine,4168* or `GLFW_FALSE` otherwise.4169*4170* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4171*4172* @thread_safety This function must only be called from the main thread.4173*4174* @sa @ref raw_mouse_motion4175* @sa @ref glfwSetInputMode4176*4177* @since Added in version 3.3.4178*4179* @ingroup input4180*/4181GLFWAPI int glfwRawMouseMotionSupported(void);41824183/*! @brief Returns the layout-specific name of the specified printable key.4184*4185* This function returns the name of the specified printable key, encoded as4186* UTF-8. This is typically the character that key would produce without any4187* modifier keys, intended for displaying key bindings to the user. For dead4188* keys, it is typically the diacritic it would add to a character.4189*4190* __Do not use this function__ for [text input](@ref input_char). You will4191* break text input for many languages even if it happens to work for yours.4192*4193* If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key,4194* otherwise the scancode is ignored. If you specify a non-printable key, or4195* `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this4196* function returns `NULL` but does not emit an error.4197*4198* This behavior allows you to always pass in the arguments in the4199* [key callback](@ref input_key) without modification.4200*4201* The printable keys are:4202* - `GLFW_KEY_APOSTROPHE`4203* - `GLFW_KEY_COMMA`4204* - `GLFW_KEY_MINUS`4205* - `GLFW_KEY_PERIOD`4206* - `GLFW_KEY_SLASH`4207* - `GLFW_KEY_SEMICOLON`4208* - `GLFW_KEY_EQUAL`4209* - `GLFW_KEY_LEFT_BRACKET`4210* - `GLFW_KEY_RIGHT_BRACKET`4211* - `GLFW_KEY_BACKSLASH`4212* - `GLFW_KEY_WORLD_1`4213* - `GLFW_KEY_WORLD_2`4214* - `GLFW_KEY_0` to `GLFW_KEY_9`4215* - `GLFW_KEY_A` to `GLFW_KEY_Z`4216* - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`4217* - `GLFW_KEY_KP_DECIMAL`4218* - `GLFW_KEY_KP_DIVIDE`4219* - `GLFW_KEY_KP_MULTIPLY`4220* - `GLFW_KEY_KP_SUBTRACT`4221* - `GLFW_KEY_KP_ADD`4222* - `GLFW_KEY_KP_EQUAL`4223*4224* Names for printable keys depend on keyboard layout, while names for4225* non-printable keys are the same across layouts but depend on the application4226* language and should be localized along with other user interface text.4227*4228* @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.4229* @param[in] scancode The scancode of the key to query.4230* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.4231*4232* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4233* GLFW_PLATFORM_ERROR.4234*4235* @remark The contents of the returned string may change when a keyboard4236* layout change event is received.4237*4238* @pointer_lifetime The returned string is allocated and freed by GLFW. You4239* should not free it yourself. It is valid until the library is terminated.4240*4241* @thread_safety This function must only be called from the main thread.4242*4243* @sa @ref input_key_name4244*4245* @since Added in version 3.2.4246*4247* @ingroup input4248*/4249GLFWAPI const char* glfwGetKeyName(int key, int scancode);42504251/*! @brief Returns the platform-specific scancode of the specified key.4252*4253* This function returns the platform-specific scancode of the specified key.4254*4255* If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this4256* method will return `-1`.4257*4258* @param[in] key Any [named key](@ref keys).4259* @return The platform-specific scancode for the key, or `-1` if an4260* [error](@ref error_handling) occurred.4261*4262* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4263* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.4264*4265* @thread_safety This function may be called from any thread.4266*4267* @sa @ref input_key4268*4269* @since Added in version 3.3.4270*4271* @ingroup input4272*/4273GLFWAPI int glfwGetKeyScancode(int key);42744275/*! @brief Returns the last reported state of a keyboard key for the specified4276* window.4277*4278* This function returns the last state reported for the specified key to the4279* specified window. The returned state is one of `GLFW_PRESS` or4280* `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback.4281*4282* If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns4283* `GLFW_PRESS` the first time you call it for a key that was pressed, even if4284* that key has already been released.4285*4286* The key functions deal with physical keys, with [key tokens](@ref keys)4287* named after their use on the standard US keyboard layout. If you want to4288* input text, use the Unicode character callback instead.4289*4290* The [modifier key bit masks](@ref mods) are not key tokens and cannot be4291* used with this function.4292*4293* __Do not use this function__ to implement [text input](@ref input_char).4294*4295* @param[in] window The desired window.4296* @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is4297* not a valid key for this function.4298* @return One of `GLFW_PRESS` or `GLFW_RELEASE`.4299*4300* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4301* GLFW_INVALID_ENUM.4302*4303* @thread_safety This function must only be called from the main thread.4304*4305* @sa @ref input_key4306*4307* @since Added in version 1.0.4308* @glfw3 Added window handle parameter.4309*4310* @ingroup input4311*/4312GLFWAPI int glfwGetKey(GLFWwindow* window, int key);43134314/*! @brief Returns the last reported state of a mouse button for the specified4315* window.4316*4317* This function returns the last state reported for the specified mouse button4318* to the specified window. The returned state is one of `GLFW_PRESS` or4319* `GLFW_RELEASE`.4320*4321* If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function4322* returns `GLFW_PRESS` the first time you call it for a mouse button that was4323* pressed, even if that mouse button has already been released.4324*4325* @param[in] window The desired window.4326* @param[in] button The desired [mouse button](@ref buttons).4327* @return One of `GLFW_PRESS` or `GLFW_RELEASE`.4328*4329* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4330* GLFW_INVALID_ENUM.4331*4332* @thread_safety This function must only be called from the main thread.4333*4334* @sa @ref input_mouse_button4335*4336* @since Added in version 1.0.4337* @glfw3 Added window handle parameter.4338*4339* @ingroup input4340*/4341GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);43424343/*! @brief Retrieves the position of the cursor relative to the content area of4344* the window.4345*4346* This function returns the position of the cursor, in screen coordinates,4347* relative to the upper-left corner of the content area of the specified4348* window.4349*4350* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor4351* position is unbounded and limited only by the minimum and maximum values of4352* a `double`.4353*4354* The coordinate can be converted to their integer equivalents with the4355* `floor` function. Casting directly to an integer type works for positive4356* coordinates, but fails for negative ones.4357*4358* Any or all of the position arguments may be `NULL`. If an error occurs, all4359* non-`NULL` position arguments will be set to zero.4360*4361* @param[in] window The desired window.4362* @param[out] xpos Where to store the cursor x-coordinate, relative to the4363* left edge of the content area, or `NULL`.4364* @param[out] ypos Where to store the cursor y-coordinate, relative to the to4365* top edge of the content area, or `NULL`.4366*4367* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4368* GLFW_PLATFORM_ERROR.4369*4370* @thread_safety This function must only be called from the main thread.4371*4372* @sa @ref cursor_pos4373* @sa @ref glfwSetCursorPos4374*4375* @since Added in version 3.0. Replaces `glfwGetMousePos`.4376*4377* @ingroup input4378*/4379GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);43804381/*! @brief Sets the position of the cursor, relative to the content area of the4382* window.4383*4384* This function sets the position, in screen coordinates, of the cursor4385* relative to the upper-left corner of the content area of the specified4386* window. The window must have input focus. If the window does not have4387* input focus when this function is called, it fails silently.4388*4389* __Do not use this function__ to implement things like camera controls. GLFW4390* already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the4391* cursor, transparently re-centers it and provides unconstrained cursor4392* motion. See @ref glfwSetInputMode for more information.4393*4394* If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is4395* unconstrained and limited only by the minimum and maximum values of4396* a `double`.4397*4398* @param[in] window The desired window.4399* @param[in] xpos The desired x-coordinate, relative to the left edge of the4400* content area.4401* @param[in] ypos The desired y-coordinate, relative to the top edge of the4402* content area.4403*4404* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4405* GLFW_PLATFORM_ERROR.4406*4407* @remark @wayland This function will only work when the cursor mode is4408* `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.4409*4410* @thread_safety This function must only be called from the main thread.4411*4412* @sa @ref cursor_pos4413* @sa @ref glfwGetCursorPos4414*4415* @since Added in version 3.0. Replaces `glfwSetMousePos`.4416*4417* @ingroup input4418*/4419GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);44204421/*! @brief Creates a custom cursor.4422*4423* Creates a new custom cursor image that can be set for a window with @ref4424* glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.4425* Any remaining cursors are destroyed by @ref glfwTerminate.4426*4427* The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight4428* bits per channel with the red channel first. They are arranged canonically4429* as packed sequential rows, starting from the top-left corner.4430*4431* The cursor hotspot is specified in pixels, relative to the upper-left corner4432* of the cursor image. Like all other coordinate systems in GLFW, the X-axis4433* points to the right and the Y-axis points down.4434*4435* @param[in] image The desired cursor image.4436* @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.4437* @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.4438* @return The handle of the created cursor, or `NULL` if an4439* [error](@ref error_handling) occurred.4440*4441* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4442* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.4443*4444* @pointer_lifetime The specified image data is copied before this function4445* returns.4446*4447* @thread_safety This function must only be called from the main thread.4448*4449* @sa @ref cursor_object4450* @sa @ref glfwDestroyCursor4451* @sa @ref glfwCreateStandardCursor4452*4453* @since Added in version 3.1.4454*4455* @ingroup input4456*/4457GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);44584459/*! @brief Creates a cursor with a standard shape.4460*4461* Returns a cursor with a [standard shape](@ref shapes), that can be set for4462* a window with @ref glfwSetCursor.4463*4464* @param[in] shape One of the [standard shapes](@ref shapes).4465* @return A new cursor ready to use or `NULL` if an4466* [error](@ref error_handling) occurred.4467*4468* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4469* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.4470*4471* @thread_safety This function must only be called from the main thread.4472*4473* @sa @ref cursor_object4474* @sa @ref glfwCreateCursor4475*4476* @since Added in version 3.1.4477*4478* @ingroup input4479*/4480GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);44814482/*! @brief Destroys a cursor.4483*4484* This function destroys a cursor previously created with @ref4485* glfwCreateCursor. Any remaining cursors will be destroyed by @ref4486* glfwTerminate.4487*4488* If the specified cursor is current for any window, that window will be4489* reverted to the default cursor. This does not affect the cursor mode.4490*4491* @param[in] cursor The cursor object to destroy.4492*4493* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4494* GLFW_PLATFORM_ERROR.4495*4496* @reentrancy This function must not be called from a callback.4497*4498* @thread_safety This function must only be called from the main thread.4499*4500* @sa @ref cursor_object4501* @sa @ref glfwCreateCursor4502*4503* @since Added in version 3.1.4504*4505* @ingroup input4506*/4507GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);45084509/*! @brief Sets the cursor for the window.4510*4511* This function sets the cursor image to be used when the cursor is over the4512* content area of the specified window. The set cursor will only be visible4513* when the [cursor mode](@ref cursor_mode) of the window is4514* `GLFW_CURSOR_NORMAL`.4515*4516* On some platforms, the set cursor may not be visible unless the window also4517* has input focus.4518*4519* @param[in] window The window to set the cursor for.4520* @param[in] cursor The cursor to set, or `NULL` to switch back to the default4521* arrow cursor.4522*4523* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref4524* GLFW_PLATFORM_ERROR.4525*4526* @thread_safety This function must only be called from the main thread.4527*4528* @sa @ref cursor_object4529*4530* @since Added in version 3.1.4531*4532* @ingroup input4533*/4534GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);45354536/*! @brief Sets the key callback.4537*4538* This function sets the key callback of the specified window, which is called4539* when a key is pressed, repeated or released.4540*4541* The key functions deal with physical keys, with layout independent4542* [key tokens](@ref keys) named after their values in the standard US keyboard4543* layout. If you want to input text, use the4544* [character callback](@ref glfwSetCharCallback) instead.4545*4546* When a window loses input focus, it will generate synthetic key release4547* events for all pressed keys. You can tell these events from user-generated4548* events by the fact that the synthetic ones are generated after the focus4549* loss event has been processed, i.e. after the4550* [window focus callback](@ref glfwSetWindowFocusCallback) has been called.4551*4552* The scancode of a key is specific to that platform or sometimes even to that4553* machine. Scancodes are intended to allow users to bind keys that don't have4554* a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their4555* state is not saved and so it cannot be queried with @ref glfwGetKey.4556*4557* Sometimes GLFW needs to generate synthetic key events, in which case the4558* scancode may be zero.4559*4560* @param[in] window The window whose callback to set.4561* @param[in] callback The new key callback, or `NULL` to remove the currently4562* set callback.4563* @return The previously set callback, or `NULL` if no callback was set or the4564* library had not been [initialized](@ref intro_init).4565*4566* @callback_signature4567* @code4568* void function_name(GLFWwindow* window, int key, int scancode, int action, int mods)4569* @endcode4570* For more information about the callback parameters, see the4571* [function pointer type](@ref GLFWkeyfun).4572*4573* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4574*4575* @thread_safety This function must only be called from the main thread.4576*4577* @sa @ref input_key4578*4579* @since Added in version 1.0.4580* @glfw3 Added window handle parameter and return value.4581*4582* @ingroup input4583*/4584GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);45854586/*! @brief Sets the Unicode character callback.4587*4588* This function sets the character callback of the specified window, which is4589* called when a Unicode character is input.4590*4591* The character callback is intended for Unicode text input. As it deals with4592* characters, it is keyboard layout dependent, whereas the4593* [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:14594* to physical keys, as a key may produce zero, one or more characters. If you4595* want to know whether a specific physical key was pressed or released, see4596* the key callback instead.4597*4598* The character callback behaves as system text input normally does and will4599* not be called if modifier keys are held down that would prevent normal text4600* input on that platform, for example a Super (Command) key on macOS or Alt key4601* on Windows.4602*4603* @param[in] window The window whose callback to set.4604* @param[in] callback The new callback, or `NULL` to remove the currently set4605* callback.4606* @return The previously set callback, or `NULL` if no callback was set or the4607* library had not been [initialized](@ref intro_init).4608*4609* @callback_signature4610* @code4611* void function_name(GLFWwindow* window, unsigned int codepoint)4612* @endcode4613* For more information about the callback parameters, see the4614* [function pointer type](@ref GLFWcharfun).4615*4616* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4617*4618* @thread_safety This function must only be called from the main thread.4619*4620* @sa @ref input_char4621*4622* @since Added in version 2.4.4623* @glfw3 Added window handle parameter and return value.4624*4625* @ingroup input4626*/4627GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback);46284629/*! @brief Sets the Unicode character with modifiers callback.4630*4631* This function sets the character with modifiers callback of the specified4632* window, which is called when a Unicode character is input regardless of what4633* modifier keys are used.4634*4635* The character with modifiers callback is intended for implementing custom4636* Unicode character input. For regular Unicode text input, see the4637* [character callback](@ref glfwSetCharCallback). Like the character4638* callback, the character with modifiers callback deals with characters and is4639* keyboard layout dependent. Characters do not map 1:1 to physical keys, as4640* a key may produce zero, one or more characters. If you want to know whether4641* a specific physical key was pressed or released, see the4642* [key callback](@ref glfwSetKeyCallback) instead.4643*4644* @param[in] window The window whose callback to set.4645* @param[in] callback The new callback, or `NULL` to remove the currently set4646* callback.4647* @return The previously set callback, or `NULL` if no callback was set or an4648* [error](@ref error_handling) occurred.4649*4650* @callback_signature4651* @code4652* void function_name(GLFWwindow* window, unsigned int codepoint, int mods)4653* @endcode4654* For more information about the callback parameters, see the4655* [function pointer type](@ref GLFWcharmodsfun).4656*4657* @deprecated Scheduled for removal in version 4.0.4658*4659* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4660*4661* @thread_safety This function must only be called from the main thread.4662*4663* @sa @ref input_char4664*4665* @since Added in version 3.1.4666*4667* @ingroup input4668*/4669GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback);46704671/*! @brief Sets the mouse button callback.4672*4673* This function sets the mouse button callback of the specified window, which4674* is called when a mouse button is pressed or released.4675*4676* When a window loses input focus, it will generate synthetic mouse button4677* release events for all pressed mouse buttons. You can tell these events4678* from user-generated events by the fact that the synthetic ones are generated4679* after the focus loss event has been processed, i.e. after the4680* [window focus callback](@ref glfwSetWindowFocusCallback) has been called.4681*4682* @param[in] window The window whose callback to set.4683* @param[in] callback The new callback, or `NULL` to remove the currently set4684* callback.4685* @return The previously set callback, or `NULL` if no callback was set or the4686* library had not been [initialized](@ref intro_init).4687*4688* @callback_signature4689* @code4690* void function_name(GLFWwindow* window, int button, int action, int mods)4691* @endcode4692* For more information about the callback parameters, see the4693* [function pointer type](@ref GLFWmousebuttonfun).4694*4695* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4696*4697* @thread_safety This function must only be called from the main thread.4698*4699* @sa @ref input_mouse_button4700*4701* @since Added in version 1.0.4702* @glfw3 Added window handle parameter and return value.4703*4704* @ingroup input4705*/4706GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback);47074708/*! @brief Sets the cursor position callback.4709*4710* This function sets the cursor position callback of the specified window,4711* which is called when the cursor is moved. The callback is provided with the4712* position, in screen coordinates, relative to the upper-left corner of the4713* content area of the window.4714*4715* @param[in] window The window whose callback to set.4716* @param[in] callback The new callback, or `NULL` to remove the currently set4717* callback.4718* @return The previously set callback, or `NULL` if no callback was set or the4719* library had not been [initialized](@ref intro_init).4720*4721* @callback_signature4722* @code4723* void function_name(GLFWwindow* window, double xpos, double ypos);4724* @endcode4725* For more information about the callback parameters, see the4726* [function pointer type](@ref GLFWcursorposfun).4727*4728* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4729*4730* @thread_safety This function must only be called from the main thread.4731*4732* @sa @ref cursor_pos4733*4734* @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.4735*4736* @ingroup input4737*/4738GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback);47394740/*! @brief Sets the cursor enter/leave callback.4741*4742* This function sets the cursor boundary crossing callback of the specified4743* window, which is called when the cursor enters or leaves the content area of4744* the window.4745*4746* @param[in] window The window whose callback to set.4747* @param[in] callback The new callback, or `NULL` to remove the currently set4748* callback.4749* @return The previously set callback, or `NULL` if no callback was set or the4750* library had not been [initialized](@ref intro_init).4751*4752* @callback_signature4753* @code4754* void function_name(GLFWwindow* window, int entered)4755* @endcode4756* For more information about the callback parameters, see the4757* [function pointer type](@ref GLFWcursorenterfun).4758*4759* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4760*4761* @thread_safety This function must only be called from the main thread.4762*4763* @sa @ref cursor_enter4764*4765* @since Added in version 3.0.4766*4767* @ingroup input4768*/4769GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback);47704771/*! @brief Sets the scroll callback.4772*4773* This function sets the scroll callback of the specified window, which is4774* called when a scrolling device is used, such as a mouse wheel or scrolling4775* area of a touchpad.4776*4777* The scroll callback receives all scrolling input, like that from a mouse4778* wheel or a touchpad scrolling area.4779*4780* @param[in] window The window whose callback to set.4781* @param[in] callback The new scroll callback, or `NULL` to remove the4782* currently set callback.4783* @return The previously set callback, or `NULL` if no callback was set or the4784* library had not been [initialized](@ref intro_init).4785*4786* @callback_signature4787* @code4788* void function_name(GLFWwindow* window, double xoffset, double yoffset)4789* @endcode4790* For more information about the callback parameters, see the4791* [function pointer type](@ref GLFWscrollfun).4792*4793* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4794*4795* @thread_safety This function must only be called from the main thread.4796*4797* @sa @ref scrolling4798*4799* @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.4800*4801* @ingroup input4802*/4803GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback);48044805/*! @brief Sets the path drop callback.4806*4807* This function sets the path drop callback of the specified window, which is4808* called when one or more dragged paths are dropped on the window.4809*4810* Because the path array and its strings may have been generated specifically4811* for that event, they are not guaranteed to be valid after the callback has4812* returned. If you wish to use them after the callback returns, you need to4813* make a deep copy.4814*4815* @param[in] window The window whose callback to set.4816* @param[in] callback The new file drop callback, or `NULL` to remove the4817* currently set callback.4818* @return The previously set callback, or `NULL` if no callback was set or the4819* library had not been [initialized](@ref intro_init).4820*4821* @callback_signature4822* @code4823* void function_name(GLFWwindow* window, int path_count, const char* paths[])4824* @endcode4825* For more information about the callback parameters, see the4826* [function pointer type](@ref GLFWdropfun).4827*4828* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.4829*4830* @remark @wayland File drop is currently unimplemented.4831*4832* @thread_safety This function must only be called from the main thread.4833*4834* @sa @ref path_drop4835*4836* @since Added in version 3.1.4837*4838* @ingroup input4839*/4840GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback);48414842/*! @brief Returns whether the specified joystick is present.4843*4844* This function returns whether the specified joystick is present.4845*4846* There is no need to call this function before other functions that accept4847* a joystick ID, as they all check for presence before performing any other4848* work.4849*4850* @param[in] jid The [joystick](@ref joysticks) to query.4851* @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.4852*4853* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4854* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.4855*4856* @thread_safety This function must only be called from the main thread.4857*4858* @sa @ref joystick4859*4860* @since Added in version 3.0. Replaces `glfwGetJoystickParam`.4861*4862* @ingroup input4863*/4864GLFWAPI int glfwJoystickPresent(int jid);48654866/*! @brief Returns the values of all axes of the specified joystick.4867*4868* This function returns the values of all axes of the specified joystick.4869* Each element in the array is a value between -1.0 and 1.0.4870*4871* If the specified joystick is not present this function will return `NULL`4872* but will not generate an error. This can be used instead of first calling4873* @ref glfwJoystickPresent.4874*4875* @param[in] jid The [joystick](@ref joysticks) to query.4876* @param[out] count Where to store the number of axis values in the returned4877* array. This is set to zero if the joystick is not present or an error4878* occurred.4879* @return An array of axis values, or `NULL` if the joystick is not present or4880* an [error](@ref error_handling) occurred.4881*4882* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4883* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.4884*4885* @pointer_lifetime The returned array is allocated and freed by GLFW. You4886* should not free it yourself. It is valid until the specified joystick is4887* disconnected or the library is terminated.4888*4889* @thread_safety This function must only be called from the main thread.4890*4891* @sa @ref joystick_axis4892*4893* @since Added in version 3.0. Replaces `glfwGetJoystickPos`.4894*4895* @ingroup input4896*/4897GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);48984899/*! @brief Returns the state of all buttons of the specified joystick.4900*4901* This function returns the state of all buttons of the specified joystick.4902* Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.4903*4904* For backward compatibility with earlier versions that did not have @ref4905* glfwGetJoystickHats, the button array also includes all hats, each4906* represented as four buttons. The hats are in the same order as returned by4907* __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and4908* _left_. To disable these extra buttons, set the @ref4909* GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.4910*4911* If the specified joystick is not present this function will return `NULL`4912* but will not generate an error. This can be used instead of first calling4913* @ref glfwJoystickPresent.4914*4915* @param[in] jid The [joystick](@ref joysticks) to query.4916* @param[out] count Where to store the number of button states in the returned4917* array. This is set to zero if the joystick is not present or an error4918* occurred.4919* @return An array of button states, or `NULL` if the joystick is not present4920* or an [error](@ref error_handling) occurred.4921*4922* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4923* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.4924*4925* @pointer_lifetime The returned array is allocated and freed by GLFW. You4926* should not free it yourself. It is valid until the specified joystick is4927* disconnected or the library is terminated.4928*4929* @thread_safety This function must only be called from the main thread.4930*4931* @sa @ref joystick_button4932*4933* @since Added in version 2.2.4934* @glfw3 Changed to return a dynamic array.4935*4936* @ingroup input4937*/4938GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);49394940/*! @brief Returns the state of all hats of the specified joystick.4941*4942* This function returns the state of all hats of the specified joystick.4943* Each element in the array is one of the following values:4944*4945* Name | Value4946* ---- | -----4947* `GLFW_HAT_CENTERED` | 04948* `GLFW_HAT_UP` | 14949* `GLFW_HAT_RIGHT` | 24950* `GLFW_HAT_DOWN` | 44951* `GLFW_HAT_LEFT` | 84952* `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP`4953* `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN`4954* `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP`4955* `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN`4956*4957* The diagonal directions are bitwise combinations of the primary (up, right,4958* down and left) directions and you can test for these individually by ANDing4959* it with the corresponding direction.4960*4961* @code4962* if (hats[2] & GLFW_HAT_RIGHT)4963* {4964* // State of hat 2 could be right-up, right or right-down4965* }4966* @endcode4967*4968* If the specified joystick is not present this function will return `NULL`4969* but will not generate an error. This can be used instead of first calling4970* @ref glfwJoystickPresent.4971*4972* @param[in] jid The [joystick](@ref joysticks) to query.4973* @param[out] count Where to store the number of hat states in the returned4974* array. This is set to zero if the joystick is not present or an error4975* occurred.4976* @return An array of hat states, or `NULL` if the joystick is not present4977* or an [error](@ref error_handling) occurred.4978*4979* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref4980* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.4981*4982* @pointer_lifetime The returned array is allocated and freed by GLFW. You4983* should not free it yourself. It is valid until the specified joystick is4984* disconnected, this function is called again for that joystick or the library4985* is terminated.4986*4987* @thread_safety This function must only be called from the main thread.4988*4989* @sa @ref joystick_hat4990*4991* @since Added in version 3.3.4992*4993* @ingroup input4994*/4995GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);49964997/*! @brief Returns the name of the specified joystick.4998*4999* This function returns the name, encoded as UTF-8, of the specified joystick.5000* The returned string is allocated and freed by GLFW. You should not free it5001* yourself.5002*5003* If the specified joystick is not present this function will return `NULL`5004* but will not generate an error. This can be used instead of first calling5005* @ref glfwJoystickPresent.5006*5007* @param[in] jid The [joystick](@ref joysticks) to query.5008* @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick5009* is not present or an [error](@ref error_handling) occurred.5010*5011* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5012* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.5013*5014* @pointer_lifetime The returned string is allocated and freed by GLFW. You5015* should not free it yourself. It is valid until the specified joystick is5016* disconnected or the library is terminated.5017*5018* @thread_safety This function must only be called from the main thread.5019*5020* @sa @ref joystick_name5021*5022* @since Added in version 3.0.5023*5024* @ingroup input5025*/5026GLFWAPI const char* glfwGetJoystickName(int jid);50275028/*! @brief Returns the SDL compatible GUID of the specified joystick.5029*5030* This function returns the SDL compatible GUID, as a UTF-8 encoded5031* hexadecimal string, of the specified joystick. The returned string is5032* allocated and freed by GLFW. You should not free it yourself.5033*5034* The GUID is what connects a joystick to a gamepad mapping. A connected5035* joystick will always have a GUID even if there is no gamepad mapping5036* assigned to it.5037*5038* If the specified joystick is not present this function will return `NULL`5039* but will not generate an error. This can be used instead of first calling5040* @ref glfwJoystickPresent.5041*5042* The GUID uses the format introduced in SDL 2.0.5. This GUID tries to5043* uniquely identify the make and model of a joystick but does not identify5044* a specific unit, e.g. all wired Xbox 360 controllers will have the same5045* GUID on that platform. The GUID for a unit may vary between platforms5046* depending on what hardware information the platform specific APIs provide.5047*5048* @param[in] jid The [joystick](@ref joysticks) to query.5049* @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick5050* is not present or an [error](@ref error_handling) occurred.5051*5052* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5053* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.5054*5055* @pointer_lifetime The returned string is allocated and freed by GLFW. You5056* should not free it yourself. It is valid until the specified joystick is5057* disconnected or the library is terminated.5058*5059* @thread_safety This function must only be called from the main thread.5060*5061* @sa @ref gamepad5062*5063* @since Added in version 3.3.5064*5065* @ingroup input5066*/5067GLFWAPI const char* glfwGetJoystickGUID(int jid);50685069/*! @brief Sets the user pointer of the specified joystick.5070*5071* This function sets the user-defined pointer of the specified joystick. The5072* current value is retained until the joystick is disconnected. The initial5073* value is `NULL`.5074*5075* This function may be called from the joystick callback, even for a joystick5076* that is being disconnected.5077*5078* @param[in] jid The joystick whose pointer to set.5079* @param[in] pointer The new value.5080*5081* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.5082*5083* @thread_safety This function may be called from any thread. Access is not5084* synchronized.5085*5086* @sa @ref joystick_userptr5087* @sa @ref glfwGetJoystickUserPointer5088*5089* @since Added in version 3.3.5090*5091* @ingroup input5092*/5093GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer);50945095/*! @brief Returns the user pointer of the specified joystick.5096*5097* This function returns the current value of the user-defined pointer of the5098* specified joystick. The initial value is `NULL`.5099*5100* This function may be called from the joystick callback, even for a joystick5101* that is being disconnected.5102*5103* @param[in] jid The joystick whose pointer to return.5104*5105* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.5106*5107* @thread_safety This function may be called from any thread. Access is not5108* synchronized.5109*5110* @sa @ref joystick_userptr5111* @sa @ref glfwSetJoystickUserPointer5112*5113* @since Added in version 3.3.5114*5115* @ingroup input5116*/5117GLFWAPI void* glfwGetJoystickUserPointer(int jid);51185119/*! @brief Returns whether the specified joystick has a gamepad mapping.5120*5121* This function returns whether the specified joystick is both present and has5122* a gamepad mapping.5123*5124* If the specified joystick is present but does not have a gamepad mapping5125* this function will return `GLFW_FALSE` but will not generate an error. Call5126* @ref glfwJoystickPresent to check if a joystick is present regardless of5127* whether it has a mapping.5128*5129* @param[in] jid The [joystick](@ref joysticks) to query.5130* @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping,5131* or `GLFW_FALSE` otherwise.5132*5133* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref5134* GLFW_INVALID_ENUM.5135*5136* @thread_safety This function must only be called from the main thread.5137*5138* @sa @ref gamepad5139* @sa @ref glfwGetGamepadState5140*5141* @since Added in version 3.3.5142*5143* @ingroup input5144*/5145GLFWAPI int glfwJoystickIsGamepad(int jid);51465147/*! @brief Sets the joystick configuration callback.5148*5149* This function sets the joystick configuration callback, or removes the5150* currently set callback. This is called when a joystick is connected to or5151* disconnected from the system.5152*5153* For joystick connection and disconnection events to be delivered on all5154* platforms, you need to call one of the [event processing](@ref events)5155* functions. Joystick disconnection may also be detected and the callback5156* called by joystick functions. The function will then return whatever it5157* returns if the joystick is not present.5158*5159* @param[in] callback The new callback, or `NULL` to remove the currently set5160* callback.5161* @return The previously set callback, or `NULL` if no callback was set or the5162* library had not been [initialized](@ref intro_init).5163*5164* @callback_signature5165* @code5166* void function_name(int jid, int event)5167* @endcode5168* For more information about the callback parameters, see the5169* [function pointer type](@ref GLFWjoystickfun).5170*5171* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.5172*5173* @thread_safety This function must only be called from the main thread.5174*5175* @sa @ref joystick_event5176*5177* @since Added in version 3.2.5178*5179* @ingroup input5180*/5181GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);51825183/*! @brief Adds the specified SDL_GameControllerDB gamepad mappings.5184*5185* This function parses the specified ASCII encoded string and updates the5186* internal list with any gamepad mappings it finds. This string may5187* contain either a single gamepad mapping or many mappings separated by5188* newlines. The parser supports the full format of the `gamecontrollerdb.txt`5189* source file including empty lines and comments.5190*5191* See @ref gamepad_mapping for a description of the format.5192*5193* If there is already a gamepad mapping for a given GUID in the internal list,5194* it will be replaced by the one passed to this function. If the library is5195* terminated and re-initialized the internal list will revert to the built-in5196* default.5197*5198* @param[in] string The string containing the gamepad mappings.5199* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an5200* [error](@ref error_handling) occurred.5201*5202* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref5203* GLFW_INVALID_VALUE.5204*5205* @thread_safety This function must only be called from the main thread.5206*5207* @sa @ref gamepad5208* @sa @ref glfwJoystickIsGamepad5209* @sa @ref glfwGetGamepadName5210*5211* @since Added in version 3.3.5212*5213* @ingroup input5214*/5215GLFWAPI int glfwUpdateGamepadMappings(const char* string);52165217/*! @brief Returns the human-readable gamepad name for the specified joystick.5218*5219* This function returns the human-readable name of the gamepad from the5220* gamepad mapping assigned to the specified joystick.5221*5222* If the specified joystick is not present or does not have a gamepad mapping5223* this function will return `NULL` but will not generate an error. Call5224* @ref glfwJoystickPresent to check whether it is present regardless of5225* whether it has a mapping.5226*5227* @param[in] jid The [joystick](@ref joysticks) to query.5228* @return The UTF-8 encoded name of the gamepad, or `NULL` if the5229* joystick is not present, does not have a mapping or an5230* [error](@ref error_handling) occurred.5231*5232* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.5233*5234* @pointer_lifetime The returned string is allocated and freed by GLFW. You5235* should not free it yourself. It is valid until the specified joystick is5236* disconnected, the gamepad mappings are updated or the library is terminated.5237*5238* @thread_safety This function must only be called from the main thread.5239*5240* @sa @ref gamepad5241* @sa @ref glfwJoystickIsGamepad5242*5243* @since Added in version 3.3.5244*5245* @ingroup input5246*/5247GLFWAPI const char* glfwGetGamepadName(int jid);52485249/*! @brief Retrieves the state of the specified joystick remapped as a gamepad.5250*5251* This function retrieves the state of the specified joystick remapped to5252* an Xbox-like gamepad.5253*5254* If the specified joystick is not present or does not have a gamepad mapping5255* this function will return `GLFW_FALSE` but will not generate an error. Call5256* @ref glfwJoystickPresent to check whether it is present regardless of5257* whether it has a mapping.5258*5259* The Guide button may not be available for input as it is often hooked by the5260* system or the Steam client.5261*5262* Not all devices have all the buttons or axes provided by @ref5263* GLFWgamepadstate. Unavailable buttons and axes will always report5264* `GLFW_RELEASE` and 0.0 respectively.5265*5266* @param[in] jid The [joystick](@ref joysticks) to query.5267* @param[out] state The gamepad input state of the joystick.5268* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is5269* connected, it has no gamepad mapping or an [error](@ref error_handling)5270* occurred.5271*5272* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref5273* GLFW_INVALID_ENUM.5274*5275* @thread_safety This function must only be called from the main thread.5276*5277* @sa @ref gamepad5278* @sa @ref glfwUpdateGamepadMappings5279* @sa @ref glfwJoystickIsGamepad5280*5281* @since Added in version 3.3.5282*5283* @ingroup input5284*/5285GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);52865287/*! @brief Sets the clipboard to the specified string.5288*5289* This function sets the system clipboard to the specified, UTF-8 encoded5290* string.5291*5292* @param[in] window Deprecated. Any valid window or `NULL`.5293* @param[in] string A UTF-8 encoded string.5294*5295* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref5296* GLFW_PLATFORM_ERROR.5297*5298* @pointer_lifetime The specified string is copied before this function5299* returns.5300*5301* @thread_safety This function must only be called from the main thread.5302*5303* @sa @ref clipboard5304* @sa @ref glfwGetClipboardString5305*5306* @since Added in version 3.0.5307*5308* @ingroup input5309*/5310GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);53115312/*! @brief Returns the contents of the clipboard as a string.5313*5314* This function returns the contents of the system clipboard, if it contains5315* or is convertible to a UTF-8 encoded string. If the clipboard is empty or5316* if its contents cannot be converted, `NULL` is returned and a @ref5317* GLFW_FORMAT_UNAVAILABLE error is generated.5318*5319* @param[in] window Deprecated. Any valid window or `NULL`.5320* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`5321* if an [error](@ref error_handling) occurred.5322*5323* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5324* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.5325*5326* @pointer_lifetime The returned string is allocated and freed by GLFW. You5327* should not free it yourself. It is valid until the next call to @ref5328* glfwGetClipboardString or @ref glfwSetClipboardString, or until the library5329* is terminated.5330*5331* @thread_safety This function must only be called from the main thread.5332*5333* @sa @ref clipboard5334* @sa @ref glfwSetClipboardString5335*5336* @since Added in version 3.0.5337*5338* @ingroup input5339*/5340GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);53415342/*! @brief Returns the GLFW time.5343*5344* This function returns the current GLFW time, in seconds. Unless the time5345* has been set using @ref glfwSetTime it measures time elapsed since GLFW was5346* initialized.5347*5348* This function and @ref glfwSetTime are helper functions on top of @ref5349* glfwGetTimerFrequency and @ref glfwGetTimerValue.5350*5351* The resolution of the timer is system dependent, but is usually on the order5352* of a few micro- or nanoseconds. It uses the highest-resolution monotonic5353* time source on each supported platform.5354*5355* @return The current time, in seconds, or zero if an5356* [error](@ref error_handling) occurred.5357*5358* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.5359*5360* @thread_safety This function may be called from any thread. Reading and5361* writing of the internal base time is not atomic, so it needs to be5362* externally synchronized with calls to @ref glfwSetTime.5363*5364* @sa @ref time5365*5366* @since Added in version 1.0.5367*5368* @ingroup input5369*/5370GLFWAPI double glfwGetTime(void);53715372/*! @brief Sets the GLFW time.5373*5374* This function sets the current GLFW time, in seconds. The value must be5375* a positive finite number less than or equal to 18446744073.0, which is5376* approximately 584.5 years.5377*5378* This function and @ref glfwGetTime are helper functions on top of @ref5379* glfwGetTimerFrequency and @ref glfwGetTimerValue.5380*5381* @param[in] time The new value, in seconds.5382*5383* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref5384* GLFW_INVALID_VALUE.5385*5386* @remark The upper limit of GLFW time is calculated as5387* floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations5388* storing nanoseconds in 64 bits. The limit may be increased in the future.5389*5390* @thread_safety This function may be called from any thread. Reading and5391* writing of the internal base time is not atomic, so it needs to be5392* externally synchronized with calls to @ref glfwGetTime.5393*5394* @sa @ref time5395*5396* @since Added in version 2.2.5397*5398* @ingroup input5399*/5400GLFWAPI void glfwSetTime(double time);54015402/*! @brief Returns the current value of the raw timer.5403*5404* This function returns the current value of the raw timer, measured in5405* 1 / frequency seconds. To get the frequency, call @ref5406* glfwGetTimerFrequency.5407*5408* @return The value of the timer, or zero if an5409* [error](@ref error_handling) occurred.5410*5411* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.5412*5413* @thread_safety This function may be called from any thread.5414*5415* @sa @ref time5416* @sa @ref glfwGetTimerFrequency5417*5418* @since Added in version 3.2.5419*5420* @ingroup input5421*/5422GLFWAPI uint64_t glfwGetTimerValue(void);54235424/*! @brief Returns the frequency, in Hz, of the raw timer.5425*5426* This function returns the frequency, in Hz, of the raw timer.5427*5428* @return The frequency of the timer, in Hz, or zero if an5429* [error](@ref error_handling) occurred.5430*5431* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.5432*5433* @thread_safety This function may be called from any thread.5434*5435* @sa @ref time5436* @sa @ref glfwGetTimerValue5437*5438* @since Added in version 3.2.5439*5440* @ingroup input5441*/5442GLFWAPI uint64_t glfwGetTimerFrequency(void);54435444/*! @brief Makes the context of the specified window current for the calling5445* thread.5446*5447* This function makes the OpenGL or OpenGL ES context of the specified window5448* current on the calling thread. A context must only be made current on5449* a single thread at a time and each thread can have only a single current5450* context at a time.5451*5452* When moving a context between threads, you must make it non-current on the5453* old thread before making it current on the new one.5454*5455* By default, making a context non-current implicitly forces a pipeline flush.5456* On machines that support `GL_KHR_context_flush_control`, you can control5457* whether a context performs this flush by setting the5458* [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)5459* hint.5460*5461* The specified window must have an OpenGL or OpenGL ES context. Specifying5462* a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT5463* error.5464*5465* @param[in] window The window whose context to make current, or `NULL` to5466* detach the current context.5467*5468* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5469* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.5470*5471* @thread_safety This function may be called from any thread.5472*5473* @sa @ref context_current5474* @sa @ref glfwGetCurrentContext5475*5476* @since Added in version 3.0.5477*5478* @ingroup context5479*/5480GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);54815482/*! @brief Returns the window whose context is current on the calling thread.5483*5484* This function returns the window whose OpenGL or OpenGL ES context is5485* current on the calling thread.5486*5487* @return The window whose context is current, or `NULL` if no window's5488* context is current.5489*5490* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.5491*5492* @thread_safety This function may be called from any thread.5493*5494* @sa @ref context_current5495* @sa @ref glfwMakeContextCurrent5496*5497* @since Added in version 3.0.5498*5499* @ingroup context5500*/5501GLFWAPI GLFWwindow* glfwGetCurrentContext(void);55025503/*! @brief Swaps the front and back buffers of the specified window.5504*5505* This function swaps the front and back buffers of the specified window when5506* rendering with OpenGL or OpenGL ES. If the swap interval is greater than5507* zero, the GPU driver waits the specified number of screen updates before5508* swapping the buffers.5509*5510* The specified window must have an OpenGL or OpenGL ES context. Specifying5511* a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT5512* error.5513*5514* This function does not apply to Vulkan. If you are rendering with Vulkan,5515* see `vkQueuePresentKHR` instead.5516*5517* @param[in] window The window whose buffers to swap.5518*5519* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5520* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.5521*5522* @remark __EGL:__ The context of the specified window must be current on the5523* calling thread.5524*5525* @thread_safety This function may be called from any thread.5526*5527* @sa @ref buffer_swap5528* @sa @ref glfwSwapInterval5529*5530* @since Added in version 1.0.5531* @glfw3 Added window handle parameter.5532*5533* @ingroup window5534*/5535GLFWAPI void glfwSwapBuffers(GLFWwindow* window);55365537/*! @brief Sets the swap interval for the current context.5538*5539* This function sets the swap interval for the current OpenGL or OpenGL ES5540* context, i.e. the number of screen updates to wait from the time @ref5541* glfwSwapBuffers was called before swapping the buffers and returning. This5542* is sometimes called _vertical synchronization_, _vertical retrace5543* synchronization_ or just _vsync_.5544*5545* A context that supports either of the `WGL_EXT_swap_control_tear` and5546* `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap5547* intervals, which allows the driver to swap immediately even if a frame5548* arrives a little bit late. You can check for these extensions with @ref5549* glfwExtensionSupported.5550*5551* A context must be current on the calling thread. Calling this function5552* without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.5553*5554* This function does not apply to Vulkan. If you are rendering with Vulkan,5555* see the present mode of your swapchain instead.5556*5557* @param[in] interval The minimum number of screen updates to wait for5558* until the buffers are swapped by @ref glfwSwapBuffers.5559*5560* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5561* GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.5562*5563* @remark This function is not called during context creation, leaving the5564* swap interval set to whatever is the default on that platform. This is done5565* because some swap interval extensions used by GLFW do not allow the swap5566* interval to be reset to zero once it has been set to a non-zero value.5567*5568* @remark Some GPU drivers do not honor the requested swap interval, either5569* because of a user setting that overrides the application's request or due to5570* bugs in the driver.5571*5572* @thread_safety This function may be called from any thread.5573*5574* @sa @ref buffer_swap5575* @sa @ref glfwSwapBuffers5576*5577* @since Added in version 1.0.5578*5579* @ingroup context5580*/5581GLFWAPI void glfwSwapInterval(int interval);55825583/*! @brief Returns whether the specified extension is available.5584*5585* This function returns whether the specified5586* [API extension](@ref context_glext) is supported by the current OpenGL or5587* OpenGL ES context. It searches both for client API extension and context5588* creation API extensions.5589*5590* A context must be current on the calling thread. Calling this function5591* without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.5592*5593* As this functions retrieves and searches one or more extension strings each5594* call, it is recommended that you cache its results if it is going to be used5595* frequently. The extension strings will not change during the lifetime of5596* a context, so there is no danger in doing this.5597*5598* This function does not apply to Vulkan. If you are using Vulkan, see @ref5599* glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`5600* and `vkEnumerateDeviceExtensionProperties` instead.5601*5602* @param[in] extension The ASCII encoded name of the extension.5603* @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`5604* otherwise.5605*5606* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5607* GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref5608* GLFW_PLATFORM_ERROR.5609*5610* @thread_safety This function may be called from any thread.5611*5612* @sa @ref context_glext5613* @sa @ref glfwGetProcAddress5614*5615* @since Added in version 1.0.5616*5617* @ingroup context5618*/5619GLFWAPI int glfwExtensionSupported(const char* extension);56205621/*! @brief Returns the address of the specified function for the current5622* context.5623*5624* This function returns the address of the specified OpenGL or OpenGL ES5625* [core or extension function](@ref context_glext), if it is supported5626* by the current context.5627*5628* A context must be current on the calling thread. Calling this function5629* without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.5630*5631* This function does not apply to Vulkan. If you are rendering with Vulkan,5632* see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and5633* `vkGetDeviceProcAddr` instead.5634*5635* @param[in] procname The ASCII encoded name of the function.5636* @return The address of the function, or `NULL` if an5637* [error](@ref error_handling) occurred.5638*5639* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5640* GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.5641*5642* @remark The address of a given function is not guaranteed to be the same5643* between contexts.5644*5645* @remark This function may return a non-`NULL` address despite the5646* associated version or extension not being available. Always check the5647* context version or extension string first.5648*5649* @pointer_lifetime The returned function pointer is valid until the context5650* is destroyed or the library is terminated.5651*5652* @thread_safety This function may be called from any thread.5653*5654* @sa @ref context_glext5655* @sa @ref glfwExtensionSupported5656*5657* @since Added in version 1.0.5658*5659* @ingroup context5660*/5661GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);56625663/*! @brief Returns whether the Vulkan loader and an ICD have been found.5664*5665* This function returns whether the Vulkan loader and any minimally functional5666* ICD have been found.5667*5668* The availability of a Vulkan loader and even an ICD does not by itself guarantee that5669* surface creation or even instance creation is possible. Call @ref5670* glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan5671* surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to5672* check whether a queue family of a physical device supports image presentation.5673*5674* @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`5675* otherwise.5676*5677* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.5678*5679* @thread_safety This function may be called from any thread.5680*5681* @sa @ref vulkan_support5682*5683* @since Added in version 3.2.5684*5685* @ingroup vulkan5686*/5687GLFWAPI int glfwVulkanSupported(void);56885689/*! @brief Returns the Vulkan instance extensions required by GLFW.5690*5691* This function returns an array of names of Vulkan instance extensions required5692* by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the5693* list will always contain `VK_KHR_surface`, so if you don't require any5694* additional extensions you can pass this list directly to the5695* `VkInstanceCreateInfo` struct.5696*5697* If Vulkan is not available on the machine, this function returns `NULL` and5698* generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported5699* to check whether Vulkan is at least minimally available.5700*5701* If Vulkan is available but no set of extensions allowing window surface5702* creation was found, this function returns `NULL`. You may still use Vulkan5703* for off-screen rendering and compute work.5704*5705* @param[out] count Where to store the number of extensions in the returned5706* array. This is set to zero if an error occurred.5707* @return An array of ASCII encoded extension names, or `NULL` if an5708* [error](@ref error_handling) occurred.5709*5710* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref5711* GLFW_API_UNAVAILABLE.5712*5713* @remark Additional extensions may be required by future versions of GLFW.5714* You should check if any extensions you wish to enable are already in the5715* returned array, as it is an error to specify an extension more than once in5716* the `VkInstanceCreateInfo` struct.5717*5718* @pointer_lifetime The returned array is allocated and freed by GLFW. You5719* should not free it yourself. It is guaranteed to be valid only until the5720* library is terminated.5721*5722* @thread_safety This function may be called from any thread.5723*5724* @sa @ref vulkan_ext5725* @sa @ref glfwCreateWindowSurface5726*5727* @since Added in version 3.2.5728*5729* @ingroup vulkan5730*/5731GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);57325733#if defined(VK_VERSION_1_0)57345735/*! @brief Returns the address of the specified Vulkan instance function.5736*5737* This function returns the address of the specified Vulkan core or extension5738* function for the specified instance. If instance is set to `NULL` it can5739* return any function exported from the Vulkan loader, including at least the5740* following functions:5741*5742* - `vkEnumerateInstanceExtensionProperties`5743* - `vkEnumerateInstanceLayerProperties`5744* - `vkCreateInstance`5745* - `vkGetInstanceProcAddr`5746*5747* If Vulkan is not available on the machine, this function returns `NULL` and5748* generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported5749* to check whether Vulkan is at least minimally available.5750*5751* This function is equivalent to calling `vkGetInstanceProcAddr` with5752* a platform-specific query of the Vulkan loader as a fallback.5753*5754* @param[in] instance The Vulkan instance to query, or `NULL` to retrieve5755* functions related to instance creation.5756* @param[in] procname The ASCII encoded name of the function.5757* @return The address of the function, or `NULL` if an5758* [error](@ref error_handling) occurred.5759*5760* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref5761* GLFW_API_UNAVAILABLE.5762*5763* @pointer_lifetime The returned function pointer is valid until the library5764* is terminated.5765*5766* @thread_safety This function may be called from any thread.5767*5768* @sa @ref vulkan_proc5769*5770* @since Added in version 3.2.5771*5772* @ingroup vulkan5773*/5774GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);57755776/*! @brief Returns whether the specified queue family can present images.5777*5778* This function returns whether the specified queue family of the specified5779* physical device supports presentation to the platform GLFW was built for.5780*5781* If Vulkan or the required window surface creation instance extensions are5782* not available on the machine, or if the specified instance was not created5783* with the required extensions, this function returns `GLFW_FALSE` and5784* generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported5785* to check whether Vulkan is at least minimally available and @ref5786* glfwGetRequiredInstanceExtensions to check what instance extensions are5787* required.5788*5789* @param[in] instance The instance that the physical device belongs to.5790* @param[in] device The physical device that the queue family belongs to.5791* @param[in] queuefamily The index of the queue family to query.5792* @return `GLFW_TRUE` if the queue family supports presentation, or5793* `GLFW_FALSE` otherwise.5794*5795* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5796* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.5797*5798* @remark @macos This function currently always returns `GLFW_TRUE`, as the5799* `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide5800* a `vkGetPhysicalDevice*PresentationSupport` type function.5801*5802* @thread_safety This function may be called from any thread. For5803* synchronization details of Vulkan objects, see the Vulkan specification.5804*5805* @sa @ref vulkan_present5806*5807* @since Added in version 3.2.5808*5809* @ingroup vulkan5810*/5811GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);58125813/*! @brief Creates a Vulkan surface for the specified window.5814*5815* This function creates a Vulkan surface for the specified window.5816*5817* If the Vulkan loader or at least one minimally functional ICD were not found,5818* this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref5819* GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether5820* Vulkan is at least minimally available.5821*5822* If the required window surface creation instance extensions are not5823* available or if the specified instance was not created with these extensions5824* enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and5825* generates a @ref GLFW_API_UNAVAILABLE error. Call @ref5826* glfwGetRequiredInstanceExtensions to check what instance extensions are5827* required.5828*5829* The window surface cannot be shared with another API so the window must5830* have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib)5831* set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error5832* and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`.5833*5834* The window surface must be destroyed before the specified Vulkan instance.5835* It is the responsibility of the caller to destroy the window surface. GLFW5836* does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the5837* surface.5838*5839* @param[in] instance The Vulkan instance to create the surface in.5840* @param[in] window The window to create the surface for.5841* @param[in] allocator The allocator to use, or `NULL` to use the default5842* allocator.5843* @param[out] surface Where to store the handle of the surface. This is set5844* to `VK_NULL_HANDLE` if an error occurred.5845* @return `VK_SUCCESS` if successful, or a Vulkan error code if an5846* [error](@ref error_handling) occurred.5847*5848* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref5849* GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE5850*5851* @remark If an error occurs before the creation call is made, GLFW returns5852* the Vulkan error code most appropriate for the error. Appropriate use of5853* @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should5854* eliminate almost all occurrences of these errors.5855*5856* @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the5857* `VK_MVK_macos_surface` extension as a fallback. The name of the selected5858* extension, if any, is included in the array returned by @ref5859* glfwGetRequiredInstanceExtensions.5860*5861* @remark @macos This function creates and sets a `CAMetalLayer` instance for5862* the window content view, which is required for MoltenVK to function.5863*5864* @thread_safety This function may be called from any thread. For5865* synchronization details of Vulkan objects, see the Vulkan specification.5866*5867* @sa @ref vulkan_surface5868* @sa @ref glfwGetRequiredInstanceExtensions5869*5870* @since Added in version 3.2.5871*5872* @ingroup vulkan5873*/5874GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);58755876#endif /*VK_VERSION_1_0*/587758785879/*************************************************************************5880* Global definition cleanup5881*************************************************************************/58825883/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */58845885#ifdef GLFW_WINGDIAPI_DEFINED5886#undef WINGDIAPI5887#undef GLFW_WINGDIAPI_DEFINED5888#endif58895890#ifdef GLFW_CALLBACK_DEFINED5891#undef CALLBACK5892#undef GLFW_CALLBACK_DEFINED5893#endif58945895/* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally5896* defined by some gl.h variants (OpenBSD) so define it after if needed.5897*/5898#ifndef GLAPIENTRY5899#define GLAPIENTRY APIENTRY5900#define GLFW_GLAPIENTRY_DEFINED5901#endif59025903/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */590459055906#ifdef __cplusplus5907}5908#endif59095910#endif /* _glfw3_h_ */5911591259135914