Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 1 | /************************************************************************* |
Camilla Löwy | d24ee99 | 2024-02-29 15:28:46 +0100 | [diff] [blame] | 2 | * GLFW 3.5 - www.glfw.org |
Camilla Berglund | 3cfc400 | 2013-07-29 20:53:17 +0200 | [diff] [blame] | 3 | * A library for OpenGL, window and input |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4 | *------------------------------------------------------------------------ |
| 5 | * Copyright (c) 2002-2006 Marcus Geelnard |
Camilla Löwy | ab118b2 | 2019-04-15 20:50:00 +0200 | [diff] [blame] | 6 | * Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org> |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 7 | * |
| 8 | * This software is provided 'as-is', without any express or implied |
| 9 | * warranty. In no event will the authors be held liable for any damages |
| 10 | * arising from the use of this software. |
| 11 | * |
| 12 | * Permission is granted to anyone to use this software for any purpose, |
| 13 | * including commercial applications, and to alter it and redistribute it |
| 14 | * freely, subject to the following restrictions: |
| 15 | * |
| 16 | * 1. The origin of this software must not be misrepresented; you must not |
| 17 | * claim that you wrote the original software. If you use this software |
| 18 | * in a product, an acknowledgment in the product documentation would |
| 19 | * be appreciated but is not required. |
| 20 | * |
| 21 | * 2. Altered source versions must be plainly marked as such, and must not |
| 22 | * be misrepresented as being the original software. |
| 23 | * |
| 24 | * 3. This notice may not be removed or altered from any source |
| 25 | * distribution. |
| 26 | * |
| 27 | *************************************************************************/ |
| 28 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 29 | #ifndef _glfw3_h_ |
| 30 | #define _glfw3_h_ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
| 36 | |
| 37 | /************************************************************************* |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 38 | * Doxygen documentation |
| 39 | *************************************************************************/ |
| 40 | |
Camilla Berglund | 318e8ac | 2015-10-24 20:48:46 +0200 | [diff] [blame] | 41 | /*! @file glfw3.h |
| 42 | * @brief The header of the GLFW 3 API. |
| 43 | * |
| 44 | * This is the header file of the GLFW 3 API. It defines all its types and |
| 45 | * declares all its functions. |
| 46 | * |
| 47 | * For more information about how to use this file, see @ref build_include. |
| 48 | */ |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 49 | /*! @defgroup context Context reference |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 50 | * @brief Functions and types related to OpenGL and OpenGL ES contexts. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 51 | * |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 52 | * This is the reference documentation for OpenGL and OpenGL ES context related |
| 53 | * functions. For more task-oriented information, see the @ref context_guide. |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 54 | */ |
Camilla Löwy | 41a19ed | 2020-05-04 23:18:48 +0200 | [diff] [blame] | 55 | /*! @defgroup vulkan Vulkan support reference |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 56 | * @brief Functions and types related to Vulkan. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 57 | * |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 58 | * This is the reference documentation for Vulkan related functions and types. |
| 59 | * For more task-oriented information, see the @ref vulkan_guide. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 60 | */ |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 61 | /*! @defgroup init Initialization, version and error reference |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 62 | * @brief Functions and types related to initialization and error handling. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 63 | * |
| 64 | * This is the reference documentation for initialization and termination of |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 65 | * the library, version management and error handling. For more task-oriented |
| 66 | * information, see the @ref intro_guide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 67 | */ |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 68 | /*! @defgroup input Input reference |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 69 | * @brief Functions and types related to input handling. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 70 | * |
| 71 | * This is the reference documentation for input related functions and types. |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 72 | * For more task-oriented information, see the @ref input_guide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 73 | */ |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 74 | /*! @defgroup monitor Monitor reference |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 75 | * @brief Functions and types related to monitors. |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 76 | * |
| 77 | * This is the reference documentation for monitor related functions and types. |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 78 | * For more task-oriented information, see the @ref monitor_guide. |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 79 | */ |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 80 | /*! @defgroup window Window reference |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 81 | * @brief Functions and types related to windows. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 82 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 83 | * This is the reference documentation for window related functions and types, |
Camilla Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 84 | * including creation, deletion and event polling. For more task-oriented |
| 85 | * information, see the @ref window_guide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 86 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 87 | |
| 88 | |
| 89 | /************************************************************************* |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 90 | * Compiler- and platform-specific preprocessor work |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 91 | *************************************************************************/ |
| 92 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 93 | /* If we are we on Windows, we want a single define for it. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 94 | */ |
Camilla Berglund | e8ce4ab | 2015-02-22 18:18:43 +0100 | [diff] [blame] | 95 | #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 96 | #define _WIN32 |
| 97 | #endif /* _WIN32 */ |
| 98 | |
Camilla Löwy | 773f449 | 2019-07-12 14:23:12 +0200 | [diff] [blame] | 99 | /* Include because most Windows GLU headers need wchar_t and |
| 100 | * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h. |
| 101 | * Include it unconditionally to avoid surprising side-effects. |
| 102 | */ |
| 103 | #include <stddef.h> |
| 104 | |
| 105 | /* Include because it is needed by Vulkan and related functions. |
| 106 | * Include it unconditionally to avoid surprising side-effects. |
| 107 | */ |
| 108 | #include <stdint.h> |
| 109 | |
| 110 | #if defined(GLFW_INCLUDE_VULKAN) |
| 111 | #include <vulkan/vulkan.h> |
| 112 | #endif /* Vulkan header */ |
| 113 | |
| 114 | /* The Vulkan header may have indirectly included windows.h (because of |
| 115 | * VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it. |
| 116 | */ |
| 117 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 118 | /* It is customary to use APIENTRY for OpenGL function pointer declarations on |
| 119 | * all platforms. Additionally, the Windows OpenGL header needs APIENTRY. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 120 | */ |
Camilla Löwy | 62b7fe8 | 2019-07-12 14:33:05 +0200 | [diff] [blame] | 121 | #if !defined(APIENTRY) |
| 122 | #if defined(_WIN32) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 123 | #define APIENTRY __stdcall |
| 124 | #else |
| 125 | #define APIENTRY |
| 126 | #endif |
Camilla Löwy | c23fca6 | 2017-08-21 14:37:38 +0200 | [diff] [blame] | 127 | #define GLFW_APIENTRY_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 128 | #endif /* APIENTRY */ |
| 129 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 130 | /* Some Windows OpenGL headers need this. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 131 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 132 | #if !defined(WINGDIAPI) && defined(_WIN32) |
Camilla Berglund | c535364 | 2015-02-22 18:14:30 +0100 | [diff] [blame] | 133 | #define WINGDIAPI __declspec(dllimport) |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 134 | #define GLFW_WINGDIAPI_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 135 | #endif /* WINGDIAPI */ |
| 136 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 137 | /* Some Windows GLU headers need this. |
| 138 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 139 | #if !defined(CALLBACK) && defined(_WIN32) |
Camilla Berglund | d586fe6 | 2015-02-22 18:17:34 +0100 | [diff] [blame] | 140 | #define CALLBACK __stdcall |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 141 | #define GLFW_CALLBACK_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 142 | #endif /* CALLBACK */ |
| 143 | |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 144 | /* Include the chosen OpenGL or OpenGL ES headers. |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 145 | */ |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 146 | #if defined(GLFW_INCLUDE_ES1) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 147 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 148 | #include <GLES/gl.h> |
| 149 | #if defined(GLFW_INCLUDE_GLEXT) |
| 150 | #include <GLES/glext.h> |
| 151 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 152 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 153 | #elif defined(GLFW_INCLUDE_ES2) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 154 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 155 | #include <GLES2/gl2.h> |
| 156 | #if defined(GLFW_INCLUDE_GLEXT) |
| 157 | #include <GLES2/gl2ext.h> |
| 158 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 159 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 160 | #elif defined(GLFW_INCLUDE_ES3) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 161 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 162 | #include <GLES3/gl3.h> |
| 163 | #if defined(GLFW_INCLUDE_GLEXT) |
| 164 | #include <GLES2/gl2ext.h> |
| 165 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 166 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 167 | #elif defined(GLFW_INCLUDE_ES31) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 168 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 169 | #include <GLES3/gl31.h> |
| 170 | #if defined(GLFW_INCLUDE_GLEXT) |
| 171 | #include <GLES2/gl2ext.h> |
| 172 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 173 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 174 | #elif defined(GLFW_INCLUDE_ES32) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 175 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 176 | #include <GLES3/gl32.h> |
| 177 | #if defined(GLFW_INCLUDE_GLEXT) |
| 178 | #include <GLES2/gl2ext.h> |
| 179 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 180 | |
| 181 | #elif defined(GLFW_INCLUDE_GLCOREARB) |
| 182 | |
| 183 | #if defined(__APPLE__) |
| 184 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 185 | #include <OpenGL/gl3.h> |
| 186 | #if defined(GLFW_INCLUDE_GLEXT) |
| 187 | #include <OpenGL/gl3ext.h> |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 188 | #endif /*GLFW_INCLUDE_GLEXT*/ |
| 189 | |
| 190 | #else /*__APPLE__*/ |
| 191 | |
| 192 | #include <GL/glcorearb.h> |
Camilla Löwy | 309d793 | 2021-09-26 16:28:04 +0200 | [diff] [blame] | 193 | #if defined(GLFW_INCLUDE_GLEXT) |
| 194 | #include <GL/glext.h> |
| 195 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 196 | |
| 197 | #endif /*__APPLE__*/ |
| 198 | |
Tatsuya Yatagawa | 81f475b | 2020-06-05 12:57:43 +0900 | [diff] [blame] | 199 | #elif defined(GLFW_INCLUDE_GLU) |
| 200 | |
| 201 | #if defined(__APPLE__) |
| 202 | |
| 203 | #if defined(GLFW_INCLUDE_GLU) |
| 204 | #include <OpenGL/glu.h> |
| 205 | #endif |
| 206 | |
| 207 | #else /*__APPLE__*/ |
| 208 | |
| 209 | #if defined(GLFW_INCLUDE_GLU) |
| 210 | #include <GL/glu.h> |
| 211 | #endif |
| 212 | |
| 213 | #endif /*__APPLE__*/ |
| 214 | |
Camilla Löwy | 105cf32 | 2020-05-26 23:35:40 +0200 | [diff] [blame] | 215 | #elif !defined(GLFW_INCLUDE_NONE) && \ |
| 216 | !defined(__gl_h_) && \ |
| 217 | !defined(__gles1_gl_h_) && \ |
| 218 | !defined(__gles2_gl2_h_) && \ |
| 219 | !defined(__gles2_gl3_h_) && \ |
| 220 | !defined(__gles2_gl31_h_) && \ |
| 221 | !defined(__gles2_gl32_h_) && \ |
| 222 | !defined(__gl_glcorearb_h_) && \ |
| 223 | !defined(__gl2_h_) /*legacy*/ && \ |
| 224 | !defined(__gl3_h_) /*legacy*/ && \ |
| 225 | !defined(__gl31_h_) /*legacy*/ && \ |
| 226 | !defined(__gl32_h_) /*legacy*/ && \ |
| 227 | !defined(__glcorearb_h_) /*legacy*/ && \ |
| 228 | !defined(__GL_H__) /*non-standard*/ && \ |
| 229 | !defined(__gltypes_h_) /*non-standard*/ && \ |
| 230 | !defined(__glee_h_) /*non-standard*/ |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 231 | |
| 232 | #if defined(__APPLE__) |
| 233 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 234 | #if !defined(GLFW_INCLUDE_GLEXT) |
| 235 | #define GL_GLEXT_LEGACY |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 236 | #endif |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 237 | #include <OpenGL/gl.h> |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 238 | |
| 239 | #else /*__APPLE__*/ |
| 240 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 241 | #include <GL/gl.h> |
| 242 | #if defined(GLFW_INCLUDE_GLEXT) |
| 243 | #include <GL/glext.h> |
| 244 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 245 | |
| 246 | #endif /*__APPLE__*/ |
| 247 | |
| 248 | #endif /* OpenGL and OpenGL ES headers */ |
| 249 | |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 250 | #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 251 | /* GLFW_DLL must be defined by applications that are linking against the DLL |
| 252 | * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW |
| 253 | * configuration header when compiling the DLL version of the library. |
Camilla Berglund | bd2d571 | 2013-07-23 01:59:27 +0200 | [diff] [blame] | 254 | */ |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 255 | #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 256 | #endif |
| 257 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 258 | /* GLFWAPI is used to declare public API functions for export |
| 259 | * from the DLL / shared library / dynamic library. |
| 260 | */ |
Camilla Berglund | 2588c9b | 2012-03-25 17:40:30 +0200 | [diff] [blame] | 261 | #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 262 | /* We are building GLFW as a Win32 DLL */ |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 263 | #define GLFWAPI __declspec(dllexport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 264 | #elif defined(_WIN32) && defined(GLFW_DLL) |
Camilla Löwy | 685de90 | 2022-04-21 17:35:50 +0200 | [diff] [blame] | 265 | /* We are calling a GLFW Win32 DLL */ |
Camilla Berglund | 1247fc0 | 2015-02-22 18:10:20 +0100 | [diff] [blame] | 266 | #define GLFWAPI __declspec(dllimport) |
John Bartholomew | 93f4eff | 2013-05-01 13:08:09 +0100 | [diff] [blame] | 267 | #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) |
Camilla Löwy | 685de90 | 2022-04-21 17:35:50 +0200 | [diff] [blame] | 268 | /* We are building GLFW as a Unix shared library */ |
John Bartholomew | 93f4eff | 2013-05-01 13:08:09 +0100 | [diff] [blame] | 269 | #define GLFWAPI __attribute__((visibility("default"))) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 270 | #else |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 271 | #define GLFWAPI |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 272 | #endif |
| 273 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 274 | |
| 275 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 276 | * GLFW API tokens |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 277 | *************************************************************************/ |
| 278 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 279 | /*! @name GLFW version macros |
| 280 | * @{ */ |
Camilla Löwy | e17ffcd | 2021-05-12 18:49:35 +0200 | [diff] [blame] | 281 | /*! @brief The major version number of the GLFW header. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 282 | * |
Camilla Löwy | e17ffcd | 2021-05-12 18:49:35 +0200 | [diff] [blame] | 283 | * The major version number of the GLFW header. This is incremented when the |
| 284 | * API is changed in non-compatible ways. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 285 | * @ingroup init |
| 286 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 287 | #define GLFW_VERSION_MAJOR 3 |
Camilla Löwy | e17ffcd | 2021-05-12 18:49:35 +0200 | [diff] [blame] | 288 | /*! @brief The minor version number of the GLFW header. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 289 | * |
Camilla Löwy | e17ffcd | 2021-05-12 18:49:35 +0200 | [diff] [blame] | 290 | * The minor version number of the GLFW header. This is incremented when |
| 291 | * features are added to the API but it remains backward-compatible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 292 | * @ingroup init |
| 293 | */ |
Camilla Löwy | d24ee99 | 2024-02-29 15:28:46 +0100 | [diff] [blame] | 294 | #define GLFW_VERSION_MINOR 5 |
Camilla Löwy | e17ffcd | 2021-05-12 18:49:35 +0200 | [diff] [blame] | 295 | /*! @brief The revision number of the GLFW header. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 296 | * |
Camilla Löwy | e17ffcd | 2021-05-12 18:49:35 +0200 | [diff] [blame] | 297 | * The revision number of the GLFW header. This is incremented when a bug fix |
| 298 | * release is made that does not contain any API changes. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 299 | * @ingroup init |
| 300 | */ |
Camilla Berglund | 53fafad | 2016-08-18 23:42:15 +0200 | [diff] [blame] | 301 | #define GLFW_VERSION_REVISION 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 302 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 303 | |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 304 | /*! @brief One. |
| 305 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 306 | * This is only semantic sugar for the number 1. You can instead use `1` or |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 307 | * `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal |
| 308 | * to one. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 309 | * |
| 310 | * @ingroup init |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 311 | */ |
| 312 | #define GLFW_TRUE 1 |
| 313 | /*! @brief Zero. |
| 314 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 315 | * This is only semantic sugar for the number 0. You can instead use `0` or |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 316 | * `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is |
| 317 | * equal to zero. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 318 | * |
| 319 | * @ingroup init |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 320 | */ |
| 321 | #define GLFW_FALSE 0 |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 322 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 323 | /*! @name Key and button actions |
| 324 | * @{ */ |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 325 | /*! @brief The key or mouse button was released. |
| 326 | * |
| 327 | * The key or mouse button was released. |
| 328 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 329 | * @ingroup input |
| 330 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 331 | #define GLFW_RELEASE 0 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 332 | /*! @brief The key or mouse button was pressed. |
| 333 | * |
| 334 | * The key or mouse button was pressed. |
| 335 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 336 | * @ingroup input |
| 337 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 338 | #define GLFW_PRESS 1 |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 339 | /*! @brief The key was held down until it repeated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 340 | * |
| 341 | * The key was held down until it repeated. |
| 342 | * |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 343 | * @ingroup input |
| 344 | */ |
| 345 | #define GLFW_REPEAT 2 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 346 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 347 | |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 348 | /*! @defgroup hat_state Joystick hat states |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 349 | * @brief Joystick hat states. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 350 | * |
| 351 | * See [joystick hat input](@ref joystick_hat) for how these are used. |
| 352 | * |
| 353 | * @ingroup input |
| 354 | * @{ */ |
| 355 | #define GLFW_HAT_CENTERED 0 |
| 356 | #define GLFW_HAT_UP 1 |
| 357 | #define GLFW_HAT_RIGHT 2 |
| 358 | #define GLFW_HAT_DOWN 4 |
| 359 | #define GLFW_HAT_LEFT 8 |
| 360 | #define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP) |
| 361 | #define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN) |
| 362 | #define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP) |
| 363 | #define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN) |
Camilla Löwy | 9959dc6 | 2023-12-04 20:06:10 +0100 | [diff] [blame] | 364 | |
| 365 | /*! @ingroup input |
| 366 | */ |
| 367 | #define GLFW_KEY_UNKNOWN -1 |
| 368 | |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 369 | /*! @} */ |
| 370 | |
Camilla Löwy | 9959dc6 | 2023-12-04 20:06:10 +0100 | [diff] [blame] | 371 | /*! @defgroup keys Keyboard key tokens |
| 372 | * @brief Keyboard key tokens. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 373 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 374 | * See [key input](@ref input_key) for how these are used. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 375 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 376 | * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), |
| 377 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
| 378 | * put in the 256+ range). |
| 379 | * |
| 380 | * The naming of the key codes follow these rules: |
| 381 | * - The US keyboard layout is used |
luz paz | 0fe96ec | 2021-09-15 08:20:56 -0400 | [diff] [blame] | 382 | * - Names of printable alphanumeric characters are used (e.g. "A", "R", |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 383 | * "3", etc.) |
| 384 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
| 385 | * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not |
| 386 | * correspond to the Unicode standard (usually for brevity) |
| 387 | * - Keys that lack a clear US mapping are named "WORLD_x" |
| 388 | * - For non-printable keys, custom names are used (e.g. "F4", |
| 389 | * "BACKSPACE", etc.) |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 390 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 391 | * @ingroup input |
| 392 | * @{ |
| 393 | */ |
| 394 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 395 | /* Printable keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 396 | #define GLFW_KEY_SPACE 32 |
| 397 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
| 398 | #define GLFW_KEY_COMMA 44 /* , */ |
| 399 | #define GLFW_KEY_MINUS 45 /* - */ |
| 400 | #define GLFW_KEY_PERIOD 46 /* . */ |
| 401 | #define GLFW_KEY_SLASH 47 /* / */ |
| 402 | #define GLFW_KEY_0 48 |
| 403 | #define GLFW_KEY_1 49 |
| 404 | #define GLFW_KEY_2 50 |
| 405 | #define GLFW_KEY_3 51 |
| 406 | #define GLFW_KEY_4 52 |
| 407 | #define GLFW_KEY_5 53 |
| 408 | #define GLFW_KEY_6 54 |
| 409 | #define GLFW_KEY_7 55 |
| 410 | #define GLFW_KEY_8 56 |
| 411 | #define GLFW_KEY_9 57 |
| 412 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
| 413 | #define GLFW_KEY_EQUAL 61 /* = */ |
| 414 | #define GLFW_KEY_A 65 |
| 415 | #define GLFW_KEY_B 66 |
| 416 | #define GLFW_KEY_C 67 |
| 417 | #define GLFW_KEY_D 68 |
| 418 | #define GLFW_KEY_E 69 |
| 419 | #define GLFW_KEY_F 70 |
| 420 | #define GLFW_KEY_G 71 |
| 421 | #define GLFW_KEY_H 72 |
| 422 | #define GLFW_KEY_I 73 |
| 423 | #define GLFW_KEY_J 74 |
| 424 | #define GLFW_KEY_K 75 |
| 425 | #define GLFW_KEY_L 76 |
| 426 | #define GLFW_KEY_M 77 |
| 427 | #define GLFW_KEY_N 78 |
| 428 | #define GLFW_KEY_O 79 |
| 429 | #define GLFW_KEY_P 80 |
| 430 | #define GLFW_KEY_Q 81 |
| 431 | #define GLFW_KEY_R 82 |
| 432 | #define GLFW_KEY_S 83 |
| 433 | #define GLFW_KEY_T 84 |
| 434 | #define GLFW_KEY_U 85 |
| 435 | #define GLFW_KEY_V 86 |
| 436 | #define GLFW_KEY_W 87 |
| 437 | #define GLFW_KEY_X 88 |
| 438 | #define GLFW_KEY_Y 89 |
| 439 | #define GLFW_KEY_Z 90 |
| 440 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
| 441 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
| 442 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
| 443 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
| 444 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
| 445 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 446 | |
| 447 | /* Function keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 448 | #define GLFW_KEY_ESCAPE 256 |
| 449 | #define GLFW_KEY_ENTER 257 |
| 450 | #define GLFW_KEY_TAB 258 |
| 451 | #define GLFW_KEY_BACKSPACE 259 |
| 452 | #define GLFW_KEY_INSERT 260 |
| 453 | #define GLFW_KEY_DELETE 261 |
| 454 | #define GLFW_KEY_RIGHT 262 |
| 455 | #define GLFW_KEY_LEFT 263 |
| 456 | #define GLFW_KEY_DOWN 264 |
| 457 | #define GLFW_KEY_UP 265 |
| 458 | #define GLFW_KEY_PAGE_UP 266 |
| 459 | #define GLFW_KEY_PAGE_DOWN 267 |
| 460 | #define GLFW_KEY_HOME 268 |
| 461 | #define GLFW_KEY_END 269 |
| 462 | #define GLFW_KEY_CAPS_LOCK 280 |
| 463 | #define GLFW_KEY_SCROLL_LOCK 281 |
| 464 | #define GLFW_KEY_NUM_LOCK 282 |
| 465 | #define GLFW_KEY_PRINT_SCREEN 283 |
| 466 | #define GLFW_KEY_PAUSE 284 |
| 467 | #define GLFW_KEY_F1 290 |
| 468 | #define GLFW_KEY_F2 291 |
| 469 | #define GLFW_KEY_F3 292 |
| 470 | #define GLFW_KEY_F4 293 |
| 471 | #define GLFW_KEY_F5 294 |
| 472 | #define GLFW_KEY_F6 295 |
| 473 | #define GLFW_KEY_F7 296 |
| 474 | #define GLFW_KEY_F8 297 |
| 475 | #define GLFW_KEY_F9 298 |
| 476 | #define GLFW_KEY_F10 299 |
| 477 | #define GLFW_KEY_F11 300 |
| 478 | #define GLFW_KEY_F12 301 |
| 479 | #define GLFW_KEY_F13 302 |
| 480 | #define GLFW_KEY_F14 303 |
| 481 | #define GLFW_KEY_F15 304 |
| 482 | #define GLFW_KEY_F16 305 |
| 483 | #define GLFW_KEY_F17 306 |
| 484 | #define GLFW_KEY_F18 307 |
| 485 | #define GLFW_KEY_F19 308 |
| 486 | #define GLFW_KEY_F20 309 |
| 487 | #define GLFW_KEY_F21 310 |
| 488 | #define GLFW_KEY_F22 311 |
| 489 | #define GLFW_KEY_F23 312 |
| 490 | #define GLFW_KEY_F24 313 |
| 491 | #define GLFW_KEY_F25 314 |
| 492 | #define GLFW_KEY_KP_0 320 |
| 493 | #define GLFW_KEY_KP_1 321 |
| 494 | #define GLFW_KEY_KP_2 322 |
| 495 | #define GLFW_KEY_KP_3 323 |
| 496 | #define GLFW_KEY_KP_4 324 |
| 497 | #define GLFW_KEY_KP_5 325 |
| 498 | #define GLFW_KEY_KP_6 326 |
| 499 | #define GLFW_KEY_KP_7 327 |
| 500 | #define GLFW_KEY_KP_8 328 |
| 501 | #define GLFW_KEY_KP_9 329 |
| 502 | #define GLFW_KEY_KP_DECIMAL 330 |
| 503 | #define GLFW_KEY_KP_DIVIDE 331 |
| 504 | #define GLFW_KEY_KP_MULTIPLY 332 |
| 505 | #define GLFW_KEY_KP_SUBTRACT 333 |
| 506 | #define GLFW_KEY_KP_ADD 334 |
| 507 | #define GLFW_KEY_KP_ENTER 335 |
| 508 | #define GLFW_KEY_KP_EQUAL 336 |
| 509 | #define GLFW_KEY_LEFT_SHIFT 340 |
| 510 | #define GLFW_KEY_LEFT_CONTROL 341 |
| 511 | #define GLFW_KEY_LEFT_ALT 342 |
| 512 | #define GLFW_KEY_LEFT_SUPER 343 |
| 513 | #define GLFW_KEY_RIGHT_SHIFT 344 |
| 514 | #define GLFW_KEY_RIGHT_CONTROL 345 |
| 515 | #define GLFW_KEY_RIGHT_ALT 346 |
| 516 | #define GLFW_KEY_RIGHT_SUPER 347 |
| 517 | #define GLFW_KEY_MENU 348 |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 518 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 519 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 520 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 521 | /*! @} */ |
| 522 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 523 | /*! @defgroup mods Modifier key flags |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 524 | * @brief Modifier key flags. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 525 | * |
| 526 | * See [key input](@ref input_key) for how these are used. |
| 527 | * |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 528 | * @ingroup input |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 529 | * @{ */ |
| 530 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 531 | /*! @brief If this bit is set one or more Shift keys were held down. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 532 | * |
| 533 | * If this bit is set one or more Shift keys were held down. |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 534 | */ |
| 535 | #define GLFW_MOD_SHIFT 0x0001 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 536 | /*! @brief If this bit is set one or more Control keys were held down. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 537 | * |
| 538 | * If this bit is set one or more Control keys were held down. |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 539 | */ |
Camilla Berglund | 3bcffba | 2013-05-23 14:11:05 +0200 | [diff] [blame] | 540 | #define GLFW_MOD_CONTROL 0x0002 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 541 | /*! @brief If this bit is set one or more Alt keys were held down. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 542 | * |
| 543 | * If this bit is set one or more Alt keys were held down. |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 544 | */ |
| 545 | #define GLFW_MOD_ALT 0x0004 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 546 | /*! @brief If this bit is set one or more Super keys were held down. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 547 | * |
| 548 | * If this bit is set one or more Super keys were held down. |
Noel Cower | eff85f9 | 2013-05-23 13:22:27 +0200 | [diff] [blame] | 549 | */ |
| 550 | #define GLFW_MOD_SUPER 0x0008 |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 551 | /*! @brief If this bit is set the Caps Lock key is enabled. |
| 552 | * |
| 553 | * If this bit is set the Caps Lock key is enabled and the @ref |
| 554 | * GLFW_LOCK_KEY_MODS input mode is set. |
| 555 | */ |
| 556 | #define GLFW_MOD_CAPS_LOCK 0x0010 |
| 557 | /*! @brief If this bit is set the Num Lock key is enabled. |
| 558 | * |
| 559 | * If this bit is set the Num Lock key is enabled and the @ref |
| 560 | * GLFW_LOCK_KEY_MODS input mode is set. |
| 561 | */ |
| 562 | #define GLFW_MOD_NUM_LOCK 0x0020 |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 563 | |
| 564 | /*! @} */ |
| 565 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 566 | /*! @defgroup buttons Mouse buttons |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 567 | * @brief Mouse button IDs. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 568 | * |
| 569 | * See [mouse button input](@ref input_mouse_button) for how these are used. |
| 570 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 571 | * @ingroup input |
| 572 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 573 | #define GLFW_MOUSE_BUTTON_1 0 |
| 574 | #define GLFW_MOUSE_BUTTON_2 1 |
| 575 | #define GLFW_MOUSE_BUTTON_3 2 |
| 576 | #define GLFW_MOUSE_BUTTON_4 3 |
| 577 | #define GLFW_MOUSE_BUTTON_5 4 |
| 578 | #define GLFW_MOUSE_BUTTON_6 5 |
| 579 | #define GLFW_MOUSE_BUTTON_7 6 |
| 580 | #define GLFW_MOUSE_BUTTON_8 7 |
| 581 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
| 582 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
| 583 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
| 584 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 585 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 586 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 587 | /*! @defgroup joysticks Joysticks |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 588 | * @brief Joystick IDs. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 589 | * |
| 590 | * See [joystick input](@ref joystick) for how these are used. |
| 591 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 592 | * @ingroup input |
| 593 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 594 | #define GLFW_JOYSTICK_1 0 |
| 595 | #define GLFW_JOYSTICK_2 1 |
| 596 | #define GLFW_JOYSTICK_3 2 |
| 597 | #define GLFW_JOYSTICK_4 3 |
| 598 | #define GLFW_JOYSTICK_5 4 |
| 599 | #define GLFW_JOYSTICK_6 5 |
| 600 | #define GLFW_JOYSTICK_7 6 |
| 601 | #define GLFW_JOYSTICK_8 7 |
| 602 | #define GLFW_JOYSTICK_9 8 |
| 603 | #define GLFW_JOYSTICK_10 9 |
| 604 | #define GLFW_JOYSTICK_11 10 |
| 605 | #define GLFW_JOYSTICK_12 11 |
| 606 | #define GLFW_JOYSTICK_13 12 |
| 607 | #define GLFW_JOYSTICK_14 13 |
| 608 | #define GLFW_JOYSTICK_15 14 |
| 609 | #define GLFW_JOYSTICK_16 15 |
| 610 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 611 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 612 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 613 | /*! @defgroup gamepad_buttons Gamepad buttons |
| 614 | * @brief Gamepad buttons. |
| 615 | * |
| 616 | * See @ref gamepad for how these are used. |
| 617 | * |
| 618 | * @ingroup input |
| 619 | * @{ */ |
| 620 | #define GLFW_GAMEPAD_BUTTON_A 0 |
| 621 | #define GLFW_GAMEPAD_BUTTON_B 1 |
| 622 | #define GLFW_GAMEPAD_BUTTON_X 2 |
| 623 | #define GLFW_GAMEPAD_BUTTON_Y 3 |
| 624 | #define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4 |
| 625 | #define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5 |
| 626 | #define GLFW_GAMEPAD_BUTTON_BACK 6 |
| 627 | #define GLFW_GAMEPAD_BUTTON_START 7 |
| 628 | #define GLFW_GAMEPAD_BUTTON_GUIDE 8 |
| 629 | #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9 |
| 630 | #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10 |
| 631 | #define GLFW_GAMEPAD_BUTTON_DPAD_UP 11 |
| 632 | #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12 |
| 633 | #define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13 |
| 634 | #define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14 |
| 635 | #define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT |
| 636 | |
| 637 | #define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A |
| 638 | #define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B |
| 639 | #define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X |
| 640 | #define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y |
| 641 | /*! @} */ |
| 642 | |
| 643 | /*! @defgroup gamepad_axes Gamepad axes |
| 644 | * @brief Gamepad axes. |
| 645 | * |
| 646 | * See @ref gamepad for how these are used. |
| 647 | * |
| 648 | * @ingroup input |
| 649 | * @{ */ |
| 650 | #define GLFW_GAMEPAD_AXIS_LEFT_X 0 |
| 651 | #define GLFW_GAMEPAD_AXIS_LEFT_Y 1 |
| 652 | #define GLFW_GAMEPAD_AXIS_RIGHT_X 2 |
| 653 | #define GLFW_GAMEPAD_AXIS_RIGHT_Y 3 |
| 654 | #define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4 |
| 655 | #define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5 |
| 656 | #define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER |
| 657 | /*! @} */ |
| 658 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 659 | /*! @defgroup errors Error codes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 660 | * @brief Error codes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 661 | * |
| 662 | * See [error handling](@ref error_handling) for how these are used. |
| 663 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 664 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 665 | * @{ */ |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 666 | /*! @brief No error has occurred. |
| 667 | * |
| 668 | * No error has occurred. |
| 669 | * |
| 670 | * @analysis Yay. |
| 671 | */ |
| 672 | #define GLFW_NO_ERROR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 673 | /*! @brief GLFW has not been initialized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 674 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 675 | * This occurs if a GLFW function was called that must not be called unless the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 676 | * library is [initialized](@ref intro_init). |
| 677 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 678 | * @analysis Application programmer error. Initialize GLFW before calling any |
| 679 | * function that requires initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 680 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 681 | #define GLFW_NOT_INITIALIZED 0x00010001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 682 | /*! @brief No context is current for this thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 683 | * |
| 684 | * This occurs if a GLFW function was called that needs and operates on the |
| 685 | * current OpenGL or OpenGL ES context but no context is current on the calling |
| 686 | * thread. One such function is @ref glfwSwapInterval. |
| 687 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 688 | * @analysis Application programmer error. Ensure a context is current before |
| 689 | * calling functions that require a current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 690 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 691 | #define GLFW_NO_CURRENT_CONTEXT 0x00010002 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 692 | /*! @brief One of the arguments to the function was an invalid enum value. |
| 693 | * |
| 694 | * One of the arguments to the function was an invalid enum value, for example |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 695 | * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 696 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 697 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 698 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 699 | #define GLFW_INVALID_ENUM 0x00010003 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 700 | /*! @brief One of the arguments to the function was an invalid value. |
| 701 | * |
| 702 | * One of the arguments to the function was an invalid value, for example |
| 703 | * requesting a non-existent OpenGL or OpenGL ES version like 2.7. |
| 704 | * |
| 705 | * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead |
| 706 | * result in a @ref GLFW_VERSION_UNAVAILABLE error. |
| 707 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 708 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 709 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 710 | #define GLFW_INVALID_VALUE 0x00010004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 711 | /*! @brief A memory allocation failed. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 712 | * |
| 713 | * A memory allocation failed. |
| 714 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 715 | * @analysis A bug in GLFW or the underlying operating system. Report the bug |
| 716 | * to our [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 717 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 718 | #define GLFW_OUT_OF_MEMORY 0x00010005 |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 719 | /*! @brief GLFW could not find support for the requested API on the system. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 720 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 721 | * GLFW could not find support for the requested API on the system. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 722 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 723 | * @analysis The installed graphics driver does not support the requested |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 724 | * API, or does not support it via the chosen context creation API. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 725 | * Below are a few examples. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 726 | * |
| 727 | * @par |
| 728 | * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only |
Camilla Berglund | d95b79f | 2015-03-30 23:20:49 +0200 | [diff] [blame] | 729 | * supports OpenGL ES via EGL, while Nvidia and Intel only support it via |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 730 | * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa |
Camilla Berglund | 138feb8 | 2015-01-05 16:46:04 +0100 | [diff] [blame] | 731 | * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 732 | * driver. Older graphics drivers do not support Vulkan. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 733 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 734 | #define GLFW_API_UNAVAILABLE 0x00010006 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 735 | /*! @brief The requested OpenGL or OpenGL ES version is not available. |
| 736 | * |
Camilla Berglund | d493a82 | 2015-03-10 19:51:14 +0100 | [diff] [blame] | 737 | * The requested OpenGL or OpenGL ES version (including any requested context |
| 738 | * or framebuffer hints) is not available on this machine. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 739 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 740 | * @analysis The machine does not support your requirements. If your |
| 741 | * application is sufficiently flexible, downgrade your requirements and try |
| 742 | * again. Otherwise, inform the user that their machine does not match your |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 743 | * requirements. |
| 744 | * |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 745 | * @par |
| 746 | * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 |
| 747 | * comes out before the 4.x series gets that far, also fail with this error and |
| 748 | * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions |
| 749 | * will exist. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 750 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 751 | #define GLFW_VERSION_UNAVAILABLE 0x00010007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 752 | /*! @brief A platform-specific error occurred that does not match any of the |
| 753 | * more specific categories. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 754 | * |
| 755 | * A platform-specific error occurred that does not match any of the more |
| 756 | * specific categories. |
| 757 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 758 | * @analysis A bug or configuration error in GLFW, the underlying operating |
| 759 | * system or its drivers, or a lack of required resources. Report the issue to |
| 760 | * our [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 761 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 762 | #define GLFW_PLATFORM_ERROR 0x00010008 |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 763 | /*! @brief The requested format is not supported or available. |
| 764 | * |
| 765 | * If emitted during window creation, the requested pixel format is not |
| 766 | * supported. |
| 767 | * |
| 768 | * If emitted when querying the clipboard, the contents of the clipboard could |
| 769 | * not be converted to the requested format. |
| 770 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 771 | * @analysis If emitted during window creation, one or more |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 772 | * [hard constraints](@ref window_hints_hard) did not match any of the |
| 773 | * available pixel formats. If your application is sufficiently flexible, |
| 774 | * downgrade your requirements and try again. Otherwise, inform the user that |
| 775 | * their machine does not match your requirements. |
| 776 | * |
| 777 | * @par |
| 778 | * If emitted when querying the clipboard, ignore the error or report it to |
| 779 | * the user, as appropriate. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 780 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 781 | #define GLFW_FORMAT_UNAVAILABLE 0x00010009 |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 782 | /*! @brief The specified window does not have an OpenGL or OpenGL ES context. |
| 783 | * |
| 784 | * A window that does not have an OpenGL or OpenGL ES context was passed to |
| 785 | * a function that requires it to have one. |
| 786 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 787 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 788 | */ |
| 789 | #define GLFW_NO_WINDOW_CONTEXT 0x0001000A |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 790 | /*! @brief The specified cursor shape is not available. |
| 791 | * |
| 792 | * The specified standard cursor shape is not available, either because the |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 793 | * current platform cursor theme does not provide it or because it is not |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 794 | * available on the platform. |
| 795 | * |
| 796 | * @analysis Platform or system settings limitation. Pick another |
| 797 | * [standard cursor shape](@ref shapes) or create a |
| 798 | * [custom cursor](@ref cursor_custom). |
| 799 | */ |
| 800 | #define GLFW_CURSOR_UNAVAILABLE 0x0001000B |
Luflosi | b66f105 | 2020-06-23 16:20:27 +0200 | [diff] [blame] | 801 | /*! @brief The requested feature is not provided by the platform. |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 802 | * |
| 803 | * The requested feature is not provided by the platform, so GLFW is unable to |
| 804 | * implement it. The documentation for each function notes if it could emit |
| 805 | * this error. |
| 806 | * |
| 807 | * @analysis Platform or platform version limitation. The error can be ignored |
| 808 | * unless the feature is critical to the application. |
| 809 | * |
| 810 | * @par |
| 811 | * A function call that emits this error has no effect other than the error and |
| 812 | * updating any existing out parameters. |
| 813 | */ |
| 814 | #define GLFW_FEATURE_UNAVAILABLE 0x0001000C |
| 815 | /*! @brief The requested feature is not implemented for the platform. |
| 816 | * |
| 817 | * The requested feature has not yet been implemented in GLFW for this platform. |
| 818 | * |
| 819 | * @analysis An incomplete implementation of GLFW for this platform, hopefully |
| 820 | * fixed in a future release. The error can be ignored unless the feature is |
| 821 | * critical to the application. |
| 822 | * |
| 823 | * @par |
| 824 | * A function call that emits this error has no effect other than the error and |
| 825 | * updating any existing out parameters. |
| 826 | */ |
| 827 | #define GLFW_FEATURE_UNIMPLEMENTED 0x0001000D |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 828 | /*! @brief Platform unavailable or no matching platform was found. |
| 829 | * |
Camilla Löwy | d2b88cf | 2024-01-12 17:42:37 +0100 | [diff] [blame] | 830 | * If emitted during initialization, no matching platform was found. If the @ref |
| 831 | * GLFW_PLATFORM init hint was set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of |
| 832 | * the platforms supported by this library binary, except for the Null platform. If the |
| 833 | * init hint was set to a specific platform, it is either not supported by this library |
| 834 | * binary or GLFW was not able to detect it. |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 835 | * |
| 836 | * If emitted by a native access function, GLFW was initialized for a different platform |
| 837 | * than the function is for. |
| 838 | * |
| 839 | * @analysis Failure to detect any platform usually only happens on non-macOS Unix |
| 840 | * systems, either when no window system is running or the program was run from |
| 841 | * a terminal that does not have the necessary environment variables. Fall back to |
| 842 | * a different platform if possible or notify the user that no usable platform was |
| 843 | * detected. |
| 844 | * |
| 845 | * Failure to detect a specific platform may have the same cause as above or be because |
| 846 | * support for that platform was not compiled in. Call @ref glfwPlatformSupported to |
| 847 | * check whether a specific platform is supported by a library binary. |
| 848 | */ |
| 849 | #define GLFW_PLATFORM_UNAVAILABLE 0x0001000E |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 850 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 851 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 852 | /*! @addtogroup window |
| 853 | * @{ */ |
| 854 | /*! @brief Input focus window hint and attribute |
| 855 | * |
| 856 | * Input focus [window hint](@ref GLFW_FOCUSED_hint) or |
| 857 | * [window attribute](@ref GLFW_FOCUSED_attrib). |
| 858 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 859 | #define GLFW_FOCUSED 0x00020001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 860 | /*! @brief Window iconification window attribute |
| 861 | * |
| 862 | * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib). |
| 863 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 864 | #define GLFW_ICONIFIED 0x00020002 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 865 | /*! @brief Window resize-ability window hint and attribute |
| 866 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 867 | * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 868 | * [window attribute](@ref GLFW_RESIZABLE_attrib). |
| 869 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 870 | #define GLFW_RESIZABLE 0x00020003 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 871 | /*! @brief Window visibility window hint and attribute |
| 872 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 873 | * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 874 | * [window attribute](@ref GLFW_VISIBLE_attrib). |
| 875 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 876 | #define GLFW_VISIBLE 0x00020004 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 877 | /*! @brief Window decoration window hint and attribute |
| 878 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 879 | * Window decoration [window hint](@ref GLFW_DECORATED_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 880 | * [window attribute](@ref GLFW_DECORATED_attrib). |
| 881 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 882 | #define GLFW_DECORATED 0x00020005 |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 883 | /*! @brief Window auto-iconification window hint and attribute |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 884 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 885 | * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 886 | * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib). |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 887 | */ |
Camilla Berglund | 25e7ff1 | 2014-04-08 15:32:34 +0200 | [diff] [blame] | 888 | #define GLFW_AUTO_ICONIFY 0x00020006 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 889 | /*! @brief Window decoration window hint and attribute |
| 890 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 891 | * Window decoration [window hint](@ref GLFW_FLOATING_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 892 | * [window attribute](@ref GLFW_FLOATING_attrib). |
| 893 | */ |
Camilla Berglund | 3ce7bfe | 2014-05-23 14:01:02 +0200 | [diff] [blame] | 894 | #define GLFW_FLOATING 0x00020007 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 895 | /*! @brief Window maximization window hint and attribute |
| 896 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 897 | * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 898 | * [window attribute](@ref GLFW_MAXIMIZED_attrib). |
| 899 | */ |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 900 | #define GLFW_MAXIMIZED 0x00020008 |
Camilla Löwy | 5a74b50 | 2017-02-06 15:03:50 +0100 | [diff] [blame] | 901 | /*! @brief Cursor centering window hint |
| 902 | * |
| 903 | * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint). |
| 904 | */ |
Liam Middlebrook | 72ac5ba | 2016-08-18 11:47:54 -0400 | [diff] [blame] | 905 | #define GLFW_CENTER_CURSOR 0x00020009 |
Camilla Löwy | 32e78ae | 2017-09-18 18:10:57 +0200 | [diff] [blame] | 906 | /*! @brief Window framebuffer transparency hint and attribute |
| 907 | * |
Camilla Löwy | 49130ab | 2017-11-07 22:50:01 +0100 | [diff] [blame] | 908 | * Window framebuffer transparency |
| 909 | * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and |
| 910 | * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib). |
Camilla Löwy | 32e78ae | 2017-09-18 18:10:57 +0200 | [diff] [blame] | 911 | */ |
Camilla Löwy | 49130ab | 2017-11-07 22:50:01 +0100 | [diff] [blame] | 912 | #define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A |
Camilla Löwy | d6b3a60 | 2018-01-11 14:13:54 +0100 | [diff] [blame] | 913 | /*! @brief Mouse cursor hover window attribute. |
| 914 | * |
| 915 | * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib). |
| 916 | */ |
Camilla Löwy | ee9dffc | 2018-01-04 13:50:58 +0100 | [diff] [blame] | 917 | #define GLFW_HOVERED 0x0002000B |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 918 | /*! @brief Input focus on calling show window hint and attribute |
| 919 | * |
| 920 | * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or |
| 921 | * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). |
| 922 | */ |
| 923 | #define GLFW_FOCUS_ON_SHOW 0x0002000C |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 924 | |
Camilla Löwy | a122d91 | 2020-07-08 23:21:28 +0200 | [diff] [blame] | 925 | /*! @brief Mouse input transparency window hint and attribute |
Rokas Kupstys | d285a9f | 2019-09-30 15:44:43 +0300 | [diff] [blame] | 926 | * |
Camilla Löwy | a122d91 | 2020-07-08 23:21:28 +0200 | [diff] [blame] | 927 | * Mouse input transparency [window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or |
Rokas Kupstys | d285a9f | 2019-09-30 15:44:43 +0300 | [diff] [blame] | 928 | * [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib). |
| 929 | */ |
| 930 | #define GLFW_MOUSE_PASSTHROUGH 0x0002000D |
| 931 | |
Camilla Löwy | 0f9a957 | 2021-10-26 14:25:03 +0200 | [diff] [blame] | 932 | /*! @brief Initial position x-coordinate window hint. |
| 933 | * |
| 934 | * Initial position x-coordinate [window hint](@ref GLFW_POSITION_X). |
| 935 | */ |
| 936 | #define GLFW_POSITION_X 0x0002000E |
| 937 | |
| 938 | /*! @brief Initial position y-coordinate window hint. |
| 939 | * |
| 940 | * Initial position y-coordinate [window hint](@ref GLFW_POSITION_Y). |
| 941 | */ |
| 942 | #define GLFW_POSITION_Y 0x0002000F |
| 943 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 944 | /*! @brief Framebuffer bit depth hint. |
| 945 | * |
| 946 | * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). |
| 947 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 948 | #define GLFW_RED_BITS 0x00021001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 949 | /*! @brief Framebuffer bit depth hint. |
| 950 | * |
| 951 | * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS). |
| 952 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 953 | #define GLFW_GREEN_BITS 0x00021002 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 954 | /*! @brief Framebuffer bit depth hint. |
| 955 | * |
| 956 | * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS). |
| 957 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 958 | #define GLFW_BLUE_BITS 0x00021003 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 959 | /*! @brief Framebuffer bit depth hint. |
| 960 | * |
| 961 | * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS). |
| 962 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 963 | #define GLFW_ALPHA_BITS 0x00021004 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 964 | /*! @brief Framebuffer bit depth hint. |
| 965 | * |
| 966 | * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS). |
| 967 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 968 | #define GLFW_DEPTH_BITS 0x00021005 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 969 | /*! @brief Framebuffer bit depth hint. |
| 970 | * |
| 971 | * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS). |
| 972 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 973 | #define GLFW_STENCIL_BITS 0x00021006 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 974 | /*! @brief Framebuffer bit depth hint. |
| 975 | * |
| 976 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS). |
| 977 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 978 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 979 | /*! @brief Framebuffer bit depth hint. |
| 980 | * |
| 981 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS). |
| 982 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 983 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 984 | /*! @brief Framebuffer bit depth hint. |
| 985 | * |
| 986 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS). |
| 987 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 988 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 989 | /*! @brief Framebuffer bit depth hint. |
| 990 | * |
| 991 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS). |
| 992 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 993 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 994 | /*! @brief Framebuffer auxiliary buffer hint. |
| 995 | * |
| 996 | * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS). |
| 997 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 998 | #define GLFW_AUX_BUFFERS 0x0002100B |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 999 | /*! @brief OpenGL stereoscopic rendering hint. |
| 1000 | * |
| 1001 | * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO). |
| 1002 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1003 | #define GLFW_STEREO 0x0002100C |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1004 | /*! @brief Framebuffer MSAA samples hint. |
| 1005 | * |
| 1006 | * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES). |
| 1007 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1008 | #define GLFW_SAMPLES 0x0002100D |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1009 | /*! @brief Framebuffer sRGB hint. |
| 1010 | * |
| 1011 | * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE). |
| 1012 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1013 | #define GLFW_SRGB_CAPABLE 0x0002100E |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1014 | /*! @brief Monitor refresh rate hint. |
| 1015 | * |
| 1016 | * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE). |
| 1017 | */ |
Camilla Berglund | 2cd3438 | 2013-05-30 20:42:50 +0200 | [diff] [blame] | 1018 | #define GLFW_REFRESH_RATE 0x0002100F |
Camilla Löwy | 04f21ab | 2021-05-13 21:38:46 +0200 | [diff] [blame] | 1019 | /*! @brief Framebuffer double buffering hint and attribute. |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1020 | * |
Camilla Löwy | 04f21ab | 2021-05-13 21:38:46 +0200 | [diff] [blame] | 1021 | * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER_hint) and |
| 1022 | * [attribute](@ref GLFW_DOUBLEBUFFER_attrib). |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1023 | */ |
Camilla Berglund | c980858 | 2014-04-24 19:21:10 +0200 | [diff] [blame] | 1024 | #define GLFW_DOUBLEBUFFER 0x00021010 |
Bailey Cosier | 93e6666 | 2017-09-19 18:27:45 +0200 | [diff] [blame] | 1025 | |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1026 | /*! @brief Context client API hint and attribute. |
| 1027 | * |
| 1028 | * Context client API [hint](@ref GLFW_CLIENT_API_hint) and |
| 1029 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 1030 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1031 | #define GLFW_CLIENT_API 0x00022001 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1032 | /*! @brief Context client API major version hint and attribute. |
| 1033 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1034 | * Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint) |
| 1035 | * and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1036 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1037 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1038 | /*! @brief Context client API minor version hint and attribute. |
| 1039 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1040 | * Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint) |
| 1041 | * and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1042 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1043 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
Stephen Gutekanst | 37fc28b | 2021-11-15 15:50:37 -0700 | [diff] [blame] | 1044 | /*! @brief Context client API revision number attribute. |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1045 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1046 | * Context client API revision number |
| 1047 | * [attribute](@ref GLFW_CONTEXT_REVISION_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1048 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1049 | #define GLFW_CONTEXT_REVISION 0x00022004 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1050 | /*! @brief Context robustness hint and attribute. |
| 1051 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1052 | * Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint) |
| 1053 | * and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1054 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1055 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1056 | /*! @brief OpenGL forward-compatibility hint and attribute. |
| 1057 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1058 | * OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) |
| 1059 | * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1060 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1061 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
Camilla Löwy | 4e3b433 | 2020-06-28 19:21:36 +0200 | [diff] [blame] | 1062 | /*! @brief Debug mode context hint and attribute. |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1063 | * |
Camilla Löwy | b420ca7 | 2020-06-26 18:35:48 +0200 | [diff] [blame] | 1064 | * Debug mode context [hint](@ref GLFW_CONTEXT_DEBUG_hint) and |
| 1065 | * [attribute](@ref GLFW_CONTEXT_DEBUG_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1066 | */ |
Camilla Löwy | b420ca7 | 2020-06-26 18:35:48 +0200 | [diff] [blame] | 1067 | #define GLFW_CONTEXT_DEBUG 0x00022007 |
| 1068 | /*! @brief Legacy name for compatibility. |
| 1069 | * |
| 1070 | * This is an alias for compatibility with earlier versions. |
| 1071 | */ |
| 1072 | #define GLFW_OPENGL_DEBUG_CONTEXT GLFW_CONTEXT_DEBUG |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1073 | /*! @brief OpenGL profile hint and attribute. |
| 1074 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1075 | * OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and |
| 1076 | * [attribute](@ref GLFW_OPENGL_PROFILE_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1077 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1078 | #define GLFW_OPENGL_PROFILE 0x00022008 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1079 | /*! @brief Context flush-on-release hint and attribute. |
| 1080 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1081 | * Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and |
| 1082 | * [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1083 | */ |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 1084 | #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1085 | /*! @brief Context error suppression hint and attribute. |
| 1086 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1087 | * Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and |
| 1088 | * [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1089 | */ |
Camilla Berglund | 7be8209 | 2015-08-10 12:46:14 +0200 | [diff] [blame] | 1090 | #define GLFW_CONTEXT_NO_ERROR 0x0002200A |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1091 | /*! @brief Context creation API hint and attribute. |
| 1092 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1093 | * Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and |
| 1094 | * [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1095 | */ |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1096 | #define GLFW_CONTEXT_CREATION_API 0x0002200B |
Camilla Löwy | 089ea9a | 2018-08-31 13:33:48 +0200 | [diff] [blame] | 1097 | /*! @brief Window content area scaling window |
| 1098 | * [window hint](@ref GLFW_SCALE_TO_MONITOR). |
| 1099 | */ |
| 1100 | #define GLFW_SCALE_TO_MONITOR 0x0002200C |
Camilla Löwy | a9cc7c7 | 2024-02-07 20:04:14 +0100 | [diff] [blame] | 1101 | /*! @brief Window framebuffer scaling |
| 1102 | * [window hint](@ref GLFW_SCALE_FRAMEBUFFER_hint). |
| 1103 | */ |
| 1104 | #define GLFW_SCALE_FRAMEBUFFER 0x0002200D |
| 1105 | /*! @brief Legacy name for compatibility. |
| 1106 | * |
| 1107 | * This is an alias for the |
| 1108 | * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) window hint for |
| 1109 | * compatibility with earlier versions. |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1110 | */ |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 1111 | #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1112 | /*! @brief macOS specific |
| 1113 | * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint). |
| 1114 | */ |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 1115 | #define GLFW_COCOA_FRAME_NAME 0x00023002 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1116 | /*! @brief macOS specific |
| 1117 | * [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint). |
| 1118 | */ |
Camilla Löwy | 77a8f10 | 2017-01-27 12:02:09 +0100 | [diff] [blame] | 1119 | #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1120 | /*! @brief X11 specific |
| 1121 | * [window hint](@ref GLFW_X11_CLASS_NAME_hint). |
| 1122 | */ |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 1123 | #define GLFW_X11_CLASS_NAME 0x00024001 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1124 | /*! @brief X11 specific |
| 1125 | * [window hint](@ref GLFW_X11_CLASS_NAME_hint). |
| 1126 | */ |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 1127 | #define GLFW_X11_INSTANCE_NAME 0x00024002 |
Camilla Löwy | 8e288dc | 2019-08-20 19:00:59 +0200 | [diff] [blame] | 1128 | #define GLFW_WIN32_KEYBOARD_MENU 0x00025001 |
Camilla Löwy | 8946f53 | 2024-02-01 02:10:34 +0100 | [diff] [blame] | 1129 | /*! @brief Win32 specific [window hint](@ref GLFW_WIN32_SHOWDEFAULT_hint). |
| 1130 | */ |
| 1131 | #define GLFW_WIN32_SHOWDEFAULT 0x00025002 |
Michael Pennington | b9ed25d | 2022-05-26 20:33:28 -0400 | [diff] [blame] | 1132 | /*! @brief Wayland specific |
| 1133 | * [window hint](@ref GLFW_WAYLAND_APP_ID_hint). |
| 1134 | * |
| 1135 | * Allows specification of the Wayland app_id. |
| 1136 | */ |
| 1137 | #define GLFW_WAYLAND_APP_ID 0x00026001 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1138 | /*! @} */ |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 1139 | |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 1140 | #define GLFW_NO_API 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1141 | #define GLFW_OPENGL_API 0x00030001 |
| 1142 | #define GLFW_OPENGL_ES_API 0x00030002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1143 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1144 | #define GLFW_NO_ROBUSTNESS 0 |
| 1145 | #define GLFW_NO_RESET_NOTIFICATION 0x00031001 |
| 1146 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1147 | |
Camilla Berglund | 44e8401 | 2013-06-05 16:13:30 +0200 | [diff] [blame] | 1148 | #define GLFW_OPENGL_ANY_PROFILE 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1149 | #define GLFW_OPENGL_CORE_PROFILE 0x00032001 |
| 1150 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1151 | |
Grzesiek11 | bf945f1 | 2024-02-29 15:50:50 +0000 | [diff] [blame] | 1152 | #define GLFW_CURSOR 0x00033001 |
| 1153 | #define GLFW_STICKY_KEYS 0x00033002 |
| 1154 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
| 1155 | #define GLFW_LOCK_KEY_MODS 0x00033004 |
| 1156 | #define GLFW_RAW_MOUSE_MOTION 0x00033005 |
| 1157 | #define GLFW_UNLIMITED_MOUSE_BUTTONS 0x00033006 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1158 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1159 | #define GLFW_CURSOR_NORMAL 0x00034001 |
| 1160 | #define GLFW_CURSOR_HIDDEN 0x00034002 |
| 1161 | #define GLFW_CURSOR_DISABLED 0x00034003 |
Camilla Löwy | 488008e | 2019-12-03 17:58:20 +0100 | [diff] [blame] | 1162 | #define GLFW_CURSOR_CAPTURED 0x00034004 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1163 | |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 1164 | #define GLFW_ANY_RELEASE_BEHAVIOR 0 |
| 1165 | #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 |
| 1166 | #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 |
| 1167 | |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1168 | #define GLFW_NATIVE_CONTEXT_API 0x00036001 |
| 1169 | #define GLFW_EGL_CONTEXT_API 0x00036002 |
Camilla Löwy | e9560ef | 2017-02-28 19:23:25 +0100 | [diff] [blame] | 1170 | #define GLFW_OSMESA_CONTEXT_API 0x00036003 |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1171 | |
Camilla Löwy | 0dea8a4 | 2020-06-25 18:22:08 +0200 | [diff] [blame] | 1172 | #define GLFW_ANGLE_PLATFORM_TYPE_NONE 0x00037001 |
| 1173 | #define GLFW_ANGLE_PLATFORM_TYPE_OPENGL 0x00037002 |
| 1174 | #define GLFW_ANGLE_PLATFORM_TYPE_OPENGLES 0x00037003 |
| 1175 | #define GLFW_ANGLE_PLATFORM_TYPE_D3D9 0x00037004 |
| 1176 | #define GLFW_ANGLE_PLATFORM_TYPE_D3D11 0x00037005 |
| 1177 | #define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007 |
| 1178 | #define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008 |
| 1179 | |
Camilla Löwy | fbdb53b | 2022-12-27 14:37:27 +0100 | [diff] [blame] | 1180 | #define GLFW_WAYLAND_PREFER_LIBDECOR 0x00038001 |
| 1181 | #define GLFW_WAYLAND_DISABLE_LIBDECOR 0x00038002 |
| 1182 | |
Camilla Löwy | 0f9a957 | 2021-10-26 14:25:03 +0200 | [diff] [blame] | 1183 | #define GLFW_ANY_POSITION 0x80000000 |
| 1184 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1185 | /*! @defgroup shapes Standard cursor shapes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 1186 | * @brief Standard system cursor shapes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1187 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1188 | * These are the [standard cursor shapes](@ref cursor_standard) that can be |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 1189 | * requested from the platform (window system). |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1190 | * |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1191 | * @ingroup input |
| 1192 | * @{ */ |
| 1193 | |
| 1194 | /*! @brief The regular arrow cursor shape. |
| 1195 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1196 | * The regular arrow cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1197 | */ |
| 1198 | #define GLFW_ARROW_CURSOR 0x00036001 |
| 1199 | /*! @brief The text input I-beam cursor shape. |
| 1200 | * |
| 1201 | * The text input I-beam cursor shape. |
| 1202 | */ |
| 1203 | #define GLFW_IBEAM_CURSOR 0x00036002 |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1204 | /*! @brief The crosshair cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1205 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1206 | * The crosshair cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1207 | */ |
| 1208 | #define GLFW_CROSSHAIR_CURSOR 0x00036003 |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1209 | /*! @brief The pointing hand cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1210 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1211 | * The pointing hand cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1212 | */ |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1213 | #define GLFW_POINTING_HAND_CURSOR 0x00036004 |
| 1214 | /*! @brief The horizontal resize/move arrow shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1215 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1216 | * The horizontal resize/move arrow shape. This is usually a horizontal |
| 1217 | * double-headed arrow. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1218 | */ |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1219 | #define GLFW_RESIZE_EW_CURSOR 0x00036005 |
| 1220 | /*! @brief The vertical resize/move arrow shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1221 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1222 | * The vertical resize/move shape. This is usually a vertical double-headed |
| 1223 | * arrow. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1224 | */ |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1225 | #define GLFW_RESIZE_NS_CURSOR 0x00036006 |
| 1226 | /*! @brief The top-left to bottom-right diagonal resize/move arrow shape. |
| 1227 | * |
| 1228 | * The top-left to bottom-right diagonal resize/move shape. This is usually |
| 1229 | * a diagonal double-headed arrow. |
| 1230 | * |
| 1231 | * @note @macos This shape is provided by a private system API and may fail |
| 1232 | * with @ref GLFW_CURSOR_UNAVAILABLE in the future. |
| 1233 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1234 | * @note @wayland This shape is provided by a newer standard not supported by |
| 1235 | * all cursor themes. |
Camilla Löwy | 0bb605c | 2024-02-19 15:06:59 +0100 | [diff] [blame] | 1236 | * |
| 1237 | * @note @x11 This shape is provided by a newer standard not supported by all |
| 1238 | * cursor themes. |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1239 | */ |
| 1240 | #define GLFW_RESIZE_NWSE_CURSOR 0x00036007 |
| 1241 | /*! @brief The top-right to bottom-left diagonal resize/move arrow shape. |
| 1242 | * |
| 1243 | * The top-right to bottom-left diagonal resize/move shape. This is usually |
| 1244 | * a diagonal double-headed arrow. |
| 1245 | * |
| 1246 | * @note @macos This shape is provided by a private system API and may fail |
| 1247 | * with @ref GLFW_CURSOR_UNAVAILABLE in the future. |
| 1248 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1249 | * @note @wayland This shape is provided by a newer standard not supported by |
| 1250 | * all cursor themes. |
Camilla Löwy | 0bb605c | 2024-02-19 15:06:59 +0100 | [diff] [blame] | 1251 | * |
| 1252 | * @note @x11 This shape is provided by a newer standard not supported by all |
| 1253 | * cursor themes. |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1254 | */ |
| 1255 | #define GLFW_RESIZE_NESW_CURSOR 0x00036008 |
| 1256 | /*! @brief The omni-directional resize/move cursor shape. |
| 1257 | * |
| 1258 | * The omni-directional resize cursor/move shape. This is usually either |
| 1259 | * a combined horizontal and vertical double-headed arrow or a grabbing hand. |
| 1260 | */ |
| 1261 | #define GLFW_RESIZE_ALL_CURSOR 0x00036009 |
| 1262 | /*! @brief The operation-not-allowed shape. |
| 1263 | * |
| 1264 | * The operation-not-allowed shape. This is usually a circle with a diagonal |
| 1265 | * line through it. |
| 1266 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1267 | * @note @wayland This shape is provided by a newer standard not supported by |
| 1268 | * all cursor themes. |
Camilla Löwy | 0bb605c | 2024-02-19 15:06:59 +0100 | [diff] [blame] | 1269 | * |
| 1270 | * @note @x11 This shape is provided by a newer standard not supported by all |
| 1271 | * cursor themes. |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1272 | */ |
| 1273 | #define GLFW_NOT_ALLOWED_CURSOR 0x0003600A |
| 1274 | /*! @brief Legacy name for compatibility. |
| 1275 | * |
| 1276 | * This is an alias for compatibility with earlier versions. |
| 1277 | */ |
| 1278 | #define GLFW_HRESIZE_CURSOR GLFW_RESIZE_EW_CURSOR |
| 1279 | /*! @brief Legacy name for compatibility. |
| 1280 | * |
| 1281 | * This is an alias for compatibility with earlier versions. |
| 1282 | */ |
| 1283 | #define GLFW_VRESIZE_CURSOR GLFW_RESIZE_NS_CURSOR |
| 1284 | /*! @brief Legacy name for compatibility. |
| 1285 | * |
| 1286 | * This is an alias for compatibility with earlier versions. |
| 1287 | */ |
| 1288 | #define GLFW_HAND_CURSOR GLFW_POINTING_HAND_CURSOR |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1289 | /*! @} */ |
| 1290 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1291 | #define GLFW_CONNECTED 0x00040001 |
| 1292 | #define GLFW_DISCONNECTED 0x00040002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1293 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1294 | /*! @addtogroup init |
| 1295 | * @{ */ |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1296 | /*! @brief Joystick hat buttons init hint. |
| 1297 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1298 | * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1299 | */ |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 1300 | #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001 |
Camilla Löwy | 0dea8a4 | 2020-06-25 18:22:08 +0200 | [diff] [blame] | 1301 | /*! @brief ANGLE rendering backend init hint. |
| 1302 | * |
| 1303 | * ANGLE rendering backend [init hint](@ref GLFW_ANGLE_PLATFORM_TYPE_hint). |
| 1304 | */ |
| 1305 | #define GLFW_ANGLE_PLATFORM_TYPE 0x00050002 |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 1306 | /*! @brief Platform selection init hint. |
| 1307 | * |
| 1308 | * Platform selection [init hint](@ref GLFW_PLATFORM). |
| 1309 | */ |
| 1310 | #define GLFW_PLATFORM 0x00050003 |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1311 | /*! @brief macOS specific init hint. |
| 1312 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1313 | * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1314 | */ |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1315 | #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001 |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1316 | /*! @brief macOS specific init hint. |
| 1317 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1318 | * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1319 | */ |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1320 | #define GLFW_COCOA_MENUBAR 0x00051002 |
Nicolas Caramelli | 84f95a7 | 2020-10-23 18:55:37 +0200 | [diff] [blame] | 1321 | /*! @brief X11 specific init hint. |
| 1322 | * |
| 1323 | * X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint). |
| 1324 | */ |
| 1325 | #define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001 |
Camilla Löwy | fbdb53b | 2022-12-27 14:37:27 +0100 | [diff] [blame] | 1326 | /*! @brief Wayland specific init hint. |
| 1327 | * |
| 1328 | * Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint). |
| 1329 | */ |
| 1330 | #define GLFW_WAYLAND_LIBDECOR 0x00053001 |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1331 | /*! @} */ |
| 1332 | |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 1333 | /*! @addtogroup init |
| 1334 | * @{ */ |
| 1335 | /*! @brief Hint value that enables automatic platform selection. |
| 1336 | * |
| 1337 | * Hint value for @ref GLFW_PLATFORM that enables automatic platform selection. |
| 1338 | */ |
| 1339 | #define GLFW_ANY_PLATFORM 0x00060000 |
| 1340 | #define GLFW_PLATFORM_WIN32 0x00060001 |
| 1341 | #define GLFW_PLATFORM_COCOA 0x00060002 |
| 1342 | #define GLFW_PLATFORM_WAYLAND 0x00060003 |
| 1343 | #define GLFW_PLATFORM_X11 0x00060004 |
| 1344 | #define GLFW_PLATFORM_NULL 0x00060005 |
| 1345 | /*! @} */ |
| 1346 | |
Camilla Berglund | 2810130 | 2014-04-08 18:57:43 +0200 | [diff] [blame] | 1347 | #define GLFW_DONT_CARE -1 |
| 1348 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 1349 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1350 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1351 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1352 | *************************************************************************/ |
| 1353 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1354 | /*! @brief Client API function pointer type. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1355 | * |
| 1356 | * Generic function pointer used for returning client API function pointers |
| 1357 | * without forcing a cast from a regular pointer. |
| 1358 | * |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1359 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1360 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1361 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1362 | * @since Added in version 3.0. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 1363 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1364 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1365 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 1366 | typedef void (*GLFWglproc)(void); |
| 1367 | |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1368 | /*! @brief Vulkan API function pointer type. |
| 1369 | * |
| 1370 | * Generic function pointer used for returning Vulkan API function pointers |
| 1371 | * without forcing a cast from a regular pointer. |
| 1372 | * |
| 1373 | * @sa @ref vulkan_proc |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1374 | * @sa @ref glfwGetInstanceProcAddress |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1375 | * |
| 1376 | * @since Added in version 3.2. |
| 1377 | * |
| 1378 | * @ingroup vulkan |
| 1379 | */ |
| 1380 | typedef void (*GLFWvkproc)(void); |
| 1381 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1382 | /*! @brief Opaque monitor object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1383 | * |
| 1384 | * Opaque monitor object. |
| 1385 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1386 | * @see @ref monitor_object |
| 1387 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1388 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1389 | * |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1390 | * @ingroup monitor |
| 1391 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1392 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 1393 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1394 | /*! @brief Opaque window object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1395 | * |
| 1396 | * Opaque window object. |
| 1397 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1398 | * @see @ref window_object |
| 1399 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1400 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1401 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1402 | * @ingroup window |
| 1403 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1404 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1405 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1406 | /*! @brief Opaque cursor object. |
| 1407 | * |
| 1408 | * Opaque cursor object. |
| 1409 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1410 | * @see @ref cursor_object |
| 1411 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1412 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1413 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1414 | * @ingroup input |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1415 | */ |
| 1416 | typedef struct GLFWcursor GLFWcursor; |
| 1417 | |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1418 | /*! @brief The function pointer type for memory allocation callbacks. |
| 1419 | * |
| 1420 | * This is the function pointer type for memory allocation callbacks. A memory |
| 1421 | * allocation callback function has the following signature: |
| 1422 | * @code |
| 1423 | * void* function_name(size_t size, void* user) |
| 1424 | * @endcode |
| 1425 | * |
| 1426 | * This function must return either a memory block at least `size` bytes long, |
| 1427 | * or `NULL` if allocation failed. Note that not all parts of GLFW handle allocation |
| 1428 | * failures gracefully yet. |
| 1429 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1430 | * This function must support being called during @ref glfwInit but before the library is |
| 1431 | * flagged as initialized, as well as during @ref glfwTerminate after the library is no |
| 1432 | * longer flagged as initialized. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1433 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1434 | * Any memory allocated via this function will be deallocated via the same allocator |
| 1435 | * during library termination or earlier. |
| 1436 | * |
| 1437 | * Any memory allocated via this function must be suitably aligned for any object type. |
| 1438 | * If you are using C99 or earlier, this alignment is platform-dependent but will be the |
| 1439 | * same as what `malloc` provides. If you are using C11 or later, this is the value of |
| 1440 | * `alignof(max_align_t)`. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1441 | * |
| 1442 | * The size will always be greater than zero. Allocations of size zero are filtered out |
| 1443 | * before reaching the custom allocator. |
| 1444 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1445 | * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY. |
| 1446 | * |
| 1447 | * This function must not call any GLFW function. |
| 1448 | * |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1449 | * @param[in] size The minimum size, in bytes, of the memory block. |
| 1450 | * @param[in] user The user-defined pointer from the allocator. |
| 1451 | * @return The address of the newly allocated memory block, or `NULL` if an |
| 1452 | * error occurred. |
| 1453 | * |
| 1454 | * @pointer_lifetime The returned memory block must be valid at least until it |
| 1455 | * is deallocated. |
| 1456 | * |
| 1457 | * @reentrancy This function should not call any GLFW function. |
| 1458 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1459 | * @thread_safety This function must support being called from any thread that calls GLFW |
| 1460 | * functions. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1461 | * |
| 1462 | * @sa @ref init_allocator |
| 1463 | * @sa @ref GLFWallocator |
| 1464 | * |
| 1465 | * @since Added in version 3.4. |
| 1466 | * |
| 1467 | * @ingroup init |
| 1468 | */ |
| 1469 | typedef void* (* GLFWallocatefun)(size_t size, void* user); |
| 1470 | |
| 1471 | /*! @brief The function pointer type for memory reallocation callbacks. |
| 1472 | * |
| 1473 | * This is the function pointer type for memory reallocation callbacks. |
| 1474 | * A memory reallocation callback function has the following signature: |
| 1475 | * @code |
| 1476 | * void* function_name(void* block, size_t size, void* user) |
| 1477 | * @endcode |
| 1478 | * |
| 1479 | * This function must return a memory block at least `size` bytes long, or |
| 1480 | * `NULL` if allocation failed. Note that not all parts of GLFW handle allocation |
| 1481 | * failures gracefully yet. |
| 1482 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1483 | * This function must support being called during @ref glfwInit but before the library is |
| 1484 | * flagged as initialized, as well as during @ref glfwTerminate after the library is no |
| 1485 | * longer flagged as initialized. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1486 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1487 | * Any memory allocated via this function will be deallocated via the same allocator |
| 1488 | * during library termination or earlier. |
| 1489 | * |
| 1490 | * Any memory allocated via this function must be suitably aligned for any object type. |
| 1491 | * If you are using C99 or earlier, this alignment is platform-dependent but will be the |
| 1492 | * same as what `realloc` provides. If you are using C11 or later, this is the value of |
| 1493 | * `alignof(max_align_t)`. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1494 | * |
| 1495 | * The block address will never be `NULL` and the size will always be greater than zero. |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1496 | * Reallocations of a block to size zero are converted into deallocations before reaching |
| 1497 | * the custom allocator. Reallocations of `NULL` to a non-zero size are converted into |
| 1498 | * regular allocations before reaching the custom allocator. |
| 1499 | * |
| 1500 | * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY. |
| 1501 | * |
| 1502 | * This function must not call any GLFW function. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1503 | * |
| 1504 | * @param[in] block The address of the memory block to reallocate. |
| 1505 | * @param[in] size The new minimum size, in bytes, of the memory block. |
| 1506 | * @param[in] user The user-defined pointer from the allocator. |
| 1507 | * @return The address of the newly allocated or resized memory block, or |
| 1508 | * `NULL` if an error occurred. |
| 1509 | * |
| 1510 | * @pointer_lifetime The returned memory block must be valid at least until it |
| 1511 | * is deallocated. |
| 1512 | * |
| 1513 | * @reentrancy This function should not call any GLFW function. |
| 1514 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1515 | * @thread_safety This function must support being called from any thread that calls GLFW |
| 1516 | * functions. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1517 | * |
| 1518 | * @sa @ref init_allocator |
| 1519 | * @sa @ref GLFWallocator |
| 1520 | * |
| 1521 | * @since Added in version 3.4. |
| 1522 | * |
| 1523 | * @ingroup init |
| 1524 | */ |
| 1525 | typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user); |
| 1526 | |
| 1527 | /*! @brief The function pointer type for memory deallocation callbacks. |
| 1528 | * |
| 1529 | * This is the function pointer type for memory deallocation callbacks. |
| 1530 | * A memory deallocation callback function has the following signature: |
| 1531 | * @code |
| 1532 | * void function_name(void* block, void* user) |
| 1533 | * @endcode |
| 1534 | * |
| 1535 | * This function may deallocate the specified memory block. This memory block |
| 1536 | * will have been allocated with the same allocator. |
| 1537 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1538 | * This function must support being called during @ref glfwInit but before the library is |
| 1539 | * flagged as initialized, as well as during @ref glfwTerminate after the library is no |
| 1540 | * longer flagged as initialized. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1541 | * |
| 1542 | * The block address will never be `NULL`. Deallocations of `NULL` are filtered out |
| 1543 | * before reaching the custom allocator. |
| 1544 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1545 | * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY. |
| 1546 | * |
| 1547 | * This function must not call any GLFW function. |
| 1548 | * |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1549 | * @param[in] block The address of the memory block to deallocate. |
| 1550 | * @param[in] user The user-defined pointer from the allocator. |
| 1551 | * |
| 1552 | * @pointer_lifetime The specified memory block will not be accessed by GLFW |
| 1553 | * after this function is called. |
| 1554 | * |
| 1555 | * @reentrancy This function should not call any GLFW function. |
| 1556 | * |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 1557 | * @thread_safety This function must support being called from any thread that calls GLFW |
| 1558 | * functions. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1559 | * |
| 1560 | * @sa @ref init_allocator |
| 1561 | * @sa @ref GLFWallocator |
| 1562 | * |
| 1563 | * @since Added in version 3.4. |
| 1564 | * |
| 1565 | * @ingroup init |
| 1566 | */ |
| 1567 | typedef void (* GLFWdeallocatefun)(void* block, void* user); |
| 1568 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1569 | /*! @brief The function pointer type for error callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1570 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1571 | * This is the function pointer type for error callbacks. An error callback |
| 1572 | * function has the following signature: |
| 1573 | * @code |
| 1574 | * void callback_name(int error_code, const char* description) |
| 1575 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1576 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1577 | * @param[in] error_code An [error code](@ref errors). Future releases may add |
| 1578 | * more error codes. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1579 | * @param[in] description A UTF-8 encoded string describing the error. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1580 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1581 | * @pointer_lifetime The error description string is valid until the callback |
| 1582 | * function returns. |
| 1583 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1584 | * @sa @ref error_handling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1585 | * @sa @ref glfwSetErrorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1586 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1587 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1588 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1589 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1590 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1591 | typedef void (* GLFWerrorfun)(int error_code, const char* description); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1592 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1593 | /*! @brief The function pointer type for window position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1594 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1595 | * This is the function pointer type for window position callbacks. A window |
| 1596 | * position callback function has the following signature: |
| 1597 | * @code |
| 1598 | * void callback_name(GLFWwindow* window, int xpos, int ypos) |
| 1599 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1600 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1601 | * @param[in] window The window that was moved. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1602 | * @param[in] xpos The new x-coordinate, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 1603 | * upper-left corner of the content area of the window. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1604 | * @param[in] ypos The new y-coordinate, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 1605 | * upper-left corner of the content area of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1606 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1607 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1608 | * @sa @ref glfwSetWindowPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1609 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1610 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1611 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1612 | * @ingroup window |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1613 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1614 | typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1615 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1616 | /*! @brief The function pointer type for window size callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1617 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1618 | * This is the function pointer type for window size callbacks. A window size |
| 1619 | * callback function has the following signature: |
| 1620 | * @code |
| 1621 | * void callback_name(GLFWwindow* window, int width, int height) |
| 1622 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1623 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1624 | * @param[in] window The window that was resized. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1625 | * @param[in] width The new width, in screen coordinates, of the window. |
| 1626 | * @param[in] height The new height, in screen coordinates, of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1627 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1628 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1629 | * @sa @ref glfwSetWindowSizeCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1630 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1631 | * @since Added in version 1.0. |
| 1632 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1633 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1634 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1635 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1636 | typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1637 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1638 | /*! @brief The function pointer type for window close callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1639 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1640 | * This is the function pointer type for window close callbacks. A window |
| 1641 | * close callback function has the following signature: |
| 1642 | * @code |
| 1643 | * void function_name(GLFWwindow* window) |
| 1644 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1645 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1646 | * @param[in] window The window that the user attempted to close. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1647 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1648 | * @sa @ref window_close |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1649 | * @sa @ref glfwSetWindowCloseCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1650 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1651 | * @since Added in version 2.5. |
| 1652 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1653 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1654 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1655 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1656 | typedef void (* GLFWwindowclosefun)(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1657 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1658 | /*! @brief The function pointer type for window content refresh callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1659 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1660 | * This is the function pointer type for window content refresh callbacks. |
| 1661 | * A window content refresh callback function has the following signature: |
| 1662 | * @code |
| 1663 | * void function_name(GLFWwindow* window); |
| 1664 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1665 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1666 | * @param[in] window The window whose content needs to be refreshed. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1667 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1668 | * @sa @ref window_refresh |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1669 | * @sa @ref glfwSetWindowRefreshCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1670 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1671 | * @since Added in version 2.5. |
| 1672 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1673 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1674 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1675 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1676 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1677 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1678 | /*! @brief The function pointer type for window focus callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1679 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1680 | * This is the function pointer type for window focus callbacks. A window |
| 1681 | * focus callback function has the following signature: |
| 1682 | * @code |
| 1683 | * void function_name(GLFWwindow* window, int focused) |
| 1684 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1685 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1686 | * @param[in] window The window that gained or lost input focus. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1687 | * @param[in] focused `GLFW_TRUE` if the window was given input focus, or |
| 1688 | * `GLFW_FALSE` if it lost it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1689 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1690 | * @sa @ref window_focus |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1691 | * @sa @ref glfwSetWindowFocusCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1692 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1693 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1694 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1695 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1696 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1697 | typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1698 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1699 | /*! @brief The function pointer type for window iconify callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1700 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1701 | * This is the function pointer type for window iconify callbacks. A window |
| 1702 | * iconify callback function has the following signature: |
| 1703 | * @code |
| 1704 | * void function_name(GLFWwindow* window, int iconified) |
| 1705 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1706 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1707 | * @param[in] window The window that was iconified or restored. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1708 | * @param[in] iconified `GLFW_TRUE` if the window was iconified, or |
| 1709 | * `GLFW_FALSE` if it was restored. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1710 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1711 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1712 | * @sa @ref glfwSetWindowIconifyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1713 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1714 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1715 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1716 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1717 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1718 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1719 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1720 | /*! @brief The function pointer type for window maximize callbacks. |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1721 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1722 | * This is the function pointer type for window maximize callbacks. A window |
| 1723 | * maximize callback function has the following signature: |
| 1724 | * @code |
| 1725 | * void function_name(GLFWwindow* window, int maximized) |
| 1726 | * @endcode |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1727 | * |
| 1728 | * @param[in] window The window that was maximized or restored. |
Emmanuel Gil Peyrot | 1ed1489 | 2020-09-07 20:19:51 +0200 | [diff] [blame] | 1729 | * @param[in] maximized `GLFW_TRUE` if the window was maximized, or |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1730 | * `GLFW_FALSE` if it was restored. |
| 1731 | * |
| 1732 | * @sa @ref window_maximize |
| 1733 | * @sa glfwSetWindowMaximizeCallback |
| 1734 | * |
| 1735 | * @since Added in version 3.3. |
| 1736 | * |
| 1737 | * @ingroup window |
| 1738 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1739 | typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized); |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1740 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1741 | /*! @brief The function pointer type for framebuffer size callbacks. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1742 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1743 | * This is the function pointer type for framebuffer size callbacks. |
| 1744 | * A framebuffer size callback function has the following signature: |
| 1745 | * @code |
| 1746 | * void function_name(GLFWwindow* window, int width, int height) |
| 1747 | * @endcode |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1748 | * |
| 1749 | * @param[in] window The window whose framebuffer was resized. |
| 1750 | * @param[in] width The new width, in pixels, of the framebuffer. |
| 1751 | * @param[in] height The new height, in pixels, of the framebuffer. |
| 1752 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1753 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1754 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1755 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1756 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1757 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1758 | * @ingroup window |
| 1759 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1760 | typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height); |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1761 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1762 | /*! @brief The function pointer type for window content scale callbacks. |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1763 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1764 | * This is the function pointer type for window content scale callbacks. |
| 1765 | * A window content scale callback function has the following signature: |
| 1766 | * @code |
| 1767 | * void function_name(GLFWwindow* window, float xscale, float yscale) |
| 1768 | * @endcode |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1769 | * |
| 1770 | * @param[in] window The window whose content scale changed. |
| 1771 | * @param[in] xscale The new x-axis content scale of the window. |
| 1772 | * @param[in] yscale The new y-axis content scale of the window. |
| 1773 | * |
| 1774 | * @sa @ref window_scale |
| 1775 | * @sa @ref glfwSetWindowContentScaleCallback |
| 1776 | * |
| 1777 | * @since Added in version 3.3. |
| 1778 | * |
| 1779 | * @ingroup window |
| 1780 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1781 | typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale); |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1782 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1783 | /*! @brief The function pointer type for mouse button callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1784 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1785 | * This is the function pointer type for mouse button callback functions. |
| 1786 | * A mouse button callback function has the following signature: |
| 1787 | * @code |
| 1788 | * void function_name(GLFWwindow* window, int button, int action, int mods) |
| 1789 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1790 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1791 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1792 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
| 1793 | * released. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1794 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. Future releases |
| 1795 | * may add more actions. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1796 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1797 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1798 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1799 | * @sa @ref input_mouse_button |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1800 | * @sa @ref glfwSetMouseButtonCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1801 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1802 | * @since Added in version 1.0. |
| 1803 | * @glfw3 Added window handle and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1804 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1805 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1806 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1807 | typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1808 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1809 | /*! @brief The function pointer type for cursor position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1810 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1811 | * This is the function pointer type for cursor position callbacks. A cursor |
| 1812 | * position callback function has the following signature: |
| 1813 | * @code |
| 1814 | * void function_name(GLFWwindow* window, double xpos, double ypos); |
| 1815 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1816 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1817 | * @param[in] window The window that received the event. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1818 | * @param[in] xpos The new cursor x-coordinate, relative to the left edge of |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 1819 | * the content area. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1820 | * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 1821 | * content area. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1822 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1823 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1824 | * @sa @ref glfwSetCursorPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1825 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1826 | * @since Added in version 3.0. Replaces `GLFWmouseposfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1827 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1828 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1829 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1830 | typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1831 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1832 | /*! @brief The function pointer type for cursor enter/leave callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1833 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1834 | * This is the function pointer type for cursor enter/leave callbacks. |
| 1835 | * A cursor enter/leave callback function has the following signature: |
| 1836 | * @code |
| 1837 | * void function_name(GLFWwindow* window, int entered) |
| 1838 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1839 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1840 | * @param[in] window The window that received the event. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 1841 | * @param[in] entered `GLFW_TRUE` if the cursor entered the window's content |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1842 | * area, or `GLFW_FALSE` if it left it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1843 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1844 | * @sa @ref cursor_enter |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1845 | * @sa @ref glfwSetCursorEnterCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1846 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1847 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1848 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1849 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1850 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1851 | typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1852 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1853 | /*! @brief The function pointer type for scroll callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1854 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1855 | * This is the function pointer type for scroll callbacks. A scroll callback |
| 1856 | * function has the following signature: |
| 1857 | * @code |
| 1858 | * void function_name(GLFWwindow* window, double xoffset, double yoffset) |
| 1859 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1860 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1861 | * @param[in] window The window that received the event. |
mewmew | cf2d260 | 2013-06-06 19:49:23 +0200 | [diff] [blame] | 1862 | * @param[in] xoffset The scroll offset along the x-axis. |
| 1863 | * @param[in] yoffset The scroll offset along the y-axis. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1864 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1865 | * @sa @ref scrolling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1866 | * @sa @ref glfwSetScrollCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1867 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1868 | * @since Added in version 3.0. Replaces `GLFWmousewheelfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1869 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1870 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1871 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1872 | typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1873 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1874 | /*! @brief The function pointer type for keyboard key callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1875 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1876 | * This is the function pointer type for keyboard key callbacks. A keyboard |
| 1877 | * key callback function has the following signature: |
| 1878 | * @code |
| 1879 | * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods) |
| 1880 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1881 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1882 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1883 | * @param[in] key The [keyboard key](@ref keys) that was pressed or released. |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 1884 | * @param[in] scancode The platform-specific scancode of the key. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1885 | * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. Future |
| 1886 | * releases may add more actions. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1887 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1888 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1889 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1890 | * @sa @ref input_key |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1891 | * @sa @ref glfwSetKeyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1892 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1893 | * @since Added in version 1.0. |
| 1894 | * @glfw3 Added window handle, scancode and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1895 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1896 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1897 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1898 | typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1899 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1900 | /*! @brief The function pointer type for Unicode character callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1901 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1902 | * This is the function pointer type for Unicode character callbacks. |
| 1903 | * A Unicode character callback function has the following signature: |
| 1904 | * @code |
| 1905 | * void function_name(GLFWwindow* window, unsigned int codepoint) |
| 1906 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1907 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1908 | * @param[in] window The window that received the event. |
Camilla Berglund | 2c920fb | 2013-10-10 19:41:56 +0200 | [diff] [blame] | 1909 | * @param[in] codepoint The Unicode code point of the character. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1910 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1911 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1912 | * @sa @ref glfwSetCharCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1913 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1914 | * @since Added in version 2.4. |
| 1915 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1916 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1917 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1918 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1919 | typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1920 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1921 | /*! @brief The function pointer type for Unicode character with modifiers |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1922 | * callbacks. |
| 1923 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1924 | * This is the function pointer type for Unicode character with modifiers |
| 1925 | * callbacks. It is called for each input character, regardless of what |
| 1926 | * modifier keys are held down. A Unicode character with modifiers callback |
| 1927 | * function has the following signature: |
| 1928 | * @code |
| 1929 | * void function_name(GLFWwindow* window, unsigned int codepoint, int mods) |
| 1930 | * @endcode |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1931 | * |
| 1932 | * @param[in] window The window that received the event. |
| 1933 | * @param[in] codepoint The Unicode code point of the character. |
| 1934 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1935 | * held down. |
| 1936 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1937 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1938 | * @sa @ref glfwSetCharModsCallback |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1939 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 1940 | * @deprecated Scheduled for removal in version 4.0. |
| 1941 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1942 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1943 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1944 | * @ingroup input |
| 1945 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1946 | typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods); |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1947 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1948 | /*! @brief The function pointer type for path drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1949 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1950 | * This is the function pointer type for path drop callbacks. A path drop |
| 1951 | * callback function has the following signature: |
| 1952 | * @code |
| 1953 | * void function_name(GLFWwindow* window, int path_count, const char* paths[]) |
| 1954 | * @endcode |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1955 | * |
| 1956 | * @param[in] window The window that received the event. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1957 | * @param[in] path_count The number of dropped paths. |
Camilla Berglund | 93855ae | 2015-01-27 23:04:22 +0100 | [diff] [blame] | 1958 | * @param[in] paths The UTF-8 encoded file and/or directory path names. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1959 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1960 | * @pointer_lifetime The path array and its strings are valid until the |
| 1961 | * callback function returns. |
| 1962 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1963 | * @sa @ref path_drop |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1964 | * @sa @ref glfwSetDropCallback |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1965 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1966 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1967 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1968 | * @ingroup input |
| 1969 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1970 | typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]); |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1971 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1972 | /*! @brief The function pointer type for monitor configuration callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1973 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1974 | * This is the function pointer type for monitor configuration callbacks. |
| 1975 | * A monitor callback function has the following signature: |
| 1976 | * @code |
| 1977 | * void function_name(GLFWmonitor* monitor, int event) |
| 1978 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1979 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1980 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1981 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future |
| 1982 | * releases may add more events. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1983 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1984 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1985 | * @sa @ref glfwSetMonitorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1986 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1987 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1988 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1989 | * @ingroup monitor |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1990 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1991 | typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 1992 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1993 | /*! @brief The function pointer type for joystick configuration callbacks. |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1994 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1995 | * This is the function pointer type for joystick configuration callbacks. |
| 1996 | * A joystick configuration callback function has the following signature: |
| 1997 | * @code |
| 1998 | * void function_name(int jid, int event) |
| 1999 | * @endcode |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 2000 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 2001 | * @param[in] jid The joystick that was connected or disconnected. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2002 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future |
| 2003 | * releases may add more events. |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 2004 | * |
| 2005 | * @sa @ref joystick_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2006 | * @sa @ref glfwSetJoystickCallback |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 2007 | * |
| 2008 | * @since Added in version 3.2. |
| 2009 | * |
| 2010 | * @ingroup input |
| 2011 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 2012 | typedef void (* GLFWjoystickfun)(int jid, int event); |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 2013 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2014 | /*! @brief Video mode type. |
| 2015 | * |
| 2016 | * This describes a single video mode. |
| 2017 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 2018 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2019 | * @sa @ref glfwGetVideoMode |
| 2020 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 2021 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2022 | * @since Added in version 1.0. |
| 2023 | * @glfw3 Added refresh rate member. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 2024 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2025 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2026 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 2027 | typedef struct GLFWvidmode |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 2028 | { |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 2029 | /*! The width, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2030 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 2031 | int width; |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 2032 | /*! The height, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2033 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 2034 | int height; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2035 | /*! The bit depth of the red channel of the video mode. |
| 2036 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 2037 | int redBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2038 | /*! The bit depth of the green channel of the video mode. |
| 2039 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 2040 | int greenBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2041 | /*! The bit depth of the blue channel of the video mode. |
| 2042 | */ |
Camilla Berglund | 2e8446f | 2013-04-11 01:31:00 +0200 | [diff] [blame] | 2043 | int blueBits; |
Camilla Berglund | 731812c | 2013-05-30 15:52:42 +0200 | [diff] [blame] | 2044 | /*! The refresh rate, in Hz, of the video mode. |
| 2045 | */ |
| 2046 | int refreshRate; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2047 | } GLFWvidmode; |
| 2048 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2049 | /*! @brief Gamma ramp. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2050 | * |
| 2051 | * This describes the gamma ramp for a monitor. |
| 2052 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 2053 | * @sa @ref monitor_gamma |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2054 | * @sa @ref glfwGetGammaRamp |
| 2055 | * @sa @ref glfwSetGammaRamp |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2056 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2057 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 2058 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2059 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2060 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 2061 | typedef struct GLFWgammaramp |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 2062 | { |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2063 | /*! An array of value describing the response of the red channel. |
| 2064 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2065 | unsigned short* red; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2066 | /*! An array of value describing the response of the green channel. |
| 2067 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2068 | unsigned short* green; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2069 | /*! An array of value describing the response of the blue channel. |
| 2070 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2071 | unsigned short* blue; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2072 | /*! The number of elements in each array. |
| 2073 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2074 | unsigned int size; |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 2075 | } GLFWgammaramp; |
| 2076 | |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 2077 | /*! @brief Image data. |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 2078 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 2079 | * This describes a single 2D image. See the documentation for each related |
| 2080 | * function what the expected pixel format is. |
| 2081 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 2082 | * @sa @ref cursor_custom |
Camilla Berglund | fe0317a | 2016-08-01 11:51:30 +0200 | [diff] [blame] | 2083 | * @sa @ref window_icon |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 2084 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2085 | * @since Added in version 2.1. |
| 2086 | * @glfw3 Removed format and bytes-per-pixel members. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 2087 | * |
| 2088 | * @ingroup window |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 2089 | */ |
| 2090 | typedef struct GLFWimage |
| 2091 | { |
| 2092 | /*! The width, in pixels, of this image. |
| 2093 | */ |
| 2094 | int width; |
| 2095 | /*! The height, in pixels, of this image. |
| 2096 | */ |
| 2097 | int height; |
| 2098 | /*! The pixel data of this image, arranged left-to-right, top-to-bottom. |
| 2099 | */ |
| 2100 | unsigned char* pixels; |
| 2101 | } GLFWimage; |
| 2102 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 2103 | /*! @brief Gamepad input state |
| 2104 | * |
| 2105 | * This describes the input state of a gamepad. |
| 2106 | * |
| 2107 | * @sa @ref gamepad |
| 2108 | * @sa @ref glfwGetGamepadState |
| 2109 | * |
| 2110 | * @since Added in version 3.3. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 2111 | * |
| 2112 | * @ingroup input |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 2113 | */ |
| 2114 | typedef struct GLFWgamepadstate |
| 2115 | { |
| 2116 | /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS` |
| 2117 | * or `GLFW_RELEASE`. |
| 2118 | */ |
Camilla Löwy | 2d8d8f5 | 2017-07-17 21:18:15 +0200 | [diff] [blame] | 2119 | unsigned char buttons[15]; |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 2120 | /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0 |
| 2121 | * to 1.0 inclusive. |
| 2122 | */ |
| 2123 | float axes[6]; |
| 2124 | } GLFWgamepadstate; |
| 2125 | |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 2126 | /*! @brief Custom heap memory allocator. |
| 2127 | * |
| 2128 | * This describes a custom heap memory allocator for GLFW. To set an allocator, pass it |
| 2129 | * to @ref glfwInitAllocator before initializing the library. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2130 | * |
| 2131 | * @sa @ref init_allocator |
| 2132 | * @sa @ref glfwInitAllocator |
| 2133 | * |
| 2134 | * @since Added in version 3.4. |
| 2135 | * |
| 2136 | * @ingroup init |
| 2137 | */ |
| 2138 | typedef struct GLFWallocator |
| 2139 | { |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 2140 | /*! The memory allocation function. See @ref GLFWallocatefun for details about |
| 2141 | * allocation function. |
| 2142 | */ |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2143 | GLFWallocatefun allocate; |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 2144 | /*! The memory reallocation function. See @ref GLFWreallocatefun for details about |
| 2145 | * reallocation function. |
| 2146 | */ |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2147 | GLFWreallocatefun reallocate; |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 2148 | /*! The memory deallocation function. See @ref GLFWdeallocatefun for details about |
| 2149 | * deallocation function. |
| 2150 | */ |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2151 | GLFWdeallocatefun deallocate; |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 2152 | /*! The user pointer for this custom allocator. This value will be passed to the |
| 2153 | * allocator functions. |
| 2154 | */ |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2155 | void* user; |
| 2156 | } GLFWallocator; |
| 2157 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2158 | |
| 2159 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 2160 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2161 | *************************************************************************/ |
| 2162 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2163 | /*! @brief Initializes the GLFW library. |
| 2164 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2165 | * This function initializes the GLFW library. Before most GLFW functions can |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2166 | * be used, GLFW must be initialized, and before an application terminates GLFW |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2167 | * should be terminated in order to free any resources allocated during or |
| 2168 | * after initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2169 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 2170 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2171 | * succeeds, you should call @ref glfwTerminate before the application exits. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 2172 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2173 | * Additional calls to this function after successful initialization but before |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 2174 | * termination will return `GLFW_TRUE` immediately. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2175 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2176 | * The @ref GLFW_PLATFORM init hint controls which platforms are considered during |
| 2177 | * initialization. This also depends on which platforms the library was compiled to |
| 2178 | * support. |
| 2179 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 2180 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2181 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2182 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2183 | * @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref |
| 2184 | * GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2185 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2186 | * @remark @macos This function will change the current directory of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2187 | * application to the `Contents/Resources` subdirectory of the application's |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2188 | * bundle, if present. This can be disabled with the @ref |
| 2189 | * GLFW_COCOA_CHDIR_RESOURCES init hint. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2190 | * |
Camilla Löwy | 72366ac | 2020-03-05 20:32:19 +0100 | [diff] [blame] | 2191 | * @remark @macos This function will create the main menu and dock icon for the |
| 2192 | * application. If GLFW finds a `MainMenu.nib` it is loaded and assumed to |
| 2193 | * contain a menu bar. Otherwise a minimal menu bar is created manually with |
| 2194 | * common commands like Hide, Quit and About. The About entry opens a minimal |
| 2195 | * about dialog with information from the application's bundle. The menu bar |
| 2196 | * and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init |
| 2197 | * hint. |
| 2198 | * |
Camilla Löwy | 14e6533 | 2024-02-15 20:55:28 +0100 | [diff] [blame] | 2199 | * @remark __Wayland, X11:__ If the library was compiled with support for both |
| 2200 | * Wayland and X11, and the @ref GLFW_PLATFORM init hint is set to |
| 2201 | * `GLFW_ANY_PLATFORM`, the `XDG_SESSION_TYPE` environment variable affects |
| 2202 | * which platform is picked. If the environment variable is not set, or is set |
| 2203 | * to something other than `wayland` or `x11`, the regular detection mechanism |
| 2204 | * will be used instead. |
| 2205 | * |
Camilla Löwy | 0bb605c | 2024-02-19 15:06:59 +0100 | [diff] [blame] | 2206 | * @remark @x11 This function will set the `LC_CTYPE` category of the |
| 2207 | * application locale according to the current environment if that category is |
| 2208 | * still "C". This is because the "C" locale breaks Unicode text input. |
| 2209 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2210 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2211 | * |
| 2212 | * @sa @ref intro_init |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2213 | * @sa @ref glfwInitHint |
| 2214 | * @sa @ref glfwInitAllocator |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2215 | * @sa @ref glfwTerminate |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2216 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2217 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2218 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2219 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2220 | */ |
| 2221 | GLFWAPI int glfwInit(void); |
| 2222 | |
| 2223 | /*! @brief Terminates the GLFW library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2224 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2225 | * This function destroys all remaining windows and cursors, restores any |
| 2226 | * modified gamma ramps and frees any other allocated resources. Once this |
| 2227 | * function is called, you must again call @ref glfwInit successfully before |
| 2228 | * you will be able to use most GLFW functions. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 2229 | * |
| 2230 | * If GLFW has been successfully initialized, this function should be called |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2231 | * before the application exits. If initialization fails, there is no need to |
| 2232 | * call this function, as it is called by @ref glfwInit before it returns |
| 2233 | * failure. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 2234 | * |
A. Tombs | 7486e12 | 2020-05-22 14:37:58 +0100 | [diff] [blame] | 2235 | * This function has no effect if GLFW is not initialized. |
| 2236 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2237 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
| 2238 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2239 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2240 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 2241 | * @warning The contexts of any remaining windows must not be current on any |
| 2242 | * other thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2243 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2244 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 2245 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2246 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2247 | * |
| 2248 | * @sa @ref intro_init |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2249 | * @sa @ref glfwInit |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2250 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2251 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2252 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2253 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2254 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 2255 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2256 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2257 | /*! @brief Sets the specified init hint to the desired value. |
| 2258 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2259 | * This function sets hints for the next initialization of GLFW. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2260 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 2261 | * The values you set hints to are never reset by GLFW, but they only take |
| 2262 | * effect during initialization. Once GLFW has been initialized, any values |
| 2263 | * you set will be ignored until the library is terminated and initialized |
| 2264 | * again. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2265 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 2266 | * Some hints are platform specific. These may be set on any platform but they |
Camilla Löwy | 1be81a1 | 2017-10-22 16:27:17 +0200 | [diff] [blame] | 2267 | * will only affect their specific platform. Other platforms will ignore them. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 2268 | * Setting these hints requires no platform specific headers or functions. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2269 | * |
| 2270 | * @param[in] hint The [init hint](@ref init_hints) to set. |
| 2271 | * @param[in] value The new value of the init hint. |
| 2272 | * |
| 2273 | * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref |
| 2274 | * GLFW_INVALID_VALUE. |
| 2275 | * |
| 2276 | * @remarks This function may be called before @ref glfwInit. |
| 2277 | * |
| 2278 | * @thread_safety This function must only be called from the main thread. |
| 2279 | * |
| 2280 | * @sa init_hints |
| 2281 | * @sa glfwInit |
| 2282 | * |
| 2283 | * @since Added in version 3.3. |
| 2284 | * |
| 2285 | * @ingroup init |
| 2286 | */ |
| 2287 | GLFWAPI void glfwInitHint(int hint, int value); |
| 2288 | |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2289 | /*! @brief Sets the init allocator to the desired value. |
| 2290 | * |
| 2291 | * To use the default allocator, call this function with a `NULL` argument. |
| 2292 | * |
| 2293 | * If you specify an allocator struct, every member must be a valid function |
Camilla Löwy | 2afd57b | 2024-01-31 01:45:02 +0100 | [diff] [blame] | 2294 | * pointer. If any member is `NULL`, this function will emit @ref |
| 2295 | * GLFW_INVALID_VALUE and the init allocator will be unchanged. |
| 2296 | * |
| 2297 | * The functions in the allocator must fulfil a number of requirements. See the |
| 2298 | * documentation for @ref GLFWallocatefun, @ref GLFWreallocatefun and @ref |
| 2299 | * GLFWdeallocatefun for details. |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2300 | * |
| 2301 | * @param[in] allocator The allocator to use at the next initialization, or |
| 2302 | * `NULL` to use the default one. |
| 2303 | * |
| 2304 | * @errors Possible errors include @ref GLFW_INVALID_VALUE. |
| 2305 | * |
| 2306 | * @pointer_lifetime The specified allocator is copied before this function |
| 2307 | * returns. |
| 2308 | * |
| 2309 | * @thread_safety This function must only be called from the main thread. |
| 2310 | * |
| 2311 | * @sa @ref init_allocator |
| 2312 | * @sa @ref glfwInit |
| 2313 | * |
| 2314 | * @since Added in version 3.4. |
| 2315 | * |
| 2316 | * @ingroup init |
| 2317 | */ |
| 2318 | GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator); |
| 2319 | |
Camilla Löwy | 76a5f78 | 2021-10-21 20:45:44 +0200 | [diff] [blame] | 2320 | #if defined(VK_VERSION_1_0) |
| 2321 | |
| 2322 | /*! @brief Sets the desired Vulkan `vkGetInstanceProcAddr` function. |
| 2323 | * |
| 2324 | * This function sets the `vkGetInstanceProcAddr` function that GLFW will use for all |
| 2325 | * Vulkan related entry point queries. |
| 2326 | * |
| 2327 | * This feature is mostly useful on macOS, if your copy of the Vulkan loader is in |
| 2328 | * a location where GLFW cannot find it through dynamic loading, or if you are still |
| 2329 | * using the static library version of the loader. |
| 2330 | * |
| 2331 | * If set to `NULL`, GLFW will try to load the Vulkan loader dynamically by its standard |
| 2332 | * name and get this function from there. This is the default behavior. |
| 2333 | * |
| 2334 | * The standard name of the loader is `vulkan-1.dll` on Windows, `libvulkan.so.1` on |
| 2335 | * Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS. If your code is |
| 2336 | * also loading it via these names then you probably don't need to use this function. |
| 2337 | * |
| 2338 | * The function address you set is never reset by GLFW, but it only takes effect during |
| 2339 | * initialization. Once GLFW has been initialized, any updates will be ignored until the |
| 2340 | * library is terminated and initialized again. |
| 2341 | * |
| 2342 | * @param[in] loader The address of the function to use, or `NULL`. |
| 2343 | * |
| 2344 | * @par Loader function signature |
| 2345 | * @code |
| 2346 | * PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* name) |
| 2347 | * @endcode |
| 2348 | * For more information about this function, see the |
| 2349 | * [Vulkan Registry](https://www.khronos.org/registry/vulkan/). |
| 2350 | * |
| 2351 | * @errors None. |
| 2352 | * |
| 2353 | * @remark This function may be called before @ref glfwInit. |
| 2354 | * |
| 2355 | * @thread_safety This function must only be called from the main thread. |
| 2356 | * |
| 2357 | * @sa @ref vulkan_loader |
| 2358 | * @sa @ref glfwInit |
| 2359 | * |
| 2360 | * @since Added in version 3.4. |
| 2361 | * |
| 2362 | * @ingroup init |
| 2363 | */ |
| 2364 | GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader); |
| 2365 | |
| 2366 | #endif /*VK_VERSION_1_0*/ |
| 2367 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2368 | /*! @brief Retrieves the version of the GLFW library. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2369 | * |
| 2370 | * This function retrieves the major, minor and revision numbers of the GLFW |
| 2371 | * library. It is intended for when you are using GLFW as a shared library and |
| 2372 | * want to ensure that you are using the minimum required version. |
| 2373 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2374 | * Any or all of the version arguments may be `NULL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2375 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2376 | * @param[out] major Where to store the major version number, or `NULL`. |
| 2377 | * @param[out] minor Where to store the minor version number, or `NULL`. |
| 2378 | * @param[out] rev Where to store the revision number, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2379 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2380 | * @errors None. |
| 2381 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2382 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2383 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2384 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2385 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2386 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2387 | * @sa @ref glfwGetVersionString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2388 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2389 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2390 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2391 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2392 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 2393 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2394 | |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 2395 | /*! @brief Returns a string describing the compile-time configuration. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2396 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2397 | * This function returns the compile-time generated |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2398 | * [version string](@ref intro_version_string) of the GLFW library binary. It describes |
| 2399 | * the version, platforms, compiler and any platform or operating system specific |
| 2400 | * compile-time options. It should not be confused with the OpenGL or OpenGL ES version |
| 2401 | * string, queried with `glGetString`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2402 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2403 | * __Do not use the version string__ to parse the GLFW library version. The |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 2404 | * @ref glfwGetVersion function provides the version of the running library |
| 2405 | * binary in numerical format. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2406 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2407 | * __Do not use the version string__ to parse what platforms are supported. The @ref |
| 2408 | * glfwPlatformSupported function lets you query platform support. |
| 2409 | * |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 2410 | * @return The ASCII encoded GLFW version string. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2411 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2412 | * @errors None. |
| 2413 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2414 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2415 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2416 | * @pointer_lifetime The returned string is static and compile-time generated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2417 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2418 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2419 | * |
| 2420 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2421 | * @sa @ref glfwGetVersion |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2422 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2423 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2424 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2425 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2426 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 2427 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2428 | |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2429 | /*! @brief Returns and clears the last error for the calling thread. |
| 2430 | * |
Camilla Löwy | 2e9aff7 | 2017-07-09 14:46:39 +0200 | [diff] [blame] | 2431 | * This function returns and clears the [error code](@ref errors) of the last |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 2432 | * error that occurred on the calling thread, and optionally a UTF-8 encoded |
| 2433 | * human-readable description of it. If no error has occurred since the last |
Camilla Löwy | 539a728 | 2017-06-11 18:04:17 +0200 | [diff] [blame] | 2434 | * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is |
| 2435 | * set to `NULL`. |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2436 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 2437 | * @param[in] description Where to store the error description pointer, or `NULL`. |
Camilla Löwy | 539a728 | 2017-06-11 18:04:17 +0200 | [diff] [blame] | 2438 | * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR |
| 2439 | * (zero). |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2440 | * |
| 2441 | * @errors None. |
| 2442 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 2443 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 2444 | * should not free it yourself. It is guaranteed to be valid only until the |
| 2445 | * next error occurs or the library is terminated. |
| 2446 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2447 | * @remark This function may be called before @ref glfwInit. |
| 2448 | * |
| 2449 | * @thread_safety This function may be called from any thread. |
| 2450 | * |
| 2451 | * @sa @ref error_handling |
| 2452 | * @sa @ref glfwSetErrorCallback |
| 2453 | * |
| 2454 | * @since Added in version 3.3. |
| 2455 | * |
| 2456 | * @ingroup init |
| 2457 | */ |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 2458 | GLFWAPI int glfwGetError(const char** description); |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2459 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2460 | /*! @brief Sets the error callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2461 | * |
| 2462 | * This function sets the error callback, which is called with an error code |
| 2463 | * and a human-readable description each time a GLFW error occurs. |
| 2464 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2465 | * The error code is set before the callback is called. Calling @ref |
| 2466 | * glfwGetError from the error callback will return the same value as the error |
| 2467 | * code argument. |
| 2468 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2469 | * The error callback is called on the thread where the error occurred. If you |
| 2470 | * are using GLFW from multiple threads, your error callback needs to be |
| 2471 | * written accordingly. |
| 2472 | * |
| 2473 | * Because the description string may have been generated specifically for that |
| 2474 | * error, it is not guaranteed to be valid after the callback has returned. If |
| 2475 | * you wish to use it after the callback returns, you need to make a copy. |
| 2476 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 2477 | * Once set, the error callback remains set even after the library has been |
| 2478 | * terminated. |
| 2479 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2480 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2481 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2482 | * @return The previously set callback, or `NULL` if no callback was set. |
| 2483 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2484 | * @callback_signature |
| 2485 | * @code |
| 2486 | * void callback_name(int error_code, const char* description) |
| 2487 | * @endcode |
| 2488 | * For more information about the callback parameters, see the |
| 2489 | * [callback pointer type](@ref GLFWerrorfun). |
| 2490 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2491 | * @errors None. |
| 2492 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2493 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2494 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2495 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2496 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2497 | * @sa @ref error_handling |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2498 | * @sa @ref glfwGetError |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2499 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2500 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2501 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2502 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2503 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2504 | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 2505 | |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2506 | /*! @brief Returns the currently selected platform. |
| 2507 | * |
| 2508 | * This function returns the platform that was selected during initialization. The |
| 2509 | * returned value will be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, |
| 2510 | * `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`. |
| 2511 | * |
| 2512 | * @return The currently selected platform, or zero if an error occurred. |
| 2513 | * |
| 2514 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2515 | * |
| 2516 | * @thread_safety This function may be called from any thread. |
| 2517 | * |
| 2518 | * @sa @ref platform |
| 2519 | * @sa @ref glfwPlatformSupported |
| 2520 | * |
| 2521 | * @since Added in version 3.4. |
| 2522 | * |
| 2523 | * @ingroup init |
| 2524 | */ |
| 2525 | GLFWAPI int glfwGetPlatform(void); |
| 2526 | |
| 2527 | /*! @brief Returns whether the library includes support for the specified platform. |
| 2528 | * |
| 2529 | * This function returns whether the library was compiled with support for the specified |
| 2530 | * platform. The platform must be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, |
| 2531 | * `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`. |
| 2532 | * |
| 2533 | * @param[in] platform The platform to query. |
| 2534 | * @return `GLFW_TRUE` if the platform is supported, or `GLFW_FALSE` otherwise. |
| 2535 | * |
| 2536 | * @errors Possible errors include @ref GLFW_INVALID_ENUM. |
| 2537 | * |
| 2538 | * @remark This function may be called before @ref glfwInit. |
| 2539 | * |
| 2540 | * @thread_safety This function may be called from any thread. |
| 2541 | * |
| 2542 | * @sa @ref platform |
| 2543 | * @sa @ref glfwGetPlatform |
| 2544 | * |
| 2545 | * @since Added in version 3.4. |
| 2546 | * |
| 2547 | * @ingroup init |
| 2548 | */ |
| 2549 | GLFWAPI int glfwPlatformSupported(int platform); |
| 2550 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2551 | /*! @brief Returns the currently connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2552 | * |
| 2553 | * This function returns an array of handles for all currently connected |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2554 | * monitors. The primary monitor is always first in the returned array. If no |
| 2555 | * monitors were found, this function returns `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2556 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2557 | * @param[out] count Where to store the number of monitors in the returned |
| 2558 | * array. This is set to zero if an error occurred. |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2559 | * @return An array of monitor handles, or `NULL` if no monitors were found or |
| 2560 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2561 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2562 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2563 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2564 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2565 | * should not free it yourself. It is guaranteed to be valid only until the |
| 2566 | * monitor configuration changes or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2567 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2568 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2569 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2570 | * @sa @ref monitor_monitors |
| 2571 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2572 | * @sa @ref glfwGetPrimaryMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2573 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2574 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2575 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2576 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2577 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2578 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2579 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2580 | /*! @brief Returns the primary monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2581 | * |
| 2582 | * This function returns the primary monitor. This is usually the monitor |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2583 | * where elements like the task bar or global menu bar are located. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2584 | * |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2585 | * @return The primary monitor, or `NULL` if no monitors were found or if an |
| 2586 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2587 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2588 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2589 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2590 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2591 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2592 | * @remark The primary monitor is always first in the array returned by @ref |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2593 | * glfwGetMonitors. |
| 2594 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2595 | * @sa @ref monitor_monitors |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2596 | * @sa @ref glfwGetMonitors |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2597 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2598 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2599 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2600 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2601 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2602 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2603 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2604 | /*! @brief Returns the position of the monitor's viewport on the virtual screen. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2605 | * |
| 2606 | * This function returns the position, in screen coordinates, of the upper-left |
| 2607 | * corner of the specified monitor. |
| 2608 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2609 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 2610 | * non-`NULL` position arguments will be set to zero. |
| 2611 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2612 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2613 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 2614 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2615 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2616 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2617 | * GLFW_PLATFORM_ERROR. |
| 2618 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2619 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2620 | * |
| 2621 | * @sa @ref monitor_properties |
| 2622 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2623 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2624 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2625 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2626 | */ |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2627 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
| 2628 | |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 2629 | /*! @brief Retrieves the work area of the monitor. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2630 | * |
| 2631 | * This function returns the position, in screen coordinates, of the upper-left |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame] | 2632 | * corner of the work area of the specified monitor along with the work area |
| 2633 | * size in screen coordinates. The work area is defined as the area of the |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2634 | * monitor not occluded by the window system task bar where present. If no |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame] | 2635 | * task bar exists then the work area is the monitor resolution in screen |
| 2636 | * coordinates. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2637 | * |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame] | 2638 | * Any or all of the position and size arguments may be `NULL`. If an error |
| 2639 | * occurs, all non-`NULL` position and size arguments will be set to zero. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2640 | * |
| 2641 | * @param[in] monitor The monitor to query. |
| 2642 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 2643 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Doug Binks | 3fd70cc | 2018-09-08 17:16:07 +0200 | [diff] [blame] | 2644 | * @param[out] width Where to store the monitor width, or `NULL`. |
| 2645 | * @param[out] height Where to store the monitor height, or `NULL`. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2646 | * |
| 2647 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2648 | * GLFW_PLATFORM_ERROR. |
| 2649 | * |
| 2650 | * @thread_safety This function must only be called from the main thread. |
| 2651 | * |
Camilla Löwy | a43d1a4 | 2019-02-25 14:46:48 +0100 | [diff] [blame] | 2652 | * @sa @ref monitor_workarea |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2653 | * |
Doug Binks | 6907629 | 2018-09-08 17:24:20 +0200 | [diff] [blame] | 2654 | * @since Added in version 3.3. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2655 | * |
| 2656 | * @ingroup monitor |
| 2657 | */ |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame] | 2658 | GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2659 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2660 | /*! @brief Returns the physical size of the monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2661 | * |
| 2662 | * This function returns the size, in millimetres, of the display area of the |
| 2663 | * specified monitor. |
| 2664 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2665 | * Some platforms do not provide accurate monitor size information, either |
Camilla Löwy | 63397fb | 2024-02-14 01:36:35 +0100 | [diff] [blame] | 2666 | * because the monitor [EDID][] data is incorrect or because the driver does |
| 2667 | * not report it accurately. |
| 2668 | * |
| 2669 | * [EDID]: https://en.wikipedia.org/wiki/Extended_display_identification_data |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2670 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2671 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2672 | * non-`NULL` size arguments will be set to zero. |
| 2673 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2674 | * @param[in] monitor The monitor to query. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2675 | * @param[out] widthMM Where to store the width, in millimetres, of the |
| 2676 | * monitor's display area, or `NULL`. |
| 2677 | * @param[out] heightMM Where to store the height, in millimetres, of the |
| 2678 | * monitor's display area, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2679 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2680 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2681 | * |
Camilla Löwy | 6a20053 | 2021-10-12 00:23:37 +0200 | [diff] [blame] | 2682 | * @remark @win32 On Windows 8 and earlier the physical size is calculated from |
| 2683 | * the current resolution and system DPI instead of querying the monitor EDID data. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2684 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2685 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2686 | * |
| 2687 | * @sa @ref monitor_properties |
| 2688 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2689 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2690 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2691 | * @ingroup monitor |
| 2692 | */ |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2693 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2694 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2695 | /*! @brief Retrieves the content scale for the specified monitor. |
| 2696 | * |
| 2697 | * This function retrieves the content scale for the specified monitor. The |
| 2698 | * content scale is the ratio between the current DPI and the platform's |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 2699 | * default DPI. This is especially important for text and any UI elements. If |
| 2700 | * the pixel dimensions of your UI scaled by this look appropriate on your |
| 2701 | * machine then it should appear at a reasonable size on other machines |
| 2702 | * regardless of their DPI and scaling settings. This relies on the system DPI |
| 2703 | * and scaling settings being somewhat correct. |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2704 | * |
| 2705 | * The content scale may depend on both the monitor resolution and pixel |
| 2706 | * density and on user settings. It may be very different from the raw DPI |
| 2707 | * calculated from the physical size and current resolution. |
| 2708 | * |
| 2709 | * @param[in] monitor The monitor to query. |
| 2710 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 2711 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 2712 | * |
| 2713 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2714 | * GLFW_PLATFORM_ERROR. |
| 2715 | * |
Camilla Löwy | 2b3f919 | 2024-02-08 22:08:31 +0100 | [diff] [blame] | 2716 | * @remark @wayland Fractional scaling information is not yet available for |
| 2717 | * monitors, so this function only returns integer content scales. |
| 2718 | * |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2719 | * @thread_safety This function must only be called from the main thread. |
| 2720 | * |
| 2721 | * @sa @ref monitor_scale |
| 2722 | * @sa @ref glfwGetWindowContentScale |
| 2723 | * |
| 2724 | * @since Added in version 3.3. |
| 2725 | * |
| 2726 | * @ingroup monitor |
| 2727 | */ |
| 2728 | GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); |
| 2729 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2730 | /*! @brief Returns the name of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2731 | * |
| 2732 | * This function returns a human-readable name, encoded as UTF-8, of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2733 | * specified monitor. The name typically reflects the make and model of the |
| 2734 | * monitor and is not guaranteed to be unique among the connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2735 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2736 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2737 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an |
| 2738 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2739 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2740 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2741 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2742 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 2743 | * should not free it yourself. It is valid until the specified monitor is |
| 2744 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2745 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2746 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2747 | * |
| 2748 | * @sa @ref monitor_properties |
| 2749 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2750 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2751 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2752 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2753 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2754 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2755 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 2756 | /*! @brief Sets the user pointer of the specified monitor. |
| 2757 | * |
| 2758 | * This function sets the user-defined pointer of the specified monitor. The |
| 2759 | * current value is retained until the monitor is disconnected. The initial |
| 2760 | * value is `NULL`. |
| 2761 | * |
| 2762 | * This function may be called from the monitor callback, even for a monitor |
| 2763 | * that is being disconnected. |
| 2764 | * |
| 2765 | * @param[in] monitor The monitor whose pointer to set. |
| 2766 | * @param[in] pointer The new value. |
| 2767 | * |
| 2768 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2769 | * |
| 2770 | * @thread_safety This function may be called from any thread. Access is not |
| 2771 | * synchronized. |
| 2772 | * |
| 2773 | * @sa @ref monitor_userptr |
| 2774 | * @sa @ref glfwGetMonitorUserPointer |
| 2775 | * |
| 2776 | * @since Added in version 3.3. |
| 2777 | * |
| 2778 | * @ingroup monitor |
| 2779 | */ |
| 2780 | GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); |
| 2781 | |
| 2782 | /*! @brief Returns the user pointer of the specified monitor. |
| 2783 | * |
| 2784 | * This function returns the current value of the user-defined pointer of the |
| 2785 | * specified monitor. The initial value is `NULL`. |
| 2786 | * |
| 2787 | * This function may be called from the monitor callback, even for a monitor |
| 2788 | * that is being disconnected. |
| 2789 | * |
| 2790 | * @param[in] monitor The monitor whose pointer to return. |
| 2791 | * |
| 2792 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2793 | * |
| 2794 | * @thread_safety This function may be called from any thread. Access is not |
| 2795 | * synchronized. |
| 2796 | * |
| 2797 | * @sa @ref monitor_userptr |
| 2798 | * @sa @ref glfwSetMonitorUserPointer |
| 2799 | * |
| 2800 | * @since Added in version 3.3. |
| 2801 | * |
| 2802 | * @ingroup monitor |
| 2803 | */ |
| 2804 | GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); |
| 2805 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2806 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2807 | * |
| 2808 | * This function sets the monitor configuration callback, or removes the |
| 2809 | * currently set callback. This is called when a monitor is connected to or |
| 2810 | * disconnected from the system. |
| 2811 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2812 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2813 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2814 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2815 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2816 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2817 | * @callback_signature |
| 2818 | * @code |
| 2819 | * void function_name(GLFWmonitor* monitor, int event) |
| 2820 | * @endcode |
| 2821 | * For more information about the callback parameters, see the |
| 2822 | * [function pointer type](@ref GLFWmonitorfun). |
| 2823 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2824 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2825 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2826 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2827 | * |
| 2828 | * @sa @ref monitor_event |
| 2829 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2830 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2831 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2832 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2833 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2834 | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 2835 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2836 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2837 | * |
| 2838 | * This function returns an array of all video modes supported by the specified |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2839 | * monitor. The returned array is sorted in ascending order, first by color |
Camilla Löwy | 0e9ec77 | 2021-04-22 23:07:50 +0200 | [diff] [blame] | 2840 | * bit depth (the sum of all channel depths), then by resolution area (the |
| 2841 | * product of width and height), then resolution width and finally by refresh |
| 2842 | * rate. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2843 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2844 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2845 | * @param[out] count Where to store the number of video modes in the returned |
| 2846 | * array. This is set to zero if an error occurred. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2847 | * @return An array of video modes, or `NULL` if an |
| 2848 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2849 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2850 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2851 | * GLFW_PLATFORM_ERROR. |
| 2852 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2853 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2854 | * should not free it yourself. It is valid until the specified monitor is |
| 2855 | * disconnected, this function is called again for that monitor or the library |
| 2856 | * is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2857 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2858 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2859 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2860 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2861 | * @sa @ref glfwGetVideoMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2862 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2863 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2864 | * @glfw3 Changed to return an array of modes for a specific monitor. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2865 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2866 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2867 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2868 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2869 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2870 | /*! @brief Returns the current mode of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2871 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2872 | * This function returns the current video mode of the specified monitor. If |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2873 | * you have created a full screen window for that monitor, the return value |
| 2874 | * will depend on whether that window is iconified. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2875 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2876 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2877 | * @return The current mode of the monitor, or `NULL` if an |
| 2878 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2879 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2880 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2881 | * GLFW_PLATFORM_ERROR. |
| 2882 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2883 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2884 | * should not free it yourself. It is valid until the specified monitor is |
| 2885 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2886 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2887 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2888 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2889 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2890 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2891 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2892 | * @since Added in version 3.0. Replaces `glfwGetDesktopMode`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2893 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2894 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2895 | */ |
Camilla Berglund | ce1e84d | 2013-05-22 22:16:43 +0200 | [diff] [blame] | 2896 | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2897 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2898 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2899 | * |
Camilla Löwy | 3531c32 | 2018-12-17 17:40:18 +0100 | [diff] [blame] | 2900 | * This function generates an appropriately sized gamma ramp from the specified |
| 2901 | * exponent and then calls @ref glfwSetGammaRamp with it. The value must be |
| 2902 | * a finite number greater than zero. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2903 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2904 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2905 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2906 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2907 | * the default (usually sRGB-like) behavior. |
| 2908 | * |
| 2909 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2910 | * GLFW_SRGB_CAPABLE hint. |
| 2911 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2912 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 2913 | * @param[in] gamma The desired exponent. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2914 | * |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame] | 2915 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE, |
| 2916 | * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2917 | * |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 2918 | * @remark @wayland Gamma handling is a privileged protocol, this function |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame] | 2919 | * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2920 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2921 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2922 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2923 | * @sa @ref monitor_gamma |
| 2924 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2925 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2926 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2927 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2928 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2929 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2930 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2931 | /*! @brief Returns the current gamma ramp for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2932 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2933 | * This function returns the current gamma ramp of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2934 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2935 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2936 | * @return The current gamma ramp, or `NULL` if an |
| 2937 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2938 | * |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame] | 2939 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR |
| 2940 | * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2941 | * |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 2942 | * @remark @wayland Gamma handling is a privileged protocol, this function |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame] | 2943 | * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2944 | * returning `NULL`. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2945 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2946 | * @pointer_lifetime The returned structure and its arrays are allocated and |
| 2947 | * freed by GLFW. You should not free them yourself. They are valid until the |
| 2948 | * specified monitor is disconnected, this function is called again for that |
| 2949 | * monitor or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2950 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2951 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2952 | * |
| 2953 | * @sa @ref monitor_gamma |
| 2954 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2955 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2956 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2957 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2958 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2959 | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2960 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2961 | /*! @brief Sets the current gamma ramp for the specified monitor. |
| 2962 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2963 | * This function sets the current gamma ramp for the specified monitor. The |
| 2964 | * original gamma ramp for that monitor is saved by GLFW the first time this |
| 2965 | * function is called and is restored by @ref glfwTerminate. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2966 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2967 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2968 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2969 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2970 | * the default (usually sRGB-like) behavior. |
| 2971 | * |
| 2972 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2973 | * GLFW_SRGB_CAPABLE hint. |
| 2974 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2975 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2976 | * @param[in] ramp The gamma ramp to use. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 2977 | * |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame] | 2978 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR |
| 2979 | * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2980 | * |
Camilla Löwy | 3531c32 | 2018-12-17 17:40:18 +0100 | [diff] [blame] | 2981 | * @remark The size of the specified gamma ramp should match the size of the |
| 2982 | * current ramp for that monitor. |
Camilla Berglund | 76fff4d | 2015-03-10 19:02:28 +0100 | [diff] [blame] | 2983 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2984 | * @remark @win32 The gamma ramp size must be 256. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2985 | * |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 2986 | * @remark @wayland Gamma handling is a privileged protocol, this function |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame] | 2987 | * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2988 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2989 | * @pointer_lifetime The specified gamma ramp is copied before this function |
| 2990 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2991 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2992 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2993 | * |
| 2994 | * @sa @ref monitor_gamma |
| 2995 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2996 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2997 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2998 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2999 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 3000 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 3001 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3002 | /*! @brief Resets all window hints to their default values. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3003 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3004 | * This function resets all window hints to their |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3005 | * [default values](@ref window_hints_values). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3006 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3007 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3008 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3009 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3010 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3011 | * @sa @ref window_hints |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3012 | * @sa @ref glfwWindowHint |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 3013 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3014 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3015 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3016 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3017 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3018 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 3019 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3020 | |
| 3021 | /*! @brief Sets the specified window hint to the desired value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3022 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 3023 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 3024 | * hints, once set, retain their values until changed by a call to this |
| 3025 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 3026 | * |
| 3027 | * Only integer value hints can be set with this function. String value hints |
| 3028 | * are set with @ref glfwWindowHintString. |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 3029 | * |
Camilla Berglund | d6e0a43 | 2016-02-09 07:41:48 +0100 | [diff] [blame] | 3030 | * This function does not check whether the specified hint values are valid. |
| 3031 | * If you set hints to invalid values this will instead be reported by the next |
| 3032 | * call to @ref glfwCreateWindow. |
| 3033 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 3034 | * Some hints are platform specific. These may be set on any platform but they |
| 3035 | * will only affect their specific platform. Other platforms will ignore them. |
| 3036 | * Setting these hints requires no platform specific headers or functions. |
| 3037 | * |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 3038 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 3039 | * @param[in] value The new value of the window hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3040 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3041 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3042 | * GLFW_INVALID_ENUM. |
| 3043 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3044 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 3045 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3046 | * @sa @ref window_hints |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 3047 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3048 | * @sa @ref glfwDefaultWindowHints |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3049 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3050 | * @since Added in version 3.0. Replaces `glfwOpenWindowHint`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3051 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3052 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3053 | */ |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 3054 | GLFWAPI void glfwWindowHint(int hint, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3055 | |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 3056 | /*! @brief Sets the specified window hint to the desired value. |
| 3057 | * |
| 3058 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 3059 | * hints, once set, retain their values until changed by a call to this |
| 3060 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 3061 | * |
| 3062 | * Only string type hints can be set with this function. Integer value hints |
| 3063 | * are set with @ref glfwWindowHint. |
| 3064 | * |
| 3065 | * This function does not check whether the specified hint values are valid. |
| 3066 | * If you set hints to invalid values this will instead be reported by the next |
| 3067 | * call to @ref glfwCreateWindow. |
| 3068 | * |
| 3069 | * Some hints are platform specific. These may be set on any platform but they |
| 3070 | * will only affect their specific platform. Other platforms will ignore them. |
| 3071 | * Setting these hints requires no platform specific headers or functions. |
| 3072 | * |
| 3073 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 3074 | * @param[in] value The new value of the window hint. |
| 3075 | * |
| 3076 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3077 | * GLFW_INVALID_ENUM. |
| 3078 | * |
| 3079 | * @pointer_lifetime The specified string is copied before this function |
| 3080 | * returns. |
| 3081 | * |
| 3082 | * @thread_safety This function must only be called from the main thread. |
| 3083 | * |
| 3084 | * @sa @ref window_hints |
| 3085 | * @sa @ref glfwWindowHint |
| 3086 | * @sa @ref glfwDefaultWindowHints |
| 3087 | * |
| 3088 | * @since Added in version 3.3. |
| 3089 | * |
| 3090 | * @ingroup window |
| 3091 | */ |
| 3092 | GLFWAPI void glfwWindowHintString(int hint, const char* value); |
| 3093 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3094 | /*! @brief Creates a window and its associated context. |
| 3095 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3096 | * This function creates a window and its associated OpenGL or OpenGL ES |
| 3097 | * context. Most of the options controlling how the window and its context |
| 3098 | * should be created are specified with [window hints](@ref window_hints). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3099 | * |
| 3100 | * Successful creation does not change which context is current. Before you |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3101 | * can use the newly created context, you need to |
| 3102 | * [make it current](@ref context_current). For information about the `share` |
| 3103 | * parameter, see @ref context_sharing. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3104 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3105 | * The created window, framebuffer and context may differ from what you |
| 3106 | * requested, as not all parameters and hints are |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 3107 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3108 | * window, especially for full screen windows. To query the actual attributes |
Camilla Berglund | e8bceaa | 2015-04-07 14:37:42 +0200 | [diff] [blame] | 3109 | * of the created window, framebuffer and context, see @ref |
| 3110 | * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3111 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3112 | * To create a full screen window, you need to specify the monitor the window |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3113 | * will cover. If no monitor is specified, the window will be windowed mode. |
| 3114 | * Unless you have a way for the user to choose a specific monitor, it is |
| 3115 | * recommended that you pick the primary monitor. For more information on how |
| 3116 | * to query connected monitors, see @ref monitor_monitors. |
Camilla Berglund | 4b7ae49 | 2013-07-07 12:06:59 +0200 | [diff] [blame] | 3117 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3118 | * For full screen windows, the specified size becomes the resolution of the |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3119 | * window's _desired video mode_. As long as a full screen window is not |
| 3120 | * iconified, the supported video mode most closely matching the desired video |
| 3121 | * mode is set for the specified monitor. For more information about full |
| 3122 | * screen windows, including the creation of so called _windowed full screen_ |
| 3123 | * or _borderless full screen_ windows, see @ref window_windowed_full_screen. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3124 | * |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 3125 | * Once you have created the window, you can switch it between windowed and |
Camilla Berglund | e83be1d | 2016-11-08 12:19:06 +0100 | [diff] [blame] | 3126 | * full screen mode with @ref glfwSetWindowMonitor. This will not affect its |
| 3127 | * OpenGL or OpenGL ES context. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 3128 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3129 | * By default, newly created windows use the placement recommended by the |
Camilla Löwy | 0f9a957 | 2021-10-26 14:25:03 +0200 | [diff] [blame] | 3130 | * window system. To create the window at a specific position, set the @ref |
| 3131 | * GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints before creation. To |
| 3132 | * restore the default behavior, set either or both hints back to |
| 3133 | * `GLFW_ANY_POSITION`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3134 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3135 | * As long as at least one full screen window is not iconified, the screensaver |
| 3136 | * is prohibited from starting. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3137 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3138 | * Window systems put limits on window sizes. Very large or very small window |
| 3139 | * dimensions may be overridden by the window system on creation. Check the |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3140 | * actual [size](@ref window_size) after creation. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3141 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3142 | * The [swap interval](@ref buffer_swap) is not set during window creation and |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3143 | * the initial value may vary depending on driver settings and defaults. |
| 3144 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3145 | * @param[in] width The desired width, in screen coordinates, of the window. |
| 3146 | * This must be greater than zero. |
| 3147 | * @param[in] height The desired height, in screen coordinates, of the window. |
| 3148 | * This must be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3149 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3150 | * @param[in] monitor The monitor to use for full screen mode, or `NULL` for |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3151 | * windowed mode. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3152 | * @param[in] share The window whose context to share resources with, or `NULL` |
| 3153 | * to not share resources. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3154 | * @return The handle of the created window, or `NULL` if an |
| 3155 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3156 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3157 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3158 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref |
Camilla Löwy | 73948e6 | 2024-01-04 20:07:27 +0100 | [diff] [blame] | 3159 | * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref |
| 3160 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3161 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3162 | * @remark @win32 Window creation will fail if the Microsoft GDI software |
| 3163 | * OpenGL implementation is the only one available. |
Camilla Berglund | 07db5da | 2013-09-26 19:15:36 +0200 | [diff] [blame] | 3164 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 3165 | * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it |
| 3166 | * will be set as the initial icon for the window. If no such icon is present, |
Camilla Löwy | d73ab0b | 2017-11-16 10:08:38 +0100 | [diff] [blame] | 3167 | * the `IDI_APPLICATION` icon will be used instead. To set a different icon, |
| 3168 | * see @ref glfwSetWindowIcon. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3169 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3170 | * @remark @win32 The context to share resources with must not be current on |
| 3171 | * any other thread. |
Camilla Berglund | b19fb4c | 2014-12-27 21:14:41 +0100 | [diff] [blame] | 3172 | * |
Camilla Löwy | 82978bb | 2019-10-18 13:21:59 +0200 | [diff] [blame] | 3173 | * @remark @macos The OS only supports core profile contexts for OpenGL |
| 3174 | * versions 3.2 and later. Before creating an OpenGL context of version 3.2 or |
| 3175 | * later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) |
| 3176 | * hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all |
| 3177 | * on macOS. |
Camilla Löwy | fd127d5 | 2016-12-03 19:32:00 +0100 | [diff] [blame] | 3178 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 3179 | * @remark @macos The GLFW window has no icon, as it is not a document |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3180 | * window, but the dock icon will be the same as the application bundle's icon. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3181 | * For more information on bundles, see the |
Camilla Löwy | 63397fb | 2024-02-14 01:36:35 +0100 | [diff] [blame] | 3182 | * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library. |
| 3183 | * |
| 3184 | * [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3185 | * |
Camilla Löwy | 8b57403 | 2024-04-07 19:26:01 +0200 | [diff] [blame] | 3186 | * @remark @macos The window frame will not be rendered at full resolution on |
| 3187 | * Retina displays unless the |
Camilla Löwy | a9cc7c7 | 2024-02-07 20:04:14 +0100 | [diff] [blame] | 3188 | * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 3189 | * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the |
| 3190 | * application bundle's `Info.plist`. For more information, see |
Camilla Löwy | 63397fb | 2024-02-14 01:36:35 +0100 | [diff] [blame] | 3191 | * [High Resolution Guidelines for OS X][hidpi-guide] in the Mac Developer |
| 3192 | * Library. The GLFW test and example programs use a custom `Info.plist` |
| 3193 | * template for this, which can be found as `CMake/Info.plist.in` in the source |
| 3194 | * tree. |
| 3195 | * |
| 3196 | * [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 3197 | * |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 3198 | * @remark @macos When activating frame autosaving with |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 3199 | * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 3200 | * window size and position may be overridden by previously saved values. |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 3201 | * |
Camilla Löwy | bafece4 | 2024-02-16 16:04:49 +0100 | [diff] [blame] | 3202 | * @remark @wayland GLFW uses [libdecor][] where available to create its window |
| 3203 | * decorations. This in turn uses server-side XDG decorations where available |
| 3204 | * and provides high quality client-side decorations on compositors like GNOME. |
| 3205 | * If both XDG decorations and libdecor are unavailable, GLFW falls back to |
| 3206 | * a very simple set of window decorations that only support moving, resizing |
| 3207 | * and the window manager's right-click menu. |
| 3208 | * |
| 3209 | * [libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor |
| 3210 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3211 | * @remark @x11 Some window managers will not respect the placement of |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3212 | * initially hidden windows. |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 3213 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3214 | * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for |
| 3215 | * a window to reach its requested state. This means you may not be able to |
| 3216 | * query the final size, position or other attributes directly after window |
| 3217 | * creation. |
Camilla Berglund | 20ed0a1 | 2015-08-12 21:31:54 +0200 | [diff] [blame] | 3218 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 3219 | * @remark @x11 The class part of the `WM_CLASS` window property will by |
| 3220 | * default be set to the window title passed to this function. The instance |
| 3221 | * part will use the contents of the `RESOURCE_NAME` environment variable, if |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 3222 | * present and not empty, or fall back to the window title. Set the |
| 3223 | * [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and |
| 3224 | * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to |
| 3225 | * override this. |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 3226 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3227 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3228 | * |
| 3229 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3230 | * @sa @ref glfwDestroyWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3231 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3232 | * @since Added in version 3.0. Replaces `glfwOpenWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3233 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3234 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3235 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3236 | GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3237 | |
| 3238 | /*! @brief Destroys the specified window and its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3239 | * |
| 3240 | * This function destroys the specified window and its context. On calling |
| 3241 | * this function, no further callbacks will be called for that window. |
| 3242 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3243 | * If the context of the specified window is current on the main thread, it is |
| 3244 | * detached before being destroyed. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3245 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3246 | * @param[in] window The window to destroy. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3247 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3248 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3249 | * GLFW_PLATFORM_ERROR. |
| 3250 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3251 | * @note The context of the specified window must not be current on any other |
| 3252 | * thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3253 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3254 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 3255 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3256 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3257 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3258 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3259 | * @sa @ref glfwCreateWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3260 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3261 | * @since Added in version 3.0. Replaces `glfwCloseWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3262 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3263 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3264 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3265 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3266 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 3267 | /*! @brief Checks the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3268 | * |
| 3269 | * This function returns the value of the close flag of the specified window. |
| 3270 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3271 | * @param[in] window The window to query. |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 3272 | * @return The value of the close flag. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3273 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3274 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3275 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3276 | * @thread_safety This function may be called from any thread. Access is not |
| 3277 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3278 | * |
| 3279 | * @sa @ref window_close |
| 3280 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3281 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 3282 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3283 | * @ingroup window |
| 3284 | */ |
| 3285 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
| 3286 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 3287 | /*! @brief Sets the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3288 | * |
| 3289 | * This function sets the value of the close flag of the specified window. |
| 3290 | * This can be used to override the user's attempt to close the window, or |
| 3291 | * to signal that it should be closed. |
| 3292 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 3293 | * @param[in] window The window whose flag to change. |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3294 | * @param[in] value The new value. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3295 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3296 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3297 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3298 | * @thread_safety This function may be called from any thread. Access is not |
| 3299 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3300 | * |
| 3301 | * @sa @ref window_close |
| 3302 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3303 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 3304 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3305 | * @ingroup window |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3306 | */ |
| 3307 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
| 3308 | |
Camilla Löwy | c8372cd | 2024-02-16 13:45:22 +0100 | [diff] [blame] | 3309 | /*! @brief Returns the title of the specified window. |
Doug Binks | 95d464b | 2024-02-07 19:26:52 +0000 | [diff] [blame] | 3310 | * |
Camilla Löwy | c8372cd | 2024-02-16 13:45:22 +0100 | [diff] [blame] | 3311 | * This function returns the window title, encoded as UTF-8, of the specified |
| 3312 | * window. This is the title set previously by @ref glfwCreateWindow |
| 3313 | * or @ref glfwSetWindowTitle. |
Doug Binks | 95d464b | 2024-02-07 19:26:52 +0000 | [diff] [blame] | 3314 | * |
| 3315 | * @param[in] window The window to query. |
Camilla Löwy | c8372cd | 2024-02-16 13:45:22 +0100 | [diff] [blame] | 3316 | * @return The UTF-8 encoded window title, or `NULL` if an |
| 3317 | * [error](@ref error_handling) occurred. |
Doug Binks | 95d464b | 2024-02-07 19:26:52 +0000 | [diff] [blame] | 3318 | * |
Camilla Löwy | c8372cd | 2024-02-16 13:45:22 +0100 | [diff] [blame] | 3319 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3320 | * |
| 3321 | * @remark The returned title is currently a copy of the title last set by @ref |
| 3322 | * glfwCreateWindow or @ref glfwSetWindowTitle. It does not include any |
| 3323 | * additional text which may be appended by the platform or another program. |
Doug Binks | 95d464b | 2024-02-07 19:26:52 +0000 | [diff] [blame] | 3324 | * |
| 3325 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 3326 | * should not free it yourself. It is valid until the next call to @ref |
Camilla Löwy | c8372cd | 2024-02-16 13:45:22 +0100 | [diff] [blame] | 3327 | * glfwGetWindowTitle or @ref glfwSetWindowTitle, or until the library is |
| 3328 | * terminated. |
Doug Binks | 95d464b | 2024-02-07 19:26:52 +0000 | [diff] [blame] | 3329 | * |
| 3330 | * @thread_safety This function must only be called from the main thread. |
| 3331 | * |
| 3332 | * @sa @ref window_title |
| 3333 | * @sa @ref glfwSetWindowTitle |
| 3334 | * |
Camilla Löwy | c8372cd | 2024-02-16 13:45:22 +0100 | [diff] [blame] | 3335 | * @since Added in version 3.4. |
| 3336 | * |
Doug Binks | 95d464b | 2024-02-07 19:26:52 +0000 | [diff] [blame] | 3337 | * @ingroup window |
| 3338 | */ |
| 3339 | GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window); |
| 3340 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3341 | /*! @brief Sets the title of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3342 | * |
| 3343 | * This function sets the window title, encoded as UTF-8, of the specified |
| 3344 | * window. |
| 3345 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3346 | * @param[in] window The window whose title to change. |
| 3347 | * @param[in] title The UTF-8 encoded window title. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3348 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3349 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3350 | * GLFW_PLATFORM_ERROR. |
| 3351 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 3352 | * @remark @macos The window title will not be updated until the next time you |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3353 | * process events. |
Camilla Berglund | 6412dcb | 2015-04-07 21:52:29 +0200 | [diff] [blame] | 3354 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3355 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3356 | * |
| 3357 | * @sa @ref window_title |
Camilla Löwy | c8372cd | 2024-02-16 13:45:22 +0100 | [diff] [blame] | 3358 | * @sa @ref glfwGetWindowTitle |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3359 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3360 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3361 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3362 | * |
| 3363 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3364 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3365 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3366 | |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3367 | /*! @brief Sets the icon for the specified window. |
| 3368 | * |
| 3369 | * This function sets the icon of the specified window. If passed an array of |
| 3370 | * candidate images, those of or closest to the sizes desired by the system are |
| 3371 | * selected. If no images are specified, the window reverts to its default |
| 3372 | * icon. |
| 3373 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 3374 | * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight |
| 3375 | * bits per channel with the red channel first. They are arranged canonically |
| 3376 | * as packed sequential rows, starting from the top-left corner. |
| 3377 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3378 | * The desired image sizes varies depending on platform and system settings. |
| 3379 | * The selected images will be rescaled as needed. Good sizes include 16x16, |
| 3380 | * 32x32 and 48x48. |
| 3381 | * |
| 3382 | * @param[in] window The window whose icon to set. |
| 3383 | * @param[in] count The number of images in the specified array, or zero to |
| 3384 | * revert to the default window icon. |
| 3385 | * @param[in] images The images to create the icon from. This is ignored if |
| 3386 | * count is zero. |
| 3387 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3388 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 66a4882 | 2022-03-15 21:22:49 +0100 | [diff] [blame] | 3389 | * GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref |
| 3390 | * GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3391 | * |
| 3392 | * @pointer_lifetime The specified image data is copied before this function |
| 3393 | * returns. |
| 3394 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3395 | * @remark @macos Regular windows do not have icons on macOS. This function |
| 3396 | * will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 3397 | * the application bundle's icon. For more information on bundles, see the |
Camilla Löwy | 63397fb | 2024-02-14 01:36:35 +0100 | [diff] [blame] | 3398 | * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library. |
| 3399 | * |
| 3400 | * [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/ |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3401 | * |
Emmanuel Gil Peyrot | a162004 | 2017-12-03 04:19:15 +0100 | [diff] [blame] | 3402 | * @remark @wayland There is no existing protocol to change an icon, the |
| 3403 | * window will thus inherit the one defined in the application's desktop file. |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3404 | * This function will emit @ref GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3405 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3406 | * @thread_safety This function must only be called from the main thread. |
| 3407 | * |
| 3408 | * @sa @ref window_icon |
| 3409 | * |
| 3410 | * @since Added in version 3.2. |
| 3411 | * |
| 3412 | * @ingroup window |
| 3413 | */ |
| 3414 | GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images); |
| 3415 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3416 | /*! @brief Retrieves the position of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3417 | * |
| 3418 | * This function retrieves the position, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3419 | * upper-left corner of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3420 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3421 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 3422 | * non-`NULL` position arguments will be set to zero. |
| 3423 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3424 | * @param[in] window The window to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3425 | * @param[out] xpos Where to store the x-coordinate of the upper-left corner of |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3426 | * the content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3427 | * @param[out] ypos Where to store the y-coordinate of the upper-left corner of |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3428 | * the content area, or `NULL`. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3429 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3430 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3431 | * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3432 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3433 | * @remark @wayland There is no way for an application to retrieve the global |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3434 | * position of its windows. This function will emit @ref |
| 3435 | * GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3436 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3437 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3438 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3439 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3440 | * @sa @ref glfwSetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3441 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3442 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3443 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3444 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3445 | */ |
| 3446 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
| 3447 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3448 | /*! @brief Sets the position of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3449 | * |
| 3450 | * This function sets the position, in screen coordinates, of the upper-left |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3451 | * corner of the content area of the specified windowed mode window. If the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3452 | * window is a full screen window, this function does nothing. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3453 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3454 | * __Do not use this function__ to move an already visible window unless you |
| 3455 | * have very good reasons for doing so, as it will confuse and annoy the user. |
| 3456 | * |
| 3457 | * The window manager may put limits on what positions are allowed. GLFW |
| 3458 | * cannot and should not override these limits. |
| 3459 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3460 | * @param[in] window The window to query. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3461 | * @param[in] xpos The x-coordinate of the upper-left corner of the content area. |
| 3462 | * @param[in] ypos The y-coordinate of the upper-left corner of the content area. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3463 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3464 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3465 | * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3466 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3467 | * @remark @wayland There is no way for an application to set the global |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3468 | * position of its windows. This function will emit @ref |
| 3469 | * GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3470 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3471 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3472 | * |
| 3473 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3474 | * @sa @ref glfwGetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3475 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3476 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3477 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3478 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3479 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3480 | */ |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 3481 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3482 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3483 | /*! @brief Retrieves the size of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3484 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3485 | * This function retrieves the size, in screen coordinates, of the content area |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 3486 | * of the specified window. If you wish to retrieve the size of the |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3487 | * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3488 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3489 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 3490 | * non-`NULL` size arguments will be set to zero. |
| 3491 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3492 | * @param[in] window The window whose size to retrieve. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3493 | * @param[out] width Where to store the width, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3494 | * content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3495 | * @param[out] height Where to store the height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3496 | * content area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3497 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3498 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3499 | * GLFW_PLATFORM_ERROR. |
| 3500 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3501 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3502 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3503 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3504 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3505 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3506 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3507 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3508 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3509 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3510 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3511 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3512 | |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3513 | /*! @brief Sets the size limits of the specified window. |
| 3514 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3515 | * This function sets the size limits of the content area of the specified |
Emmanuel Gil Peyrot | f0f5d9f | 2016-04-09 00:42:58 +0100 | [diff] [blame] | 3516 | * window. If the window is full screen, the size limits only take effect |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3517 | * once it is made windowed. If the window is not resizable, this function |
| 3518 | * does nothing. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3519 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3520 | * The size limits are applied immediately to a windowed mode window and may |
| 3521 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3522 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 3523 | * The maximum dimensions must be greater than or equal to the minimum |
| 3524 | * dimensions and all must be greater than or equal to zero. |
| 3525 | * |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3526 | * @param[in] window The window to set limits for. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3527 | * @param[in] minwidth The minimum width, in screen coordinates, of the content |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3528 | * area, or `GLFW_DONT_CARE`. |
| 3529 | * @param[in] minheight The minimum height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3530 | * content area, or `GLFW_DONT_CARE`. |
| 3531 | * @param[in] maxwidth The maximum width, in screen coordinates, of the content |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3532 | * area, or `GLFW_DONT_CARE`. |
| 3533 | * @param[in] maxheight The maximum height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3534 | * content area, or `GLFW_DONT_CARE`. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3535 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 3536 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3537 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3538 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3539 | * @remark If you set size limits and an aspect ratio that conflict, the |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3540 | * results are undefined. |
| 3541 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3542 | * @remark @wayland The size limits will not be applied until the window is |
| 3543 | * actually resized, either by the user or by the compositor. |
| 3544 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3545 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3546 | * |
| 3547 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3548 | * @sa @ref glfwSetWindowAspectRatio |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3549 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3550 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3551 | * |
| 3552 | * @ingroup window |
| 3553 | */ |
| 3554 | GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); |
| 3555 | |
| 3556 | /*! @brief Sets the aspect ratio of the specified window. |
| 3557 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3558 | * This function sets the required aspect ratio of the content area of the |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3559 | * specified window. If the window is full screen, the aspect ratio only takes |
| 3560 | * effect once it is made windowed. If the window is not resizable, this |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3561 | * function does nothing. |
| 3562 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 3563 | * The aspect ratio is specified as a numerator and a denominator and both |
| 3564 | * values must be greater than zero. For example, the common 16:9 aspect ratio |
| 3565 | * is specified as 16 and 9, respectively. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3566 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 3567 | * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect |
| 3568 | * ratio limit is disabled. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3569 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3570 | * The aspect ratio is applied immediately to a windowed mode window and may |
| 3571 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3572 | * |
| 3573 | * @param[in] window The window to set limits for. |
| 3574 | * @param[in] numer The numerator of the desired aspect ratio, or |
| 3575 | * `GLFW_DONT_CARE`. |
| 3576 | * @param[in] denom The denominator of the desired aspect ratio, or |
| 3577 | * `GLFW_DONT_CARE`. |
| 3578 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3579 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3580 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 3581 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3582 | * @remark If you set size limits and an aspect ratio that conflict, the |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3583 | * results are undefined. |
| 3584 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3585 | * @remark @wayland The aspect ratio will not be applied until the window is |
| 3586 | * actually resized, either by the user or by the compositor. |
| 3587 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3588 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3589 | * |
| 3590 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3591 | * @sa @ref glfwSetWindowSizeLimits |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3592 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3593 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3594 | * |
| 3595 | * @ingroup window |
| 3596 | */ |
| 3597 | GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); |
| 3598 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3599 | /*! @brief Sets the size of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3600 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3601 | * This function sets the size, in screen coordinates, of the content area of |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3602 | * the specified window. |
| 3603 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3604 | * For full screen windows, this function updates the resolution of its desired |
| 3605 | * video mode and switches to the video mode closest to it, without affecting |
| 3606 | * the window's context. As the context is unaffected, the bit depths of the |
| 3607 | * framebuffer remain unchanged. |
| 3608 | * |
| 3609 | * If you wish to update the refresh rate of the desired video mode in addition |
| 3610 | * to its resolution, see @ref glfwSetWindowMonitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3611 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3612 | * The window manager may put limits on what sizes are allowed. GLFW cannot |
| 3613 | * and should not override these limits. |
| 3614 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3615 | * @param[in] window The window to resize. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3616 | * @param[in] width The desired width, in screen coordinates, of the window |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3617 | * content area. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3618 | * @param[in] height The desired height, in screen coordinates, of the window |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3619 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3620 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3621 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3622 | * GLFW_PLATFORM_ERROR. |
| 3623 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3624 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3625 | * |
| 3626 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3627 | * @sa @ref glfwGetWindowSize |
| 3628 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3629 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3630 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3631 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3632 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3633 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3634 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3635 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3636 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3637 | /*! @brief Retrieves the size of the framebuffer of the specified window. |
| 3638 | * |
| 3639 | * This function retrieves the size, in pixels, of the framebuffer of the |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 3640 | * specified window. If you wish to retrieve the size of the window in screen |
| 3641 | * coordinates, see @ref glfwGetWindowSize. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3642 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3643 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 3644 | * non-`NULL` size arguments will be set to zero. |
| 3645 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3646 | * @param[in] window The window whose framebuffer to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3647 | * @param[out] width Where to store the width, in pixels, of the framebuffer, |
| 3648 | * or `NULL`. |
| 3649 | * @param[out] height Where to store the height, in pixels, of the framebuffer, |
| 3650 | * or `NULL`. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3651 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3652 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3653 | * GLFW_PLATFORM_ERROR. |
| 3654 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3655 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3656 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3657 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3658 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3659 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3660 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3661 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3662 | * @ingroup window |
| 3663 | */ |
| 3664 | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); |
| 3665 | |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3666 | /*! @brief Retrieves the size of the frame of the window. |
| 3667 | * |
| 3668 | * This function retrieves the size, in screen coordinates, of each edge of the |
| 3669 | * frame of the specified window. This size includes the title bar, if the |
| 3670 | * window has one. The size of the frame may vary depending on the |
| 3671 | * [window-related hints](@ref window_hints_wnd) used to create it. |
| 3672 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3673 | * Because this function retrieves the size of each window frame edge and not |
| 3674 | * the offset along a particular coordinate axis, the retrieved values will |
| 3675 | * always be zero or positive. |
| 3676 | * |
| 3677 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 3678 | * non-`NULL` size arguments will be set to zero. |
| 3679 | * |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3680 | * @param[in] window The window whose frame size to query. |
| 3681 | * @param[out] left Where to store the size, in screen coordinates, of the left |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3682 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 3683 | * @param[out] top Where to store the size, in screen coordinates, of the top |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3684 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 3685 | * @param[out] right Where to store the size, in screen coordinates, of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3686 | * right edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 3687 | * @param[out] bottom Where to store the size, in screen coordinates, of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3688 | * bottom edge of the window frame, or `NULL`. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3689 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3690 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3691 | * GLFW_PLATFORM_ERROR. |
| 3692 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3693 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3694 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3695 | * @sa @ref window_size |
| 3696 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3697 | * @since Added in version 3.1. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3698 | * |
| 3699 | * @ingroup window |
| 3700 | */ |
| 3701 | GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); |
| 3702 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 3703 | /*! @brief Retrieves the content scale for the specified window. |
| 3704 | * |
| 3705 | * This function retrieves the content scale for the specified window. The |
| 3706 | * content scale is the ratio between the current DPI and the platform's |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 3707 | * default DPI. This is especially important for text and any UI elements. If |
| 3708 | * the pixel dimensions of your UI scaled by this look appropriate on your |
| 3709 | * machine then it should appear at a reasonable size on other machines |
| 3710 | * regardless of their DPI and scaling settings. This relies on the system DPI |
| 3711 | * and scaling settings being somewhat correct. |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 3712 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 3713 | * On platforms where each monitors can have its own content scale, the window |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 3714 | * content scale will depend on which monitor the system considers the window |
| 3715 | * to be on. |
| 3716 | * |
| 3717 | * @param[in] window The window to query. |
| 3718 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 3719 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 3720 | * |
| 3721 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3722 | * GLFW_PLATFORM_ERROR. |
| 3723 | * |
| 3724 | * @thread_safety This function must only be called from the main thread. |
| 3725 | * |
| 3726 | * @sa @ref window_scale |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 3727 | * @sa @ref glfwSetWindowContentScaleCallback |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 3728 | * @sa @ref glfwGetMonitorContentScale |
| 3729 | * |
| 3730 | * @since Added in version 3.3. |
| 3731 | * |
| 3732 | * @ingroup window |
| 3733 | */ |
| 3734 | GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); |
| 3735 | |
Camilla Löwy | 11e47f0 | 2017-09-25 23:14:45 +0200 | [diff] [blame] | 3736 | /*! @brief Returns the opacity of the whole window. |
| 3737 | * |
| 3738 | * This function returns the opacity of the window, including any decorations. |
| 3739 | * |
| 3740 | * The opacity (or alpha) value is a positive finite number between zero and |
| 3741 | * one, where zero is fully transparent and one is fully opaque. If the system |
| 3742 | * does not support whole window transparency, this function always returns one. |
| 3743 | * |
| 3744 | * The initial opacity value for newly created windows is one. |
| 3745 | * |
| 3746 | * @param[in] window The window to query. |
| 3747 | * @return The opacity value of the specified window. |
| 3748 | * |
| 3749 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3750 | * GLFW_PLATFORM_ERROR. |
| 3751 | * |
| 3752 | * @thread_safety This function must only be called from the main thread. |
| 3753 | * |
| 3754 | * @sa @ref window_transparency |
| 3755 | * @sa @ref glfwSetWindowOpacity |
| 3756 | * |
| 3757 | * @since Added in version 3.3. |
| 3758 | * |
| 3759 | * @ingroup window |
| 3760 | */ |
| 3761 | GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window); |
| 3762 | |
| 3763 | /*! @brief Sets the opacity of the whole window. |
| 3764 | * |
| 3765 | * This function sets the opacity of the window, including any decorations. |
| 3766 | * |
| 3767 | * The opacity (or alpha) value is a positive finite number between zero and |
| 3768 | * one, where zero is fully transparent and one is fully opaque. |
| 3769 | * |
| 3770 | * The initial opacity value for newly created windows is one. |
| 3771 | * |
| 3772 | * A window created with framebuffer transparency may not use whole window |
| 3773 | * transparency. The results of doing this are undefined. |
| 3774 | * |
| 3775 | * @param[in] window The window to set the opacity for. |
| 3776 | * @param[in] opacity The desired opacity of the specified window. |
| 3777 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3778 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3779 | * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
| 3780 | * |
| 3781 | * @remark @wayland There is no way to set an opacity factor for a window. |
| 3782 | * This function will emit @ref GLFW_FEATURE_UNAVAILABLE. |
Camilla Löwy | 11e47f0 | 2017-09-25 23:14:45 +0200 | [diff] [blame] | 3783 | * |
| 3784 | * @thread_safety This function must only be called from the main thread. |
| 3785 | * |
| 3786 | * @sa @ref window_transparency |
| 3787 | * @sa @ref glfwGetWindowOpacity |
| 3788 | * |
| 3789 | * @since Added in version 3.3. |
| 3790 | * |
| 3791 | * @ingroup window |
| 3792 | */ |
| 3793 | GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); |
| 3794 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3795 | /*! @brief Iconifies the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3796 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3797 | * This function iconifies (minimizes) the specified window if it was |
| 3798 | * previously restored. If the window is already iconified, this function does |
| 3799 | * nothing. |
| 3800 | * |
Camilla Löwy | 2796e61 | 2022-06-24 19:29:29 +0200 | [diff] [blame] | 3801 | * If the specified window is a full screen window, GLFW restores the original |
| 3802 | * video mode of the monitor. The window's desired video mode is set again |
| 3803 | * when the window is restored. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3804 | * |
| 3805 | * @param[in] window The window to iconify. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3806 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3807 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3808 | * GLFW_PLATFORM_ERROR. |
| 3809 | * |
Emmanuel Gil Peyrot | 599fb3d | 2019-03-01 18:46:06 +0100 | [diff] [blame] | 3810 | * @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t |
| 3811 | * be able to restore it. This is a design decision of the xdg-shell |
Emmanuel Gil Peyrot | a162004 | 2017-12-03 04:19:15 +0100 | [diff] [blame] | 3812 | * protocol. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3813 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3814 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3815 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3816 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3817 | * @sa @ref glfwRestoreWindow |
| 3818 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3819 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3820 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3821 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3822 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3823 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3824 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3825 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3826 | |
| 3827 | /*! @brief Restores the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3828 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3829 | * This function restores the specified window if it was previously iconified |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3830 | * (minimized) or maximized. If the window is already restored, this function |
| 3831 | * does nothing. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3832 | * |
Camilla Löwy | 2796e61 | 2022-06-24 19:29:29 +0200 | [diff] [blame] | 3833 | * If the specified window is an iconified full screen window, its desired |
| 3834 | * video mode is set again for its monitor when the window is restored. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3835 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3836 | * @param[in] window The window to restore. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3837 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3838 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3839 | * GLFW_PLATFORM_ERROR. |
| 3840 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3841 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3842 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3843 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3844 | * @sa @ref glfwIconifyWindow |
| 3845 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3846 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3847 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3848 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3849 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3850 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3851 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3852 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3853 | |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3854 | /*! @brief Maximizes the specified window. |
| 3855 | * |
| 3856 | * This function maximizes the specified window if it was previously not |
| 3857 | * maximized. If the window is already maximized, this function does nothing. |
| 3858 | * |
| 3859 | * If the specified window is a full screen window, this function does nothing. |
| 3860 | * |
| 3861 | * @param[in] window The window to maximize. |
| 3862 | * |
Camilla Berglund | f5b71f5 | 2016-05-27 14:20:39 +0200 | [diff] [blame] | 3863 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3864 | * GLFW_PLATFORM_ERROR. |
| 3865 | * |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3866 | * @par Thread Safety |
| 3867 | * This function may only be called from the main thread. |
| 3868 | * |
| 3869 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3870 | * @sa @ref glfwIconifyWindow |
| 3871 | * @sa @ref glfwRestoreWindow |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3872 | * |
| 3873 | * @since Added in GLFW 3.2. |
| 3874 | * |
| 3875 | * @ingroup window |
| 3876 | */ |
| 3877 | GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); |
| 3878 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3879 | /*! @brief Makes the specified window visible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3880 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3881 | * This function makes the specified window visible if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3882 | * hidden. If the window is already visible or is in full screen mode, this |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3883 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3884 | * |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3885 | * By default, windowed mode windows are focused when shown |
| 3886 | * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint |
| 3887 | * to change this behavior for all newly created windows, or change the |
| 3888 | * behavior for an existing window with @ref glfwSetWindowAttrib. |
| 3889 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3890 | * @param[in] window The window to make visible. |
| 3891 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3892 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3893 | * GLFW_PLATFORM_ERROR. |
| 3894 | * |
Camilla Löwy | 8edbc49 | 2021-12-27 01:31:38 +0100 | [diff] [blame] | 3895 | * @remark @wayland Because Wayland wants every frame of the desktop to be |
| 3896 | * complete, this function does not immediately make the window visible. |
| 3897 | * Instead it will become visible the next time the window framebuffer is |
| 3898 | * updated after this call. |
| 3899 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3900 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3901 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3902 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3903 | * @sa @ref glfwHideWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3904 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3905 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3906 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3907 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3908 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3909 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3910 | |
| 3911 | /*! @brief Hides the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3912 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3913 | * This function hides the specified window if it was previously visible. If |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3914 | * the window is already hidden or is in full screen mode, this function does |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3915 | * nothing. |
| 3916 | * |
| 3917 | * @param[in] window The window to hide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3918 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3919 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3920 | * GLFW_PLATFORM_ERROR. |
| 3921 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3922 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3923 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3924 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3925 | * @sa @ref glfwShowWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3926 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3927 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3928 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3929 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3930 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3931 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3932 | |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3933 | /*! @brief Brings the specified window to front and sets input focus. |
| 3934 | * |
| 3935 | * This function brings the specified window to front and sets input focus. |
| 3936 | * The window should already be visible and not iconified. |
| 3937 | * |
| 3938 | * By default, both windowed and full screen mode windows are focused when |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 3939 | * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to |
| 3940 | * disable this behavior. |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3941 | * |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3942 | * Also by default, windowed mode windows are focused when shown |
| 3943 | * with @ref glfwShowWindow. Set the |
| 3944 | * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior. |
| 3945 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3946 | * __Do not use this function__ to steal focus from other applications unless |
| 3947 | * you are certain that is what the user wants. Focus stealing can be |
| 3948 | * extremely disruptive. |
| 3949 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3950 | * For a less disruptive way of getting the user's attention, see |
| 3951 | * [attention requests](@ref window_attention). |
| 3952 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3953 | * @param[in] window The window to give input focus. |
| 3954 | * |
Camilla Löwy | a360198 | 2024-02-09 03:55:14 +0100 | [diff] [blame] | 3955 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3956 | * GLFW_PLATFORM_ERROR. |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3957 | * |
Camilla Löwy | a360198 | 2024-02-09 03:55:14 +0100 | [diff] [blame] | 3958 | * @remark @wayland The compositor will likely ignore focus requests unless |
| 3959 | * another window created by the same application already has input focus. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3960 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3961 | * @thread_safety This function must only be called from the main thread. |
| 3962 | * |
| 3963 | * @sa @ref window_focus |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3964 | * @sa @ref window_attention |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3965 | * |
| 3966 | * @since Added in version 3.2. |
| 3967 | * |
| 3968 | * @ingroup window |
| 3969 | */ |
| 3970 | GLFWAPI void glfwFocusWindow(GLFWwindow* window); |
| 3971 | |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3972 | /*! @brief Requests user attention to the specified window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3973 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3974 | * This function requests user attention to the specified window. On |
| 3975 | * platforms where this is not supported, attention is requested to the |
| 3976 | * application as a whole. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3977 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3978 | * Once the user has given attention, usually by focusing the window or |
| 3979 | * application, the system will end the request automatically. |
| 3980 | * |
| 3981 | * @param[in] window The window to request attention to. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3982 | * |
| 3983 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3984 | * GLFW_PLATFORM_ERROR. |
| 3985 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3986 | * @remark @macos Attention is requested to the application as a whole, not the |
| 3987 | * specific window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3988 | * |
| 3989 | * @thread_safety This function must only be called from the main thread. |
| 3990 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3991 | * @sa @ref window_attention |
| 3992 | * |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3993 | * @since Added in version 3.3. |
| 3994 | * |
| 3995 | * @ingroup window |
| 3996 | */ |
| 3997 | GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window); |
| 3998 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3999 | /*! @brief Returns the monitor that the window uses for full screen mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4000 | * |
| 4001 | * This function returns the handle of the monitor that the specified window is |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 4002 | * in full screen on. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4003 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 4004 | * @param[in] window The window to query. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 4005 | * @return The monitor, or `NULL` if the window is in windowed mode or an |
| 4006 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4007 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4008 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4009 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4010 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4011 | * |
| 4012 | * @sa @ref window_monitor |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4013 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4014 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4015 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4016 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 4017 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 4018 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4019 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 4020 | |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 4021 | /*! @brief Sets the mode, monitor, video mode and placement of a window. |
| 4022 | * |
| 4023 | * This function sets the monitor that the window uses for full screen mode or, |
| 4024 | * if the monitor is `NULL`, makes it windowed mode. |
| 4025 | * |
| 4026 | * When setting a monitor, this function updates the width, height and refresh |
| 4027 | * rate of the desired video mode and switches to the video mode closest to it. |
| 4028 | * The window position is ignored when setting a monitor. |
| 4029 | * |
| 4030 | * When the monitor is `NULL`, the position, width and height are used to |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4031 | * place the window content area. The refresh rate is ignored when no monitor |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 4032 | * is specified. |
| 4033 | * |
| 4034 | * If you only wish to update the resolution of a full screen window or the |
| 4035 | * size of a windowed mode window, see @ref glfwSetWindowSize. |
| 4036 | * |
| 4037 | * When a window transitions from full screen to windowed mode, this function |
| 4038 | * restores any previous window settings such as whether it is decorated, |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4039 | * floating, resizable, has size or aspect ratio limits, etc. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 4040 | * |
| 4041 | * @param[in] window The window whose monitor, size or video mode to set. |
| 4042 | * @param[in] monitor The desired monitor, or `NULL` to set windowed mode. |
| 4043 | * @param[in] xpos The desired x-coordinate of the upper-left corner of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4044 | * content area. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 4045 | * @param[in] ypos The desired y-coordinate of the upper-left corner of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4046 | * content area. |
| 4047 | * @param[in] width The desired with, in screen coordinates, of the content |
| 4048 | * area or video mode. |
| 4049 | * @param[in] height The desired height, in screen coordinates, of the content |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 4050 | * area or video mode. |
Camilla Berglund | 325729d | 2016-05-22 14:25:04 +0200 | [diff] [blame] | 4051 | * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode, |
| 4052 | * or `GLFW_DONT_CARE`. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 4053 | * |
| 4054 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4055 | * GLFW_PLATFORM_ERROR. |
| 4056 | * |
Camilla Berglund | ec17161 | 2016-10-28 06:20:20 +0200 | [diff] [blame] | 4057 | * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise |
| 4058 | * affected by any resizing or mode switching, although you may need to update |
| 4059 | * your viewport if the framebuffer size has changed. |
| 4060 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4061 | * @remark @wayland The desired window position is ignored, as there is no way |
| 4062 | * for an application to set this property. |
| 4063 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 4064 | * @thread_safety This function must only be called from the main thread. |
| 4065 | * |
| 4066 | * @sa @ref window_monitor |
| 4067 | * @sa @ref window_full_screen |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4068 | * @sa @ref glfwGetWindowMonitor |
| 4069 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 4070 | * |
| 4071 | * @since Added in version 3.2. |
| 4072 | * |
| 4073 | * @ingroup window |
| 4074 | */ |
| 4075 | GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); |
| 4076 | |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 4077 | /*! @brief Returns an attribute of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4078 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4079 | * This function returns the value of an attribute of the specified window or |
| 4080 | * its OpenGL or OpenGL ES context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4081 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 4082 | * @param[in] window The window to query. |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 4083 | * @param[in] attrib The [window attribute](@ref window_attribs) whose value to |
| 4084 | * return. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4085 | * @return The value of the attribute, or zero if an |
| 4086 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 4087 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4088 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4089 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4090 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4091 | * @remark Framebuffer related hints are not window attributes. See @ref |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 4092 | * window_attribs_fb for more information. |
| 4093 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4094 | * @remark Zero is a valid value for many window and context related |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 4095 | * attributes so you cannot use a return value of zero as an indication of |
| 4096 | * errors. However, this function should not fail as long as it is passed |
| 4097 | * valid arguments and the library has been [initialized](@ref intro_init). |
| 4098 | * |
Camilla Löwy | 2796e61 | 2022-06-24 19:29:29 +0200 | [diff] [blame] | 4099 | * @remark @wayland The Wayland protocol provides no way to check whether a |
| 4100 | * window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`. |
| 4101 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4102 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4103 | * |
| 4104 | * @sa @ref window_attribs |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 4105 | * @sa @ref glfwSetWindowAttrib |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4106 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4107 | * @since Added in version 3.0. Replaces `glfwGetWindowParam` and |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4108 | * `glfwGetGLVersion`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4109 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4110 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4111 | */ |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 4112 | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4113 | |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 4114 | /*! @brief Sets an attribute of the specified window. |
| 4115 | * |
| 4116 | * This function sets the value of an attribute of the specified window. |
| 4117 | * |
| 4118 | * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), |
| 4119 | * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 4120 | * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), |
| 4121 | * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and |
| 4122 | * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib). |
Rokas Kupstys | d285a9f | 2019-09-30 15:44:43 +0300 | [diff] [blame] | 4123 | * [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_attrib) |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 4124 | * |
| 4125 | * Some of these attributes are ignored for full screen windows. The new |
| 4126 | * value will take effect if the window is later made windowed. |
| 4127 | * |
| 4128 | * Some of these attributes are ignored for windowed mode windows. The new |
| 4129 | * value will take effect if the window is later made full screen. |
| 4130 | * |
| 4131 | * @param[in] window The window to set the attribute for. |
| 4132 | * @param[in] attrib A supported window attribute. |
| 4133 | * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`. |
| 4134 | * |
| 4135 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 97b9e49 | 2022-09-20 17:03:30 +0200 | [diff] [blame] | 4136 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref |
Camilla Löwy | a12311e | 2024-01-31 00:49:53 +0100 | [diff] [blame] | 4137 | * GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 4138 | * |
| 4139 | * @remark Calling @ref glfwGetWindowAttrib will always return the latest |
| 4140 | * value, even if that value is ignored by the current mode of the window. |
| 4141 | * |
Camilla Löwy | a12311e | 2024-01-31 00:49:53 +0100 | [diff] [blame] | 4142 | * @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is |
| 4143 | * not supported. Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE. |
| 4144 | * |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 4145 | * @thread_safety This function must only be called from the main thread. |
| 4146 | * |
| 4147 | * @sa @ref window_attribs |
| 4148 | * @sa @ref glfwGetWindowAttrib |
| 4149 | * |
| 4150 | * @since Added in version 3.3. |
| 4151 | * |
| 4152 | * @ingroup window |
| 4153 | */ |
| 4154 | GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value); |
| 4155 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4156 | /*! @brief Sets the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4157 | * |
| 4158 | * This function sets the user-defined pointer of the specified window. The |
| 4159 | * current value is retained until the window is destroyed. The initial value |
| 4160 | * is `NULL`. |
| 4161 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4162 | * @param[in] window The window whose pointer to set. |
| 4163 | * @param[in] pointer The new value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4164 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4165 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4166 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4167 | * @thread_safety This function may be called from any thread. Access is not |
| 4168 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4169 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4170 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4171 | * @sa @ref glfwGetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4172 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4173 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4174 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4175 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4176 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4177 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4178 | |
| 4179 | /*! @brief Returns the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4180 | * |
| 4181 | * This function returns the current value of the user-defined pointer of the |
| 4182 | * specified window. The initial value is `NULL`. |
| 4183 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4184 | * @param[in] window The window whose pointer to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4185 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4186 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4187 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4188 | * @thread_safety This function may be called from any thread. Access is not |
| 4189 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4190 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4191 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4192 | * @sa @ref glfwSetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4193 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4194 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4195 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4196 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4197 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4198 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4199 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4200 | /*! @brief Sets the position callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4201 | * |
| 4202 | * This function sets the position callback of the specified window, which is |
Camilla Löwy | 2867ca1 | 2017-10-29 16:27:15 +0100 | [diff] [blame] | 4203 | * called when the window is moved. The callback is provided with the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4204 | * position, in screen coordinates, of the upper-left corner of the content |
| 4205 | * area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4206 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4207 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4208 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4209 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4210 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4211 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4212 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4213 | * @callback_signature |
| 4214 | * @code |
| 4215 | * void function_name(GLFWwindow* window, int xpos, int ypos) |
| 4216 | * @endcode |
| 4217 | * For more information about the callback parameters, see the |
| 4218 | * [function pointer type](@ref GLFWwindowposfun). |
| 4219 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4220 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4221 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4222 | * @remark @wayland This callback will never be called, as there is no way for |
| 4223 | * an application to know its global position. |
| 4224 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4225 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4226 | * |
| 4227 | * @sa @ref window_pos |
| 4228 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4229 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4230 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4231 | * @ingroup window |
| 4232 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4233 | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4234 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4235 | /*! @brief Sets the size callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4236 | * |
| 4237 | * This function sets the size callback of the specified window, which is |
| 4238 | * called when the window is resized. The callback is provided with the size, |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4239 | * in screen coordinates, of the content area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4240 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4241 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4242 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4243 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4244 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4245 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4246 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4247 | * @callback_signature |
| 4248 | * @code |
| 4249 | * void function_name(GLFWwindow* window, int width, int height) |
| 4250 | * @endcode |
| 4251 | * For more information about the callback parameters, see the |
| 4252 | * [function pointer type](@ref GLFWwindowsizefun). |
| 4253 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4254 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4255 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4256 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4257 | * |
| 4258 | * @sa @ref window_size |
| 4259 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4260 | * @since Added in version 1.0. |
| 4261 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4262 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4263 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4264 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4265 | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4266 | |
| 4267 | /*! @brief Sets the close callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4268 | * |
| 4269 | * This function sets the close callback of the specified window, which is |
| 4270 | * called when the user attempts to close the window, for example by clicking |
| 4271 | * the close widget in the title bar. |
| 4272 | * |
| 4273 | * The close flag is set before this callback is called, but you can modify it |
| 4274 | * at any time with @ref glfwSetWindowShouldClose. |
| 4275 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4276 | * The close callback is not triggered by @ref glfwDestroyWindow. |
| 4277 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4278 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4279 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4280 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4281 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4282 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4283 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4284 | * @callback_signature |
| 4285 | * @code |
| 4286 | * void function_name(GLFWwindow* window) |
| 4287 | * @endcode |
| 4288 | * For more information about the callback parameters, see the |
| 4289 | * [function pointer type](@ref GLFWwindowclosefun). |
| 4290 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4291 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4292 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 4293 | * @remark @macos Selecting Quit from the application menu will trigger the |
| 4294 | * close callback for all windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4295 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4296 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4297 | * |
| 4298 | * @sa @ref window_close |
| 4299 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4300 | * @since Added in version 2.5. |
| 4301 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4302 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4303 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4304 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4305 | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4306 | |
| 4307 | /*! @brief Sets the refresh callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4308 | * |
| 4309 | * This function sets the refresh callback of the specified window, which is |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4310 | * called when the content area of the window needs to be redrawn, for example |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4311 | * if the window has been exposed after having been covered by another window. |
| 4312 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4313 | * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where |
| 4314 | * the window contents are saved off-screen, this callback may be called only |
| 4315 | * very infrequently or never at all. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 4316 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4317 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4318 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4319 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4320 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4321 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4322 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4323 | * @callback_signature |
| 4324 | * @code |
| 4325 | * void function_name(GLFWwindow* window); |
| 4326 | * @endcode |
| 4327 | * For more information about the callback parameters, see the |
| 4328 | * [function pointer type](@ref GLFWwindowrefreshfun). |
| 4329 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4330 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4331 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4332 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4333 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4334 | * @sa @ref window_refresh |
| 4335 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4336 | * @since Added in version 2.5. |
| 4337 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 4338 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4339 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4340 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4341 | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4342 | |
| 4343 | /*! @brief Sets the focus callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4344 | * |
| 4345 | * This function sets the focus callback of the specified window, which is |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4346 | * called when the window gains or loses input focus. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4347 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4348 | * After the focus callback is called for a window that lost input focus, |
| 4349 | * synthetic key and mouse button release events will be generated for all such |
| 4350 | * that had been pressed. For more information, see @ref glfwSetKeyCallback |
| 4351 | * and @ref glfwSetMouseButtonCallback. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 4352 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4353 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4354 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4355 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4356 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4357 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4358 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4359 | * @callback_signature |
| 4360 | * @code |
| 4361 | * void function_name(GLFWwindow* window, int focused) |
| 4362 | * @endcode |
| 4363 | * For more information about the callback parameters, see the |
| 4364 | * [function pointer type](@ref GLFWwindowfocusfun). |
| 4365 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4366 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4367 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4368 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4369 | * |
| 4370 | * @sa @ref window_focus |
| 4371 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4372 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4373 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4374 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4375 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4376 | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4377 | |
| 4378 | /*! @brief Sets the iconify callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4379 | * |
| 4380 | * This function sets the iconification callback of the specified window, which |
| 4381 | * is called when the window is iconified or restored. |
| 4382 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4383 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4384 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4385 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4386 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4387 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4388 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4389 | * @callback_signature |
| 4390 | * @code |
| 4391 | * void function_name(GLFWwindow* window, int iconified) |
| 4392 | * @endcode |
| 4393 | * For more information about the callback parameters, see the |
| 4394 | * [function pointer type](@ref GLFWwindowiconifyfun). |
| 4395 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4396 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4397 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4398 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4399 | * |
| 4400 | * @sa @ref window_iconify |
| 4401 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4402 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4403 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4404 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4405 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4406 | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 4407 | |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 4408 | /*! @brief Sets the maximize callback for the specified window. |
| 4409 | * |
| 4410 | * This function sets the maximization callback of the specified window, which |
| 4411 | * is called when the window is maximized or restored. |
| 4412 | * |
| 4413 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4414 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 4415 | * callback. |
| 4416 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4417 | * library had not been [initialized](@ref intro_init). |
| 4418 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4419 | * @callback_signature |
| 4420 | * @code |
| 4421 | * void function_name(GLFWwindow* window, int maximized) |
| 4422 | * @endcode |
| 4423 | * For more information about the callback parameters, see the |
| 4424 | * [function pointer type](@ref GLFWwindowmaximizefun). |
| 4425 | * |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 4426 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4427 | * |
| 4428 | * @thread_safety This function must only be called from the main thread. |
| 4429 | * |
| 4430 | * @sa @ref window_maximize |
| 4431 | * |
| 4432 | * @since Added in version 3.3. |
| 4433 | * |
| 4434 | * @ingroup window |
| 4435 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4436 | GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback); |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 4437 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4438 | /*! @brief Sets the framebuffer resize callback for the specified window. |
| 4439 | * |
| 4440 | * This function sets the framebuffer resize callback of the specified window, |
| 4441 | * which is called when the framebuffer of the specified window is resized. |
| 4442 | * |
| 4443 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4444 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4445 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4446 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4447 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4448 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4449 | * @callback_signature |
| 4450 | * @code |
| 4451 | * void function_name(GLFWwindow* window, int width, int height) |
| 4452 | * @endcode |
| 4453 | * For more information about the callback parameters, see the |
| 4454 | * [function pointer type](@ref GLFWframebuffersizefun). |
| 4455 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4456 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4457 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4458 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4459 | * |
| 4460 | * @sa @ref window_fbsize |
| 4461 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4462 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4463 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4464 | * @ingroup window |
| 4465 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4466 | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback); |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4467 | |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 4468 | /*! @brief Sets the window content scale callback for the specified window. |
| 4469 | * |
| 4470 | * This function sets the window content scale callback of the specified window, |
| 4471 | * which is called when the content scale of the specified window changes. |
| 4472 | * |
| 4473 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4474 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 4475 | * callback. |
| 4476 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4477 | * library had not been [initialized](@ref intro_init). |
| 4478 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4479 | * @callback_signature |
| 4480 | * @code |
| 4481 | * void function_name(GLFWwindow* window, float xscale, float yscale) |
| 4482 | * @endcode |
| 4483 | * For more information about the callback parameters, see the |
| 4484 | * [function pointer type](@ref GLFWwindowcontentscalefun). |
| 4485 | * |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 4486 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4487 | * |
| 4488 | * @thread_safety This function must only be called from the main thread. |
| 4489 | * |
| 4490 | * @sa @ref window_scale |
| 4491 | * @sa @ref glfwGetWindowContentScale |
| 4492 | * |
| 4493 | * @since Added in version 3.3. |
| 4494 | * |
| 4495 | * @ingroup window |
| 4496 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4497 | GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback); |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 4498 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4499 | /*! @brief Processes all pending events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4500 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4501 | * This function processes only those events that are already in the event |
| 4502 | * queue and then returns immediately. Processing events will cause the window |
| 4503 | * and input callbacks associated with those events to be called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4504 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4505 | * On some platforms, a window move, resize or menu operation will cause event |
| 4506 | * processing to block. This is due to how event processing is designed on |
| 4507 | * those platforms. You can use the |
| 4508 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 4509 | * your window when necessary during such operations. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4510 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4511 | * Do not assume that callbacks you set will _only_ be called in response to |
| 4512 | * event processing functions like this one. While it is necessary to poll for |
| 4513 | * events, window systems that require GLFW to register callbacks of its own |
| 4514 | * can pass events to GLFW in response to many window system function calls. |
| 4515 | * GLFW will pass those events on to the application callbacks before |
| 4516 | * returning. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 4517 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4518 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 4519 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4520 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4521 | * GLFW_PLATFORM_ERROR. |
| 4522 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4523 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 4524 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4525 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4526 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4527 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4528 | * @sa @ref glfwWaitEvents |
| 4529 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4530 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4531 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4532 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4533 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4534 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 4535 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4536 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4537 | /*! @brief Waits until events are queued and processes them. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4538 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4539 | * This function puts the calling thread to sleep until at least one event is |
| 4540 | * available in the event queue. Once one or more events are available, |
| 4541 | * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue |
| 4542 | * are processed and the function then returns immediately. Processing events |
| 4543 | * will cause the window and input callbacks associated with those events to be |
| 4544 | * called. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4545 | * |
| 4546 | * Since not all events are associated with callbacks, this function may return |
| 4547 | * without a callback having been called even if you are monitoring all |
| 4548 | * callbacks. |
| 4549 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4550 | * On some platforms, a window move, resize or menu operation will cause event |
| 4551 | * processing to block. This is due to how event processing is designed on |
| 4552 | * those platforms. You can use the |
| 4553 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 4554 | * your window when necessary during such operations. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4555 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4556 | * Do not assume that callbacks you set will _only_ be called in response to |
| 4557 | * event processing functions like this one. While it is necessary to poll for |
| 4558 | * events, window systems that require GLFW to register callbacks of its own |
| 4559 | * can pass events to GLFW in response to many window system function calls. |
| 4560 | * GLFW will pass those events on to the application callbacks before |
| 4561 | * returning. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4562 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4563 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 4564 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4565 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4566 | * GLFW_PLATFORM_ERROR. |
| 4567 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4568 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 4569 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4570 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4571 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4572 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4573 | * @sa @ref glfwPollEvents |
| 4574 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4575 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4576 | * @since Added in version 2.5. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4577 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4578 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4579 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 4580 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 4581 | |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4582 | /*! @brief Waits with timeout until events are queued and processes them. |
| 4583 | * |
| 4584 | * This function puts the calling thread to sleep until at least one event is |
| 4585 | * available in the event queue, or until the specified timeout is reached. If |
| 4586 | * one or more events are available, it behaves exactly like @ref |
| 4587 | * glfwPollEvents, i.e. the events in the queue are processed and the function |
| 4588 | * then returns immediately. Processing events will cause the window and input |
| 4589 | * callbacks associated with those events to be called. |
| 4590 | * |
| 4591 | * The timeout value must be a positive finite number. |
| 4592 | * |
| 4593 | * Since not all events are associated with callbacks, this function may return |
| 4594 | * without a callback having been called even if you are monitoring all |
| 4595 | * callbacks. |
| 4596 | * |
| 4597 | * On some platforms, a window move, resize or menu operation will cause event |
| 4598 | * processing to block. This is due to how event processing is designed on |
| 4599 | * those platforms. You can use the |
| 4600 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 4601 | * your window when necessary during such operations. |
| 4602 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4603 | * Do not assume that callbacks you set will _only_ be called in response to |
| 4604 | * event processing functions like this one. While it is necessary to poll for |
| 4605 | * events, window systems that require GLFW to register callbacks of its own |
| 4606 | * can pass events to GLFW in response to many window system function calls. |
| 4607 | * GLFW will pass those events on to the application callbacks before |
| 4608 | * returning. |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4609 | * |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4610 | * Event processing is not required for joystick input to work. |
| 4611 | * |
| 4612 | * @param[in] timeout The maximum amount of time, in seconds, to wait. |
| 4613 | * |
Sylvain Boilard | 3b255af | 2018-09-13 16:23:44 +0200 | [diff] [blame] | 4614 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 8e313d9 | 2018-12-13 20:33:17 +0100 | [diff] [blame] | 4615 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Sylvain Boilard | 3b255af | 2018-09-13 16:23:44 +0200 | [diff] [blame] | 4616 | * |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4617 | * @reentrancy This function must not be called from a callback. |
| 4618 | * |
| 4619 | * @thread_safety This function must only be called from the main thread. |
| 4620 | * |
| 4621 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4622 | * @sa @ref glfwPollEvents |
| 4623 | * @sa @ref glfwWaitEvents |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4624 | * |
| 4625 | * @since Added in version 3.2. |
| 4626 | * |
| 4627 | * @ingroup window |
| 4628 | */ |
| 4629 | GLFWAPI void glfwWaitEventsTimeout(double timeout); |
| 4630 | |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4631 | /*! @brief Posts an empty event to the event queue. |
| 4632 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4633 | * This function posts an empty event from the current thread to the event |
Camilla Berglund | 73abf8a | 2016-07-06 13:06:59 +0200 | [diff] [blame] | 4634 | * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4635 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4636 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4637 | * GLFW_PLATFORM_ERROR. |
| 4638 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4639 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4640 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4641 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4642 | * @sa @ref glfwWaitEvents |
| 4643 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4644 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4645 | * @since Added in version 3.1. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4646 | * |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4647 | * @ingroup window |
| 4648 | */ |
| 4649 | GLFWAPI void glfwPostEmptyEvent(void); |
| 4650 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4651 | /*! @brief Returns the value of an input option for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4652 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4653 | * This function returns the value of an input option for the specified window. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 4654 | * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4655 | * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4656 | * @ref GLFW_RAW_MOUSE_MOTION. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4657 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4658 | * @param[in] window The window to query. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 4659 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4660 | * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or |
| 4661 | * `GLFW_RAW_MOUSE_MOTION`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4662 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4663 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4664 | * GLFW_INVALID_ENUM. |
| 4665 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4666 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4667 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4668 | * @sa @ref glfwSetInputMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4669 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4670 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4671 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4672 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4673 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4674 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4675 | |
| 4676 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4677 | * |
| 4678 | * This function sets an input mode option for the specified window. The mode |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 4679 | * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, |
Grzesiek11 | bf945f1 | 2024-02-29 15:50:50 +0000 | [diff] [blame] | 4680 | * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS |
| 4681 | * @ref GLFW_RAW_MOUSE_MOTION, or @ref GLFW_UNLIMITED_MOUSE_BUTTONS. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4682 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4683 | * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 4684 | * modes: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 4685 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4686 | * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the |
| 4687 | * content area of the window but does not restrict the cursor from leaving. |
Camilla Berglund | a18b187 | 2013-12-05 03:27:12 +0100 | [diff] [blame] | 4688 | * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual |
| 4689 | * and unlimited cursor movement. This is useful for implementing for |
| 4690 | * example 3D camera controls. |
Camilla Löwy | 488008e | 2019-12-03 17:58:20 +0100 | [diff] [blame] | 4691 | * - `GLFW_CURSOR_CAPTURED` makes the cursor visible and confines it to the |
| 4692 | * content area of the window. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 4693 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 4694 | * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to |
| 4695 | * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4696 | * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` |
| 4697 | * the next time it is called even if the key had been released before the |
| 4698 | * call. This is useful when you are only interested in whether keys have been |
| 4699 | * pressed but not when or in which order. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 4700 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4701 | * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 4702 | * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. |
| 4703 | * If sticky mouse buttons are enabled, a mouse button press will ensure that |
| 4704 | * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even |
| 4705 | * if the mouse button had been released before the call. This is useful when |
| 4706 | * you are only interested in whether mouse buttons have been pressed but not |
| 4707 | * when or in which order. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4708 | * |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 4709 | * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to |
| 4710 | * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled, |
| 4711 | * callbacks that receive modifier bits will also have the @ref |
| 4712 | * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on, |
| 4713 | * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on. |
| 4714 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4715 | * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE` |
| 4716 | * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is |
| 4717 | * disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported, |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 4718 | * attempting to set this will emit @ref GLFW_FEATURE_UNAVAILABLE. Call @ref |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4719 | * glfwRawMouseMotionSupported to check for support. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4720 | * |
Grzesiek11 | bf945f1 | 2024-02-29 15:50:50 +0000 | [diff] [blame] | 4721 | * If the mode is `GLFW_UNLIMITED_MOUSE_BUTTONS`, the value must be either |
| 4722 | * `GLFW_TRUE` to disable the mouse button limit when calling the mouse button |
| 4723 | * callback, or `GLFW_FALSE` to limit the mouse buttons sent to the callback |
| 4724 | * to the mouse button token values up to `GLFW_MOUSE_BUTTON_LAST`. |
| 4725 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4726 | * @param[in] window The window whose input mode to set. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 4727 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4728 | * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or |
| 4729 | * `GLFW_RAW_MOUSE_MOTION`. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4730 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 4731 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4732 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 4733 | * GLFW_INVALID_ENUM, @ref GLFW_PLATFORM_ERROR and @ref |
| 4734 | * GLFW_FEATURE_UNAVAILABLE (see above). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4735 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4736 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4737 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4738 | * @sa @ref glfwGetInputMode |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4739 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4740 | * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4741 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4742 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4743 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4744 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4745 | |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4746 | /*! @brief Returns whether raw mouse motion is supported. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4747 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4748 | * This function returns whether raw mouse motion is supported on the current |
| 4749 | * system. This status does not change after GLFW has been initialized so you |
| 4750 | * only need to check this once. If you attempt to enable raw motion on |
| 4751 | * a system that does not support it, @ref GLFW_PLATFORM_ERROR will be emitted. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4752 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4753 | * Raw mouse motion is closer to the actual motion of the mouse across |
| 4754 | * a surface. It is not affected by the scaling and acceleration applied to |
| 4755 | * the motion of the desktop cursor. That processing is suitable for a cursor |
| 4756 | * while raw motion is better for controlling for example a 3D camera. Because |
| 4757 | * of this, raw mouse motion is only provided when the cursor is disabled. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4758 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4759 | * @return `GLFW_TRUE` if raw mouse motion is supported on the current machine, |
| 4760 | * or `GLFW_FALSE` otherwise. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4761 | * |
| 4762 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4763 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4764 | * @thread_safety This function must only be called from the main thread. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4765 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4766 | * @sa @ref raw_mouse_motion |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4767 | * @sa @ref glfwSetInputMode |
| 4768 | * |
| 4769 | * @since Added in version 3.3. |
| 4770 | * |
| 4771 | * @ingroup input |
| 4772 | */ |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4773 | GLFWAPI int glfwRawMouseMotionSupported(void); |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4774 | |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 4775 | /*! @brief Returns the layout-specific name of the specified printable key. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4776 | * |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 4777 | * This function returns the name of the specified printable key, encoded as |
| 4778 | * UTF-8. This is typically the character that key would produce without any |
| 4779 | * modifier keys, intended for displaying key bindings to the user. For dead |
| 4780 | * keys, it is typically the diacritic it would add to a character. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4781 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 4782 | * __Do not use this function__ for [text input](@ref input_char). You will |
| 4783 | * break text input for many languages even if it happens to work for yours. |
Camilla Berglund | 70ffae7 | 2016-02-22 11:54:56 +0100 | [diff] [blame] | 4784 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 4785 | * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key, |
| 4786 | * otherwise the scancode is ignored. If you specify a non-printable key, or |
| 4787 | * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this |
| 4788 | * function returns `NULL` but does not emit an error. |
| 4789 | * |
| 4790 | * This behavior allows you to always pass in the arguments in the |
Camilla Berglund | 70ffae7 | 2016-02-22 11:54:56 +0100 | [diff] [blame] | 4791 | * [key callback](@ref input_key) without modification. |
| 4792 | * |
| 4793 | * The printable keys are: |
| 4794 | * - `GLFW_KEY_APOSTROPHE` |
| 4795 | * - `GLFW_KEY_COMMA` |
| 4796 | * - `GLFW_KEY_MINUS` |
| 4797 | * - `GLFW_KEY_PERIOD` |
| 4798 | * - `GLFW_KEY_SLASH` |
| 4799 | * - `GLFW_KEY_SEMICOLON` |
| 4800 | * - `GLFW_KEY_EQUAL` |
| 4801 | * - `GLFW_KEY_LEFT_BRACKET` |
| 4802 | * - `GLFW_KEY_RIGHT_BRACKET` |
| 4803 | * - `GLFW_KEY_BACKSLASH` |
| 4804 | * - `GLFW_KEY_WORLD_1` |
| 4805 | * - `GLFW_KEY_WORLD_2` |
| 4806 | * - `GLFW_KEY_0` to `GLFW_KEY_9` |
| 4807 | * - `GLFW_KEY_A` to `GLFW_KEY_Z` |
| 4808 | * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9` |
| 4809 | * - `GLFW_KEY_KP_DECIMAL` |
| 4810 | * - `GLFW_KEY_KP_DIVIDE` |
| 4811 | * - `GLFW_KEY_KP_MULTIPLY` |
| 4812 | * - `GLFW_KEY_KP_SUBTRACT` |
| 4813 | * - `GLFW_KEY_KP_ADD` |
| 4814 | * - `GLFW_KEY_KP_EQUAL` |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4815 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 4816 | * Names for printable keys depend on keyboard layout, while names for |
| 4817 | * non-printable keys are the same across layouts but depend on the application |
| 4818 | * language and should be localized along with other user interface text. |
| 4819 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4820 | * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`. |
| 4821 | * @param[in] scancode The scancode of the key to query. |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 4822 | * @return The UTF-8 encoded, layout-specific name of the key, or `NULL`. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4823 | * |
Camilla Löwy | 557a633 | 2023-12-05 15:53:42 +0100 | [diff] [blame] | 4824 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4825 | * GLFW_INVALID_VALUE, @ref GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4826 | * |
Camilla Löwy | 56ca0cb | 2019-08-22 21:31:46 +0200 | [diff] [blame] | 4827 | * @remark The contents of the returned string may change when a keyboard |
| 4828 | * layout change event is received. |
| 4829 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4830 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
Camilla Löwy | 56ca0cb | 2019-08-22 21:31:46 +0200 | [diff] [blame] | 4831 | * should not free it yourself. It is valid until the library is terminated. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4832 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4833 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4834 | * |
| 4835 | * @sa @ref input_key_name |
| 4836 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4837 | * @since Added in version 3.2. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4838 | * |
| 4839 | * @ingroup input |
| 4840 | */ |
| 4841 | GLFWAPI const char* glfwGetKeyName(int key, int scancode); |
| 4842 | |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4843 | /*! @brief Returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4844 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4845 | * This function returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4846 | * |
Camilla Löwy | 9959dc6 | 2023-12-04 20:06:10 +0100 | [diff] [blame] | 4847 | * If the specified [key token](@ref keys) corresponds to a physical key not |
| 4848 | * supported on the current platform then this method will return `-1`. |
| 4849 | * Calling this function with anything other than a key token will return `-1` |
| 4850 | * and generate a @ref GLFW_INVALID_ENUM error. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4851 | * |
Camilla Löwy | 9959dc6 | 2023-12-04 20:06:10 +0100 | [diff] [blame] | 4852 | * @param[in] key Any [key token](@ref keys). |
| 4853 | * @return The platform-specific scancode for the key, or `-1` if the key is |
| 4854 | * not supported on the current platform or an [error](@ref error_handling) |
| 4855 | * occurred. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4856 | * |
Camilla Löwy | 9959dc6 | 2023-12-04 20:06:10 +0100 | [diff] [blame] | 4857 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4858 | * GLFW_INVALID_ENUM. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4859 | * |
| 4860 | * @thread_safety This function may be called from any thread. |
| 4861 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4862 | * @sa @ref input_key |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4863 | * |
| 4864 | * @since Added in version 3.3. |
| 4865 | * |
| 4866 | * @ingroup input |
| 4867 | */ |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4868 | GLFWAPI int glfwGetKeyScancode(int key); |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4869 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4870 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 4871 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4872 | * |
| 4873 | * This function returns the last state reported for the specified key to the |
| 4874 | * specified window. The returned state is one of `GLFW_PRESS` or |
Camilla Löwy | aa80d24 | 2022-06-28 23:19:30 +0200 | [diff] [blame] | 4875 | * `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4876 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4877 | * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4878 | * `GLFW_PRESS` the first time you call it for a key that was pressed, even if |
| 4879 | * that key has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4880 | * |
| 4881 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 4882 | * named after their use on the standard US keyboard layout. If you want to |
| 4883 | * input text, use the Unicode character callback instead. |
| 4884 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4885 | * The [modifier key bit masks](@ref mods) are not key tokens and cannot be |
| 4886 | * used with this function. |
| 4887 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4888 | * __Do not use this function__ to implement [text input](@ref input_char). |
| 4889 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4890 | * @param[in] window The desired window. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4891 | * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is |
| 4892 | * not a valid key for this function. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4893 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4894 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4895 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4896 | * GLFW_INVALID_ENUM. |
| 4897 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4898 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4899 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4900 | * @sa @ref input_key |
| 4901 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4902 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4903 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 4904 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4905 | * @ingroup input |
| 4906 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4907 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4908 | |
| 4909 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 4910 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4911 | * |
| 4912 | * This function returns the last state reported for the specified mouse button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4913 | * to the specified window. The returned state is one of `GLFW_PRESS` or |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 4914 | * `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4915 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4916 | * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function |
Coşku Baş | f4764f7 | 2018-08-06 18:13:24 +0300 | [diff] [blame] | 4917 | * returns `GLFW_PRESS` the first time you call it for a mouse button that was |
| 4918 | * pressed, even if that mouse button has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4919 | * |
Grzesiek11 | bf945f1 | 2024-02-29 15:50:50 +0000 | [diff] [blame] | 4920 | * The @ref GLFW_UNLIMITED_MOUSE_BUTTONS input mode does not effect the |
| 4921 | * limit on buttons which can be polled with this function. |
| 4922 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4923 | * @param[in] window The desired window. |
Grzesiek11 | bf945f1 | 2024-02-29 15:50:50 +0000 | [diff] [blame] | 4924 | * @param[in] button The desired [mouse button token](@ref buttons). |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4925 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4926 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4927 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4928 | * GLFW_INVALID_ENUM. |
| 4929 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4930 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4931 | * |
| 4932 | * @sa @ref input_mouse_button |
| 4933 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4934 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4935 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4936 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4937 | * @ingroup input |
| 4938 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4939 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4940 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4941 | /*! @brief Retrieves the position of the cursor relative to the content area of |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 4942 | * the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4943 | * |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 4944 | * This function returns the position of the cursor, in screen coordinates, |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4945 | * relative to the upper-left corner of the content area of the specified |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 4946 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4947 | * |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4948 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
| 4949 | * position is unbounded and limited only by the minimum and maximum values of |
| 4950 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4951 | * |
Camilla Berglund | 3ec2925 | 2013-04-25 18:03:15 +0200 | [diff] [blame] | 4952 | * The coordinate can be converted to their integer equivalents with the |
| 4953 | * `floor` function. Casting directly to an integer type works for positive |
| 4954 | * coordinates, but fails for negative ones. |
| 4955 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4956 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 4957 | * non-`NULL` position arguments will be set to zero. |
| 4958 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4959 | * @param[in] window The desired window. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4960 | * @param[out] xpos Where to store the cursor x-coordinate, relative to the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4961 | * left edge of the content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4962 | * @param[out] ypos Where to store the cursor y-coordinate, relative to the to |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4963 | * top edge of the content area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4964 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4965 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4966 | * GLFW_PLATFORM_ERROR. |
| 4967 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4968 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4969 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4970 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4971 | * @sa @ref glfwSetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4972 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4973 | * @since Added in version 3.0. Replaces `glfwGetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4974 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4975 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4976 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4977 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4978 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4979 | /*! @brief Sets the position of the cursor, relative to the content area of the |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 4980 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4981 | * |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 4982 | * This function sets the position, in screen coordinates, of the cursor |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4983 | * relative to the upper-left corner of the content area of the specified |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4984 | * window. The window must have input focus. If the window does not have |
| 4985 | * input focus when this function is called, it fails silently. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4986 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 4987 | * __Do not use this function__ to implement things like camera controls. GLFW |
| 4988 | * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the |
| 4989 | * cursor, transparently re-centers it and provides unconstrained cursor |
| 4990 | * motion. See @ref glfwSetInputMode for more information. |
| 4991 | * |
| 4992 | * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is |
| 4993 | * unconstrained and limited only by the minimum and maximum values of |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4994 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4995 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4996 | * @param[in] window The desired window. |
| 4997 | * @param[in] xpos The desired x-coordinate, relative to the left edge of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4998 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4999 | * @param[in] ypos The desired y-coordinate, relative to the top edge of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 5000 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5001 | * |
Camilla Löwy | 97b9e49 | 2022-09-20 17:03:30 +0200 | [diff] [blame] | 5002 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5003 | * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5004 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 5005 | * @remark @wayland This function will only work when the cursor mode is |
Camilla Löwy | 97b9e49 | 2022-09-20 17:03:30 +0200 | [diff] [blame] | 5006 | * `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 5007 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5008 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5009 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5010 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5011 | * @sa @ref glfwGetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5012 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5013 | * @since Added in version 3.0. Replaces `glfwSetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5014 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5015 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5016 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 5017 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5018 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 5019 | /*! @brief Creates a custom cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5020 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5021 | * Creates a new custom cursor image that can be set for a window with @ref |
| 5022 | * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. |
| 5023 | * Any remaining cursors are destroyed by @ref glfwTerminate. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5024 | * |
Camilla Berglund | 85a01bf | 2015-08-17 21:04:19 +0200 | [diff] [blame] | 5025 | * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 5026 | * bits per channel with the red channel first. They are arranged canonically |
| 5027 | * as packed sequential rows, starting from the top-left corner. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5028 | * |
| 5029 | * The cursor hotspot is specified in pixels, relative to the upper-left corner |
| 5030 | * of the cursor image. Like all other coordinate systems in GLFW, the X-axis |
| 5031 | * points to the right and the Y-axis points down. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5032 | * |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 5033 | * @param[in] image The desired cursor image. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5034 | * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. |
| 5035 | * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5036 | * @return The handle of the created cursor, or `NULL` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5037 | * [error](@ref error_handling) occurred. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5038 | * |
Camilla Löwy | 66a4882 | 2022-03-15 21:22:49 +0100 | [diff] [blame] | 5039 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5040 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5041 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5042 | * @pointer_lifetime The specified image data is copied before this function |
| 5043 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5044 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5045 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5046 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5047 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5048 | * @sa @ref glfwDestroyCursor |
| 5049 | * @sa @ref glfwCreateStandardCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5050 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5051 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5052 | * |
| 5053 | * @ingroup input |
| 5054 | */ |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 5055 | GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5056 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 5057 | /*! @brief Creates a cursor with a standard shape. |
| 5058 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 5059 | * Returns a cursor with a standard shape, that can be set for a window with |
| 5060 | * @ref glfwSetCursor. The images for these cursors come from the system |
| 5061 | * cursor theme and their exact appearance will vary between platforms. |
| 5062 | * |
| 5063 | * Most of these shapes are guaranteed to exist on every supported platform but |
| 5064 | * a few may not be present. See the table below for details. |
| 5065 | * |
| 5066 | * Cursor shape | Windows | macOS | X11 | Wayland |
| 5067 | * ------------------------------ | ------- | ----- | ------ | ------- |
| 5068 | * @ref GLFW_ARROW_CURSOR | Yes | Yes | Yes | Yes |
| 5069 | * @ref GLFW_IBEAM_CURSOR | Yes | Yes | Yes | Yes |
| 5070 | * @ref GLFW_CROSSHAIR_CURSOR | Yes | Yes | Yes | Yes |
| 5071 | * @ref GLFW_POINTING_HAND_CURSOR | Yes | Yes | Yes | Yes |
| 5072 | * @ref GLFW_RESIZE_EW_CURSOR | Yes | Yes | Yes | Yes |
| 5073 | * @ref GLFW_RESIZE_NS_CURSOR | Yes | Yes | Yes | Yes |
| 5074 | * @ref GLFW_RESIZE_NWSE_CURSOR | Yes | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup> |
| 5075 | * @ref GLFW_RESIZE_NESW_CURSOR | Yes | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup> |
| 5076 | * @ref GLFW_RESIZE_ALL_CURSOR | Yes | Yes | Yes | Yes |
| 5077 | * @ref GLFW_NOT_ALLOWED_CURSOR | Yes | Yes | Maybe<sup>2</sup> | Maybe<sup>2</sup> |
| 5078 | * |
| 5079 | * 1) This uses a private system API and may fail in the future. |
| 5080 | * |
| 5081 | * 2) This uses a newer standard that not all cursor themes support. |
| 5082 | * |
| 5083 | * If the requested shape is not available, this function emits a @ref |
| 5084 | * GLFW_CURSOR_UNAVAILABLE error and returns `NULL`. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 5085 | * |
| 5086 | * @param[in] shape One of the [standard shapes](@ref shapes). |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 5087 | * @return A new cursor ready to use or `NULL` if an |
| 5088 | * [error](@ref error_handling) occurred. |
| 5089 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5090 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 5091 | * GLFW_INVALID_ENUM, @ref GLFW_CURSOR_UNAVAILABLE and @ref |
| 5092 | * GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5093 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5094 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 5095 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 5096 | * @sa @ref cursor_standard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5097 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 5098 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5099 | * @since Added in version 3.1. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 5100 | * |
| 5101 | * @ingroup input |
| 5102 | */ |
| 5103 | GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); |
| 5104 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5105 | /*! @brief Destroys a cursor. |
| 5106 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5107 | * This function destroys a cursor previously created with @ref |
| 5108 | * glfwCreateCursor. Any remaining cursors will be destroyed by @ref |
| 5109 | * glfwTerminate. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5110 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 5111 | * If the specified cursor is current for any window, that window will be |
| 5112 | * reverted to the default cursor. This does not affect the cursor mode. |
| 5113 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5114 | * @param[in] cursor The cursor object to destroy. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5115 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5116 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5117 | * GLFW_PLATFORM_ERROR. |
| 5118 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5119 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5120 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5121 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5122 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5123 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5124 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5125 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5126 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5127 | * |
| 5128 | * @ingroup input |
| 5129 | */ |
| 5130 | GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); |
| 5131 | |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5132 | /*! @brief Sets the cursor for the window. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5133 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5134 | * This function sets the cursor image to be used when the cursor is over the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 5135 | * content area of the specified window. The set cursor will only be visible |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5136 | * when the [cursor mode](@ref cursor_mode) of the window is |
| 5137 | * `GLFW_CURSOR_NORMAL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5138 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5139 | * On some platforms, the set cursor may not be visible unless the window also |
| 5140 | * has input focus. |
| 5141 | * |
| 5142 | * @param[in] window The window to set the cursor for. |
| 5143 | * @param[in] cursor The cursor to set, or `NULL` to switch back to the default |
| 5144 | * arrow cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5145 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5146 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5147 | * GLFW_PLATFORM_ERROR. |
| 5148 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5149 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5150 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5151 | * @sa @ref cursor_object |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5152 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5153 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5154 | * |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5155 | * @ingroup input |
| 5156 | */ |
| 5157 | GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); |
| 5158 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5159 | /*! @brief Sets the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5160 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5161 | * This function sets the key callback of the specified window, which is called |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5162 | * when a key is pressed, repeated or released. |
| 5163 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 5164 | * The key functions deal with physical keys, with layout independent |
| 5165 | * [key tokens](@ref keys) named after their values in the standard US keyboard |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5166 | * layout. If you want to input text, use the |
| 5167 | * [character callback](@ref glfwSetCharCallback) instead. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5168 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5169 | * When a window loses input focus, it will generate synthetic key release |
Camilla Löwy | 9959dc6 | 2023-12-04 20:06:10 +0100 | [diff] [blame] | 5170 | * events for all pressed keys with associated key tokens. You can tell these |
| 5171 | * events from user-generated events by the fact that the synthetic ones are |
| 5172 | * generated after the focus loss event has been processed, i.e. after the |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5173 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 5174 | * |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 5175 | * The scancode of a key is specific to that platform or sometimes even to that |
| 5176 | * machine. Scancodes are intended to allow users to bind keys that don't have |
| 5177 | * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5178 | * state is not saved and so it cannot be queried with @ref glfwGetKey. |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 5179 | * |
| 5180 | * Sometimes GLFW needs to generate synthetic key events, in which case the |
| 5181 | * scancode may be zero. |
| 5182 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5183 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5184 | * @param[in] callback The new key callback, or `NULL` to remove the currently |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5185 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5186 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5187 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5188 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5189 | * @callback_signature |
| 5190 | * @code |
| 5191 | * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods) |
| 5192 | * @endcode |
| 5193 | * For more information about the callback parameters, see the |
| 5194 | * [function pointer type](@ref GLFWkeyfun). |
| 5195 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5196 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5197 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5198 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5199 | * |
| 5200 | * @sa @ref input_key |
| 5201 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5202 | * @since Added in version 1.0. |
| 5203 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5204 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5205 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5206 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5207 | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5208 | |
| 5209 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5210 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5211 | * This function sets the character callback of the specified window, which is |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5212 | * called when a Unicode character is input. |
| 5213 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5214 | * The character callback is intended for Unicode text input. As it deals with |
| 5215 | * characters, it is keyboard layout dependent, whereas the |
| 5216 | * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 |
| 5217 | * to physical keys, as a key may produce zero, one or more characters. If you |
| 5218 | * want to know whether a specific physical key was pressed or released, see |
| 5219 | * the key callback instead. |
| 5220 | * |
| 5221 | * The character callback behaves as system text input normally does and will |
| 5222 | * not be called if modifier keys are held down that would prevent normal text |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 5223 | * input on that platform, for example a Super (Command) key on macOS or Alt key |
Camilla Löwy | 86e7bf4 | 2018-12-25 22:11:23 +0100 | [diff] [blame] | 5224 | * on Windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5225 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5226 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5227 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 5228 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5229 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5230 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5231 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5232 | * @callback_signature |
| 5233 | * @code |
| 5234 | * void function_name(GLFWwindow* window, unsigned int codepoint) |
| 5235 | * @endcode |
| 5236 | * For more information about the callback parameters, see the |
| 5237 | * [function pointer type](@ref GLFWcharfun). |
| 5238 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5239 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5240 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5241 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5242 | * |
| 5243 | * @sa @ref input_char |
| 5244 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5245 | * @since Added in version 2.4. |
| 5246 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5247 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5248 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5249 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5250 | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5251 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5252 | /*! @brief Sets the Unicode character with modifiers callback. |
| 5253 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5254 | * This function sets the character with modifiers callback of the specified |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5255 | * window, which is called when a Unicode character is input regardless of what |
| 5256 | * modifier keys are used. |
| 5257 | * |
| 5258 | * The character with modifiers callback is intended for implementing custom |
| 5259 | * Unicode character input. For regular Unicode text input, see the |
| 5260 | * [character callback](@ref glfwSetCharCallback). Like the character |
| 5261 | * callback, the character with modifiers callback deals with characters and is |
| 5262 | * keyboard layout dependent. Characters do not map 1:1 to physical keys, as |
| 5263 | * a key may produce zero, one or more characters. If you want to know whether |
| 5264 | * a specific physical key was pressed or released, see the |
| 5265 | * [key callback](@ref glfwSetKeyCallback) instead. |
| 5266 | * |
| 5267 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5268 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5269 | * callback. |
| 5270 | * @return The previously set callback, or `NULL` if no callback was set or an |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 5271 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5272 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5273 | * @callback_signature |
| 5274 | * @code |
| 5275 | * void function_name(GLFWwindow* window, unsigned int codepoint, int mods) |
| 5276 | * @endcode |
| 5277 | * For more information about the callback parameters, see the |
| 5278 | * [function pointer type](@ref GLFWcharmodsfun). |
| 5279 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 5280 | * @deprecated Scheduled for removal in version 4.0. |
| 5281 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5282 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5283 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5284 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5285 | * |
| 5286 | * @sa @ref input_char |
| 5287 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5288 | * @since Added in version 3.1. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5289 | * |
| 5290 | * @ingroup input |
| 5291 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5292 | GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback); |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5293 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5294 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5295 | * |
| 5296 | * This function sets the mouse button callback of the specified window, which |
| 5297 | * is called when a mouse button is pressed or released. |
| 5298 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5299 | * When a window loses input focus, it will generate synthetic mouse button |
Grzesiek11 | bf945f1 | 2024-02-29 15:50:50 +0000 | [diff] [blame] | 5300 | * release events for all pressed mouse buttons with associated button tokens. |
| 5301 | * You can tell these events from user-generated events by the fact that the |
| 5302 | * synthetic ones are generated after the focus loss event has been processed, |
| 5303 | * i.e. after the [window focus callback](@ref glfwSetWindowFocusCallback) has |
| 5304 | * been called. |
| 5305 | * |
| 5306 | * The reported `button` value can be higher than `GLFW_MOUSE_BUTTON_LAST` if |
| 5307 | * the button does not have an associated [button token](@ref buttons) and the |
| 5308 | * @ref GLFW_UNLIMITED_MOUSE_BUTTONS input mode is set. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 5309 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5310 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5311 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 5312 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5313 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5314 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5315 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5316 | * @callback_signature |
| 5317 | * @code |
| 5318 | * void function_name(GLFWwindow* window, int button, int action, int mods) |
| 5319 | * @endcode |
| 5320 | * For more information about the callback parameters, see the |
| 5321 | * [function pointer type](@ref GLFWmousebuttonfun). |
| 5322 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5323 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5324 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5325 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5326 | * |
| 5327 | * @sa @ref input_mouse_button |
| 5328 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5329 | * @since Added in version 1.0. |
| 5330 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5331 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5332 | * @ingroup input |
| 5333 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5334 | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5335 | |
| 5336 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5337 | * |
| 5338 | * This function sets the cursor position callback of the specified window, |
| 5339 | * which is called when the cursor is moved. The callback is provided with the |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 5340 | * position, in screen coordinates, relative to the upper-left corner of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 5341 | * content area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5342 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5343 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5344 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 5345 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5346 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5347 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5348 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5349 | * @callback_signature |
| 5350 | * @code |
| 5351 | * void function_name(GLFWwindow* window, double xpos, double ypos); |
| 5352 | * @endcode |
| 5353 | * For more information about the callback parameters, see the |
| 5354 | * [function pointer type](@ref GLFWcursorposfun). |
| 5355 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5356 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5357 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5358 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5359 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5360 | * @sa @ref cursor_pos |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5361 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5362 | * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5363 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5364 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5365 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5366 | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5367 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5368 | /*! @brief Sets the cursor enter/leave callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5369 | * |
| 5370 | * This function sets the cursor boundary crossing callback of the specified |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 5371 | * window, which is called when the cursor enters or leaves the content area of |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5372 | * the window. |
| 5373 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5374 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5375 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 5376 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5377 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5378 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5379 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5380 | * @callback_signature |
| 5381 | * @code |
| 5382 | * void function_name(GLFWwindow* window, int entered) |
| 5383 | * @endcode |
| 5384 | * For more information about the callback parameters, see the |
| 5385 | * [function pointer type](@ref GLFWcursorenterfun). |
| 5386 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5387 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5388 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5389 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5390 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5391 | * @sa @ref cursor_enter |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5392 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5393 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5394 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5395 | * @ingroup input |
| 5396 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5397 | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5398 | |
| 5399 | /*! @brief Sets the scroll callback. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5400 | * |
| 5401 | * This function sets the scroll callback of the specified window, which is |
| 5402 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
| 5403 | * area of a touchpad. |
| 5404 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5405 | * The scroll callback receives all scrolling input, like that from a mouse |
| 5406 | * wheel or a touchpad scrolling area. |
| 5407 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5408 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5409 | * @param[in] callback The new scroll callback, or `NULL` to remove the |
| 5410 | * currently set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5411 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5412 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5413 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5414 | * @callback_signature |
| 5415 | * @code |
| 5416 | * void function_name(GLFWwindow* window, double xoffset, double yoffset) |
| 5417 | * @endcode |
| 5418 | * For more information about the callback parameters, see the |
| 5419 | * [function pointer type](@ref GLFWscrollfun). |
| 5420 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5421 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5422 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5423 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5424 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5425 | * @sa @ref scrolling |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5426 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5427 | * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5428 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5429 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5430 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5431 | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5432 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5433 | /*! @brief Sets the path drop callback. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5434 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5435 | * This function sets the path drop callback of the specified window, which is |
| 5436 | * called when one or more dragged paths are dropped on the window. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5437 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5438 | * Because the path array and its strings may have been generated specifically |
| 5439 | * for that event, they are not guaranteed to be valid after the callback has |
| 5440 | * returned. If you wish to use them after the callback returns, you need to |
| 5441 | * make a deep copy. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5442 | * |
| 5443 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5444 | * @param[in] callback The new file drop callback, or `NULL` to remove the |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 5445 | * currently set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5446 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5447 | * library had not been [initialized](@ref intro_init). |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5448 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5449 | * @callback_signature |
| 5450 | * @code |
| 5451 | * void function_name(GLFWwindow* window, int path_count, const char* paths[]) |
| 5452 | * @endcode |
| 5453 | * For more information about the callback parameters, see the |
| 5454 | * [function pointer type](@ref GLFWdropfun). |
| 5455 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5456 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5457 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5458 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5459 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5460 | * @sa @ref path_drop |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5461 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5462 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5463 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5464 | * @ingroup input |
| 5465 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5466 | GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback); |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5467 | |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 5468 | /*! @brief Returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5469 | * |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 5470 | * This function returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5471 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5472 | * There is no need to call this function before other functions that accept |
| 5473 | * a joystick ID, as they all check for presence before performing any other |
| 5474 | * work. |
| 5475 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5476 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 5477 | * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5478 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5479 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5480 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5481 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5482 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5483 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5484 | * @sa @ref joystick |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5485 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5486 | * @since Added in version 3.0. Replaces `glfwGetJoystickParam`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5487 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5488 | * @ingroup input |
| 5489 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5490 | GLFWAPI int glfwJoystickPresent(int jid); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5491 | |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 5492 | /*! @brief Returns the values of all axes of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5493 | * |
| 5494 | * This function returns the values of all axes of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5495 | * Each element in the array is a value between -1.0 and 1.0. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5496 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5497 | * If the specified joystick is not present this function will return `NULL` |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5498 | * but will not generate an error. This can be used instead of first calling |
| 5499 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 5500 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5501 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5502 | * @param[out] count Where to store the number of axis values in the returned |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 5503 | * array. This is set to zero if the joystick is not present or an error |
| 5504 | * occurred. |
| 5505 | * @return An array of axis values, or `NULL` if the joystick is not present or |
| 5506 | * an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 5507 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5508 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5509 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5510 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5511 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5512 | * should not free it yourself. It is valid until the specified joystick is |
Camilla Löwy | 6801478 | 2017-02-01 04:36:38 +0100 | [diff] [blame] | 5513 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5514 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5515 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 5516 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5517 | * @sa @ref joystick_axis |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5518 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5519 | * @since Added in version 3.0. Replaces `glfwGetJoystickPos`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5520 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5521 | * @ingroup input |
| 5522 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5523 | GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5524 | |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 5525 | /*! @brief Returns the state of all buttons of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5526 | * |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 5527 | * This function returns the state of all buttons of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5528 | * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5529 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5530 | * For backward compatibility with earlier versions that did not have @ref |
| 5531 | * glfwGetJoystickHats, the button array also includes all hats, each |
| 5532 | * represented as four buttons. The hats are in the same order as returned by |
| 5533 | * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and |
| 5534 | * _left_. To disable these extra buttons, set the @ref |
| 5535 | * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization. |
| 5536 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5537 | * If the specified joystick is not present this function will return `NULL` |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5538 | * but will not generate an error. This can be used instead of first calling |
| 5539 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 5540 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5541 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5542 | * @param[out] count Where to store the number of button states in the returned |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 5543 | * array. This is set to zero if the joystick is not present or an error |
| 5544 | * occurred. |
| 5545 | * @return An array of button states, or `NULL` if the joystick is not present |
| 5546 | * or an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 5547 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5548 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5549 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5550 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5551 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5552 | * should not free it yourself. It is valid until the specified joystick is |
Camilla Löwy | 6801478 | 2017-02-01 04:36:38 +0100 | [diff] [blame] | 5553 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5554 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5555 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 5556 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5557 | * @sa @ref joystick_button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5558 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5559 | * @since Added in version 2.2. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5560 | * @glfw3 Changed to return a dynamic array. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5561 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5562 | * @ingroup input |
| 5563 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5564 | GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5565 | |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5566 | /*! @brief Returns the state of all hats of the specified joystick. |
| 5567 | * |
| 5568 | * This function returns the state of all hats of the specified joystick. |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5569 | * Each element in the array is one of the following values: |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5570 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5571 | * Name | Value |
Camilla Löwy | bb2ca1d | 2018-11-27 21:49:19 +0100 | [diff] [blame] | 5572 | * ---- | ----- |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5573 | * `GLFW_HAT_CENTERED` | 0 |
| 5574 | * `GLFW_HAT_UP` | 1 |
| 5575 | * `GLFW_HAT_RIGHT` | 2 |
| 5576 | * `GLFW_HAT_DOWN` | 4 |
| 5577 | * `GLFW_HAT_LEFT` | 8 |
| 5578 | * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` |
| 5579 | * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` |
| 5580 | * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` |
| 5581 | * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5582 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5583 | * The diagonal directions are bitwise combinations of the primary (up, right, |
| 5584 | * down and left) directions and you can test for these individually by ANDing |
| 5585 | * it with the corresponding direction. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5586 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5587 | * @code |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 5588 | * if (hats[2] & GLFW_HAT_RIGHT) |
| 5589 | * { |
| 5590 | * // State of hat 2 could be right-up, right or right-down |
| 5591 | * } |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5592 | * @endcode |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5593 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5594 | * If the specified joystick is not present this function will return `NULL` |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5595 | * but will not generate an error. This can be used instead of first calling |
| 5596 | * @ref glfwJoystickPresent. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5597 | * |
| 5598 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5599 | * @param[out] count Where to store the number of hat states in the returned |
| 5600 | * array. This is set to zero if the joystick is not present or an error |
| 5601 | * occurred. |
| 5602 | * @return An array of hat states, or `NULL` if the joystick is not present |
| 5603 | * or an [error](@ref error_handling) occurred. |
| 5604 | * |
| 5605 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5606 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5607 | * |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5608 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5609 | * should not free it yourself. It is valid until the specified joystick is |
| 5610 | * disconnected, this function is called again for that joystick or the library |
| 5611 | * is terminated. |
| 5612 | * |
| 5613 | * @thread_safety This function must only be called from the main thread. |
| 5614 | * |
| 5615 | * @sa @ref joystick_hat |
| 5616 | * |
| 5617 | * @since Added in version 3.3. |
| 5618 | * |
| 5619 | * @ingroup input |
| 5620 | */ |
| 5621 | GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count); |
| 5622 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 5623 | /*! @brief Returns the name of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5624 | * |
| 5625 | * This function returns the name, encoded as UTF-8, of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5626 | * The returned string is allocated and freed by GLFW. You should not free it |
| 5627 | * yourself. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5628 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5629 | * If the specified joystick is not present this function will return `NULL` |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5630 | * but will not generate an error. This can be used instead of first calling |
| 5631 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 5632 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5633 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5634 | * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 5635 | * is not present or an [error](@ref error_handling) occurred. |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 5636 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5637 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5638 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5639 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5640 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5641 | * should not free it yourself. It is valid until the specified joystick is |
Camilla Löwy | 6801478 | 2017-02-01 04:36:38 +0100 | [diff] [blame] | 5642 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5643 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5644 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 5645 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5646 | * @sa @ref joystick_name |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5647 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5648 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5649 | * |
| 5650 | * @ingroup input |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 5651 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5652 | GLFWAPI const char* glfwGetJoystickName(int jid); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5653 | |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 5654 | /*! @brief Returns the SDL compatible GUID of the specified joystick. |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 5655 | * |
| 5656 | * This function returns the SDL compatible GUID, as a UTF-8 encoded |
| 5657 | * hexadecimal string, of the specified joystick. The returned string is |
| 5658 | * allocated and freed by GLFW. You should not free it yourself. |
| 5659 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5660 | * The GUID is what connects a joystick to a gamepad mapping. A connected |
| 5661 | * joystick will always have a GUID even if there is no gamepad mapping |
| 5662 | * assigned to it. |
| 5663 | * |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 5664 | * If the specified joystick is not present this function will return `NULL` |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5665 | * but will not generate an error. This can be used instead of first calling |
| 5666 | * @ref glfwJoystickPresent. |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 5667 | * |
| 5668 | * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to |
| 5669 | * uniquely identify the make and model of a joystick but does not identify |
| 5670 | * a specific unit, e.g. all wired Xbox 360 controllers will have the same |
| 5671 | * GUID on that platform. The GUID for a unit may vary between platforms |
| 5672 | * depending on what hardware information the platform specific APIs provide. |
| 5673 | * |
| 5674 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5675 | * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick |
| 5676 | * is not present or an [error](@ref error_handling) occurred. |
| 5677 | * |
| 5678 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5679 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5680 | * |
| 5681 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5682 | * should not free it yourself. It is valid until the specified joystick is |
| 5683 | * disconnected or the library is terminated. |
| 5684 | * |
| 5685 | * @thread_safety This function must only be called from the main thread. |
| 5686 | * |
| 5687 | * @sa @ref gamepad |
| 5688 | * |
| 5689 | * @since Added in version 3.3. |
| 5690 | * |
| 5691 | * @ingroup input |
| 5692 | */ |
| 5693 | GLFWAPI const char* glfwGetJoystickGUID(int jid); |
| 5694 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 5695 | /*! @brief Sets the user pointer of the specified joystick. |
| 5696 | * |
| 5697 | * This function sets the user-defined pointer of the specified joystick. The |
| 5698 | * current value is retained until the joystick is disconnected. The initial |
| 5699 | * value is `NULL`. |
| 5700 | * |
| 5701 | * This function may be called from the joystick callback, even for a joystick |
| 5702 | * that is being disconnected. |
| 5703 | * |
Camilla Löwy | d222a40 | 2018-02-25 20:37:31 +0100 | [diff] [blame] | 5704 | * @param[in] jid The joystick whose pointer to set. |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 5705 | * @param[in] pointer The new value. |
| 5706 | * |
| 5707 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5708 | * |
| 5709 | * @thread_safety This function may be called from any thread. Access is not |
| 5710 | * synchronized. |
| 5711 | * |
| 5712 | * @sa @ref joystick_userptr |
| 5713 | * @sa @ref glfwGetJoystickUserPointer |
| 5714 | * |
| 5715 | * @since Added in version 3.3. |
| 5716 | * |
| 5717 | * @ingroup input |
| 5718 | */ |
| 5719 | GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer); |
| 5720 | |
| 5721 | /*! @brief Returns the user pointer of the specified joystick. |
| 5722 | * |
| 5723 | * This function returns the current value of the user-defined pointer of the |
| 5724 | * specified joystick. The initial value is `NULL`. |
| 5725 | * |
| 5726 | * This function may be called from the joystick callback, even for a joystick |
| 5727 | * that is being disconnected. |
| 5728 | * |
Camilla Löwy | d222a40 | 2018-02-25 20:37:31 +0100 | [diff] [blame] | 5729 | * @param[in] jid The joystick whose pointer to return. |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 5730 | * |
| 5731 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5732 | * |
| 5733 | * @thread_safety This function may be called from any thread. Access is not |
| 5734 | * synchronized. |
| 5735 | * |
| 5736 | * @sa @ref joystick_userptr |
| 5737 | * @sa @ref glfwSetJoystickUserPointer |
| 5738 | * |
| 5739 | * @since Added in version 3.3. |
| 5740 | * |
| 5741 | * @ingroup input |
| 5742 | */ |
| 5743 | GLFWAPI void* glfwGetJoystickUserPointer(int jid); |
| 5744 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5745 | /*! @brief Returns whether the specified joystick has a gamepad mapping. |
| 5746 | * |
| 5747 | * This function returns whether the specified joystick is both present and has |
| 5748 | * a gamepad mapping. |
| 5749 | * |
| 5750 | * If the specified joystick is present but does not have a gamepad mapping |
| 5751 | * this function will return `GLFW_FALSE` but will not generate an error. Call |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5752 | * @ref glfwJoystickPresent to check if a joystick is present regardless of |
| 5753 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5754 | * |
| 5755 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5756 | * @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping, |
| 5757 | * or `GLFW_FALSE` otherwise. |
| 5758 | * |
| 5759 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5760 | * GLFW_INVALID_ENUM. |
| 5761 | * |
| 5762 | * @thread_safety This function must only be called from the main thread. |
| 5763 | * |
| 5764 | * @sa @ref gamepad |
| 5765 | * @sa @ref glfwGetGamepadState |
| 5766 | * |
| 5767 | * @since Added in version 3.3. |
| 5768 | * |
| 5769 | * @ingroup input |
| 5770 | */ |
| 5771 | GLFWAPI int glfwJoystickIsGamepad(int jid); |
| 5772 | |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 5773 | /*! @brief Sets the joystick configuration callback. |
| 5774 | * |
| 5775 | * This function sets the joystick configuration callback, or removes the |
| 5776 | * currently set callback. This is called when a joystick is connected to or |
| 5777 | * disconnected from the system. |
| 5778 | * |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 5779 | * For joystick connection and disconnection events to be delivered on all |
| 5780 | * platforms, you need to call one of the [event processing](@ref events) |
| 5781 | * functions. Joystick disconnection may also be detected and the callback |
| 5782 | * called by joystick functions. The function will then return whatever it |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5783 | * returns if the joystick is not present. |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 5784 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5785 | * @param[in] callback The new callback, or `NULL` to remove the currently set |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 5786 | * callback. |
| 5787 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5788 | * library had not been [initialized](@ref intro_init). |
| 5789 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5790 | * @callback_signature |
| 5791 | * @code |
| 5792 | * void function_name(int jid, int event) |
| 5793 | * @endcode |
| 5794 | * For more information about the callback parameters, see the |
| 5795 | * [function pointer type](@ref GLFWjoystickfun). |
| 5796 | * |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 5797 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5798 | * |
| 5799 | * @thread_safety This function must only be called from the main thread. |
| 5800 | * |
| 5801 | * @sa @ref joystick_event |
| 5802 | * |
| 5803 | * @since Added in version 3.2. |
| 5804 | * |
| 5805 | * @ingroup input |
| 5806 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5807 | GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback); |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 5808 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5809 | /*! @brief Adds the specified SDL_GameControllerDB gamepad mappings. |
| 5810 | * |
| 5811 | * This function parses the specified ASCII encoded string and updates the |
| 5812 | * internal list with any gamepad mappings it finds. This string may |
| 5813 | * contain either a single gamepad mapping or many mappings separated by |
| 5814 | * newlines. The parser supports the full format of the `gamecontrollerdb.txt` |
| 5815 | * source file including empty lines and comments. |
| 5816 | * |
| 5817 | * See @ref gamepad_mapping for a description of the format. |
| 5818 | * |
| 5819 | * If there is already a gamepad mapping for a given GUID in the internal list, |
| 5820 | * it will be replaced by the one passed to this function. If the library is |
| 5821 | * terminated and re-initialized the internal list will revert to the built-in |
| 5822 | * default. |
| 5823 | * |
| 5824 | * @param[in] string The string containing the gamepad mappings. |
| 5825 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
| 5826 | * [error](@ref error_handling) occurred. |
| 5827 | * |
| 5828 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5829 | * GLFW_INVALID_VALUE. |
| 5830 | * |
| 5831 | * @thread_safety This function must only be called from the main thread. |
| 5832 | * |
| 5833 | * @sa @ref gamepad |
| 5834 | * @sa @ref glfwJoystickIsGamepad |
| 5835 | * @sa @ref glfwGetGamepadName |
| 5836 | * |
| 5837 | * @since Added in version 3.3. |
| 5838 | * |
| 5839 | * @ingroup input |
| 5840 | */ |
| 5841 | GLFWAPI int glfwUpdateGamepadMappings(const char* string); |
| 5842 | |
| 5843 | /*! @brief Returns the human-readable gamepad name for the specified joystick. |
| 5844 | * |
| 5845 | * This function returns the human-readable name of the gamepad from the |
| 5846 | * gamepad mapping assigned to the specified joystick. |
| 5847 | * |
| 5848 | * If the specified joystick is not present or does not have a gamepad mapping |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5849 | * this function will return `NULL` but will not generate an error. Call |
| 5850 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 5851 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5852 | * |
| 5853 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5854 | * @return The UTF-8 encoded name of the gamepad, or `NULL` if the |
| 5855 | * joystick is not present, does not have a mapping or an |
| 5856 | * [error](@ref error_handling) occurred. |
| 5857 | * |
InKryption | c19f36b | 2021-12-05 17:51:43 +0100 | [diff] [blame] | 5858 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM. |
| 5859 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5860 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5861 | * should not free it yourself. It is valid until the specified joystick is |
| 5862 | * disconnected, the gamepad mappings are updated or the library is terminated. |
| 5863 | * |
| 5864 | * @thread_safety This function must only be called from the main thread. |
| 5865 | * |
| 5866 | * @sa @ref gamepad |
| 5867 | * @sa @ref glfwJoystickIsGamepad |
| 5868 | * |
| 5869 | * @since Added in version 3.3. |
| 5870 | * |
| 5871 | * @ingroup input |
| 5872 | */ |
| 5873 | GLFWAPI const char* glfwGetGamepadName(int jid); |
| 5874 | |
| 5875 | /*! @brief Retrieves the state of the specified joystick remapped as a gamepad. |
| 5876 | * |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 5877 | * This function retrieves the state of the specified joystick remapped to |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5878 | * an Xbox-like gamepad. |
| 5879 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5880 | * If the specified joystick is not present or does not have a gamepad mapping |
| 5881 | * this function will return `GLFW_FALSE` but will not generate an error. Call |
| 5882 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 5883 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5884 | * |
| 5885 | * The Guide button may not be available for input as it is often hooked by the |
| 5886 | * system or the Steam client. |
| 5887 | * |
| 5888 | * Not all devices have all the buttons or axes provided by @ref |
| 5889 | * GLFWgamepadstate. Unavailable buttons and axes will always report |
Camilla Löwy | 34d20b0 | 2018-03-03 22:24:26 +0100 | [diff] [blame] | 5890 | * `GLFW_RELEASE` and 0.0 respectively. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5891 | * |
| 5892 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5893 | * @param[out] state The gamepad input state of the joystick. |
| 5894 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is |
| 5895 | * connected, it has no gamepad mapping or an [error](@ref error_handling) |
| 5896 | * occurred. |
| 5897 | * |
| 5898 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5899 | * GLFW_INVALID_ENUM. |
| 5900 | * |
Camilla Löwy | e1495c0 | 2018-08-09 13:57:10 +0200 | [diff] [blame] | 5901 | * @thread_safety This function must only be called from the main thread. |
| 5902 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5903 | * @sa @ref gamepad |
| 5904 | * @sa @ref glfwUpdateGamepadMappings |
| 5905 | * @sa @ref glfwJoystickIsGamepad |
| 5906 | * |
| 5907 | * @since Added in version 3.3. |
| 5908 | * |
| 5909 | * @ingroup input |
| 5910 | */ |
| 5911 | GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); |
| 5912 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5913 | /*! @brief Sets the clipboard to the specified string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5914 | * |
| 5915 | * This function sets the system clipboard to the specified, UTF-8 encoded |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5916 | * string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5917 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 5918 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5919 | * @param[in] string A UTF-8 encoded string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5920 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5921 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5922 | * GLFW_PLATFORM_ERROR. |
| 5923 | * |
Camilla Löwy | 29885c6 | 2020-01-17 03:25:54 +0100 | [diff] [blame] | 5924 | * @remark @win32 The clipboard on Windows has a single global lock for reading and |
| 5925 | * writing. GLFW tries to acquire it a few times, which is almost always enough. If it |
| 5926 | * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns. |
| 5927 | * It is safe to try this multiple times. |
| 5928 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5929 | * @pointer_lifetime The specified string is copied before this function |
| 5930 | * returns. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 5931 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5932 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5933 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5934 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5935 | * @sa @ref glfwGetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5936 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5937 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5938 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 5939 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5940 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5941 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5942 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5943 | /*! @brief Returns the contents of the clipboard as a string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5944 | * |
| 5945 | * This function returns the contents of the system clipboard, if it contains |
Camilla Berglund | cf9079c | 2015-09-16 18:51:49 +0200 | [diff] [blame] | 5946 | * or is convertible to a UTF-8 encoded string. If the clipboard is empty or |
Camilla Berglund | 0b65053 | 2015-09-16 16:27:28 +0200 | [diff] [blame] | 5947 | * if its contents cannot be converted, `NULL` is returned and a @ref |
| 5948 | * GLFW_FORMAT_UNAVAILABLE error is generated. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5949 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 5950 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5951 | * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL` |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5952 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5953 | * |
InKryption | bb19332 | 2021-11-22 23:32:29 +0000 | [diff] [blame] | 5954 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5955 | * GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5956 | * |
Camilla Löwy | 29885c6 | 2020-01-17 03:25:54 +0100 | [diff] [blame] | 5957 | * @remark @win32 The clipboard on Windows has a single global lock for reading and |
| 5958 | * writing. GLFW tries to acquire it a few times, which is almost always enough. If it |
| 5959 | * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns. |
| 5960 | * It is safe to try this multiple times. |
| 5961 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5962 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5963 | * should not free it yourself. It is valid until the next call to @ref |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 5964 | * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library |
| 5965 | * is terminated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5966 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5967 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5968 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5969 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5970 | * @sa @ref glfwSetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5971 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5972 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5973 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 5974 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5975 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5976 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 5977 | |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5978 | /*! @brief Returns the GLFW time. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5979 | * |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5980 | * This function returns the current GLFW time, in seconds. Unless the time |
| 5981 | * has been set using @ref glfwSetTime it measures time elapsed since GLFW was |
| 5982 | * initialized. |
| 5983 | * |
| 5984 | * This function and @ref glfwSetTime are helper functions on top of @ref |
| 5985 | * glfwGetTimerFrequency and @ref glfwGetTimerValue. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5986 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5987 | * The resolution of the timer is system dependent, but is usually on the order |
| 5988 | * of a few micro- or nanoseconds. It uses the highest-resolution monotonic |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 5989 | * time source on each operating system. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5990 | * |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5991 | * @return The current time, in seconds, or zero if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5992 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5993 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5994 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5995 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 5996 | * @thread_safety This function may be called from any thread. Reading and |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5997 | * writing of the internal base time is not atomic, so it needs to be |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 5998 | * externally synchronized with calls to @ref glfwSetTime. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5999 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 6000 | * @sa @ref time |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6001 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6002 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6003 | * |
| 6004 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6005 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 6006 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6007 | |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 6008 | /*! @brief Sets the GLFW time. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6009 | * |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 6010 | * This function sets the current GLFW time, in seconds. The value must be |
| 6011 | * a positive finite number less than or equal to 18446744073.0, which is |
| 6012 | * approximately 584.5 years. |
| 6013 | * |
| 6014 | * This function and @ref glfwGetTime are helper functions on top of @ref |
| 6015 | * glfwGetTimerFrequency and @ref glfwGetTimerValue. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6016 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6017 | * @param[in] time The new value, in seconds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6018 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6019 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 6020 | * GLFW_INVALID_VALUE. |
| 6021 | * |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 6022 | * @remark The upper limit of GLFW time is calculated as |
Camilla Berglund | 6e20cda | 2015-03-10 12:01:38 +0100 | [diff] [blame] | 6023 | * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations |
| 6024 | * storing nanoseconds in 64 bits. The limit may be increased in the future. |
| 6025 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 6026 | * @thread_safety This function may be called from any thread. Reading and |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 6027 | * writing of the internal base time is not atomic, so it needs to be |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 6028 | * externally synchronized with calls to @ref glfwGetTime. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 6029 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 6030 | * @sa @ref time |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6031 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6032 | * @since Added in version 2.2. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6033 | * |
| 6034 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6035 | */ |
| 6036 | GLFWAPI void glfwSetTime(double time); |
| 6037 | |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6038 | /*! @brief Returns the current value of the raw timer. |
| 6039 | * |
Camilla Berglund | 337c77a | 2016-03-06 14:11:14 +0100 | [diff] [blame] | 6040 | * This function returns the current value of the raw timer, measured in |
| 6041 | * 1 / frequency seconds. To get the frequency, call @ref |
| 6042 | * glfwGetTimerFrequency. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6043 | * |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 6044 | * @return The value of the timer, or zero if an |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6045 | * [error](@ref error_handling) occurred. |
| 6046 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 6047 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6048 | * |
| 6049 | * @thread_safety This function may be called from any thread. |
| 6050 | * |
| 6051 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6052 | * @sa @ref glfwGetTimerFrequency |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6053 | * |
| 6054 | * @since Added in version 3.2. |
| 6055 | * |
| 6056 | * @ingroup input |
| 6057 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 6058 | GLFWAPI uint64_t glfwGetTimerValue(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6059 | |
| 6060 | /*! @brief Returns the frequency, in Hz, of the raw timer. |
| 6061 | * |
Camilla Berglund | defaea3 | 2016-03-07 13:36:54 +0100 | [diff] [blame] | 6062 | * This function returns the frequency, in Hz, of the raw timer. |
| 6063 | * |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6064 | * @return The frequency of the timer, in Hz, or zero if an |
| 6065 | * [error](@ref error_handling) occurred. |
| 6066 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 6067 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6068 | * |
| 6069 | * @thread_safety This function may be called from any thread. |
| 6070 | * |
| 6071 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6072 | * @sa @ref glfwGetTimerValue |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6073 | * |
| 6074 | * @since Added in version 3.2. |
| 6075 | * |
| 6076 | * @ingroup input |
| 6077 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 6078 | GLFWAPI uint64_t glfwGetTimerFrequency(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 6079 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6080 | /*! @brief Makes the context of the specified window current for the calling |
| 6081 | * thread. |
| 6082 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6083 | * This function makes the OpenGL or OpenGL ES context of the specified window |
Camilla Löwy | 3f31519 | 2023-12-03 17:40:42 +0100 | [diff] [blame] | 6084 | * current on the calling thread. It can also detach the current context from |
| 6085 | * the calling thread without making a new one current by passing in `NULL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6086 | * |
Camilla Löwy | 3f31519 | 2023-12-03 17:40:42 +0100 | [diff] [blame] | 6087 | * A context must only be made current on a single thread at a time and each |
| 6088 | * thread can have only a single current context at a time. Making a context |
| 6089 | * current detaches any previously current context on the calling thread. |
| 6090 | * |
| 6091 | * When moving a context between threads, you must detach it (make it |
| 6092 | * non-current) on the old thread before making it current on the new one. |
Camilla Löwy | f2756d0 | 2017-11-02 19:30:12 +0100 | [diff] [blame] | 6093 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6094 | * By default, making a context non-current implicitly forces a pipeline flush. |
| 6095 | * On machines that support `GL_KHR_context_flush_control`, you can control |
| 6096 | * whether a context performs this flush by setting the |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 6097 | * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) |
| 6098 | * hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6099 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 6100 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 6101 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 6102 | * error. |
| 6103 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 6104 | * @param[in] window The window whose context to make current, or `NULL` to |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6105 | * detach the current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6106 | * |
Camilla Löwy | 3f31519 | 2023-12-03 17:40:42 +0100 | [diff] [blame] | 6107 | * @remarks If the previously current context was created via a different |
| 6108 | * context creation API than the one passed to this function, GLFW will still |
| 6109 | * detach the previous one from its API before making the new one current. |
| 6110 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6111 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6112 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 6113 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6114 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6115 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6116 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6117 | * @sa @ref glfwGetCurrentContext |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6118 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6119 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6120 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6121 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6122 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 6123 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6124 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6125 | /*! @brief Returns the window whose context is current on the calling thread. |
| 6126 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6127 | * This function returns the window whose OpenGL or OpenGL ES context is |
| 6128 | * current on the calling thread. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6129 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 6130 | * @return The window whose context is current, or `NULL` if no window's |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6131 | * context is current. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6132 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6133 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 6134 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6135 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6136 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6137 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6138 | * @sa @ref glfwMakeContextCurrent |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6139 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6140 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6141 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6142 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6143 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 6144 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6145 | |
| 6146 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6147 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6148 | * This function swaps the front and back buffers of the specified window when |
| 6149 | * rendering with OpenGL or OpenGL ES. If the swap interval is greater than |
| 6150 | * zero, the GPU driver waits the specified number of screen updates before |
| 6151 | * swapping the buffers. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6152 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 6153 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 6154 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 6155 | * error. |
| 6156 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6157 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 6158 | * see `vkQueuePresentKHR` instead. |
| 6159 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 6160 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6161 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6162 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6163 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 6164 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6165 | * @remark __EGL:__ The context of the specified window must be current on the |
Camilla Berglund | 276b1bc | 2016-01-31 19:17:18 +0100 | [diff] [blame] | 6166 | * calling thread. |
| 6167 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6168 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 6169 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 6170 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6171 | * @sa @ref glfwSwapInterval |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6172 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6173 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6174 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6175 | * |
| 6176 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6177 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 6178 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6179 | |
| 6180 | /*! @brief Sets the swap interval for the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6181 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6182 | * This function sets the swap interval for the current OpenGL or OpenGL ES |
| 6183 | * context, i.e. the number of screen updates to wait from the time @ref |
| 6184 | * glfwSwapBuffers was called before swapping the buffers and returning. This |
| 6185 | * is sometimes called _vertical synchronization_, _vertical retrace |
| 6186 | * synchronization_ or just _vsync_. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6187 | * |
Camilla Löwy | 8094a1c | 2017-11-27 15:53:59 +0100 | [diff] [blame] | 6188 | * A context that supports either of the `WGL_EXT_swap_control_tear` and |
Camilla Löwy | bfe2d42 | 2017-11-27 01:18:51 +0100 | [diff] [blame] | 6189 | * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap |
| 6190 | * intervals, which allows the driver to swap immediately even if a frame |
| 6191 | * arrives a little bit late. You can check for these extensions with @ref |
| 6192 | * glfwExtensionSupported. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 6193 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6194 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 6195 | * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6196 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6197 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 6198 | * see the present mode of your swapchain instead. |
| 6199 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 6200 | * @param[in] interval The minimum number of screen updates to wait for |
| 6201 | * until the buffers are swapped by @ref glfwSwapBuffers. |
| 6202 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6203 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6204 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 6205 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6206 | * @remark This function is not called during context creation, leaving the |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 6207 | * swap interval set to whatever is the default for that API. This is done |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 6208 | * because some swap interval extensions used by GLFW do not allow the swap |
| 6209 | * interval to be reset to zero once it has been set to a non-zero value. |
| 6210 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6211 | * @remark Some GPU drivers do not honor the requested swap interval, either |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 6212 | * because of a user setting that overrides the application's request or due to |
| 6213 | * bugs in the driver. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 6214 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6215 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6216 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 6217 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6218 | * @sa @ref glfwSwapBuffers |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6219 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6220 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6221 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6222 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6223 | */ |
| 6224 | GLFWAPI void glfwSwapInterval(int interval); |
| 6225 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6226 | /*! @brief Returns whether the specified extension is available. |
| 6227 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 6228 | * This function returns whether the specified |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6229 | * [API extension](@ref context_glext) is supported by the current OpenGL or |
| 6230 | * OpenGL ES context. It searches both for client API extension and context |
| 6231 | * creation API extensions. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6232 | * |
| 6233 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 6234 | * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6235 | * |
| 6236 | * As this functions retrieves and searches one or more extension strings each |
| 6237 | * call, it is recommended that you cache its results if it is going to be used |
| 6238 | * frequently. The extension strings will not change during the lifetime of |
| 6239 | * a context, so there is no danger in doing this. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6240 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6241 | * This function does not apply to Vulkan. If you are using Vulkan, see @ref |
| 6242 | * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties` |
| 6243 | * and `vkEnumerateDeviceExtensionProperties` instead. |
| 6244 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6245 | * @param[in] extension The ASCII encoded name of the extension. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 6246 | * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` |
| 6247 | * otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6248 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6249 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6250 | * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref |
| 6251 | * GLFW_PLATFORM_ERROR. |
| 6252 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6253 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6254 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6255 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6256 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6257 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6258 | * @since Added in version 1.0. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6259 | * |
| 6260 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6261 | */ |
| 6262 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 6263 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6264 | /*! @brief Returns the address of the specified function for the current |
| 6265 | * context. |
| 6266 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6267 | * This function returns the address of the specified OpenGL or OpenGL ES |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 6268 | * [core or extension function](@ref context_glext), if it is supported |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 6269 | * by the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6270 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6271 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 6272 | * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6273 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6274 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 6275 | * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and |
| 6276 | * `vkGetDeviceProcAddr` instead. |
| 6277 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6278 | * @param[in] procname The ASCII encoded name of the function. |
Camilla Berglund | a36e3a2 | 2015-11-05 17:14:26 +0100 | [diff] [blame] | 6279 | * @return The address of the function, or `NULL` if an |
| 6280 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6281 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6282 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6283 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 6284 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6285 | * @remark The address of a given function is not guaranteed to be the same |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6286 | * between contexts. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6287 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6288 | * @remark This function may return a non-`NULL` address despite the |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 6289 | * associated version or extension not being available. Always check the |
Camilla Berglund | c8e0687 | 2015-08-27 21:40:22 +0200 | [diff] [blame] | 6290 | * context version or extension string first. |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 6291 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6292 | * @pointer_lifetime The returned function pointer is valid until the context |
| 6293 | * is destroyed or the library is terminated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6294 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6295 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6296 | * |
| 6297 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6298 | * @sa @ref glfwExtensionSupported |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6299 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6300 | * @since Added in version 1.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6301 | * |
| 6302 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6303 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 6304 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6305 | |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6306 | /*! @brief Returns whether the Vulkan loader and an ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6307 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6308 | * This function returns whether the Vulkan loader and any minimally functional |
| 6309 | * ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6310 | * |
Camilla Löwy | 4be0444 | 2021-10-12 12:54:19 +0200 | [diff] [blame] | 6311 | * The availability of a Vulkan loader and even an ICD does not by itself guarantee that |
| 6312 | * surface creation or even instance creation is possible. Call @ref |
| 6313 | * glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan |
| 6314 | * surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to |
| 6315 | * check whether a queue family of a physical device supports image presentation. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6316 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6317 | * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` |
| 6318 | * otherwise. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6319 | * |
| 6320 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 6321 | * |
| 6322 | * @thread_safety This function may be called from any thread. |
| 6323 | * |
| 6324 | * @sa @ref vulkan_support |
| 6325 | * |
| 6326 | * @since Added in version 3.2. |
| 6327 | * |
| 6328 | * @ingroup vulkan |
| 6329 | */ |
| 6330 | GLFWAPI int glfwVulkanSupported(void); |
| 6331 | |
| 6332 | /*! @brief Returns the Vulkan instance extensions required by GLFW. |
| 6333 | * |
| 6334 | * This function returns an array of names of Vulkan instance extensions required |
| 6335 | * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the |
Lukas Zanner | 84b1311 | 2019-06-14 12:53:57 +0200 | [diff] [blame] | 6336 | * list will always contain `VK_KHR_surface`, so if you don't require any |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6337 | * additional extensions you can pass this list directly to the |
| 6338 | * `VkInstanceCreateInfo` struct. |
| 6339 | * |
| 6340 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 6341 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6342 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6343 | * |
| 6344 | * If Vulkan is available but no set of extensions allowing window surface |
| 6345 | * creation was found, this function returns `NULL`. You may still use Vulkan |
| 6346 | * for off-screen rendering and compute work. |
| 6347 | * |
| 6348 | * @param[out] count Where to store the number of extensions in the returned |
| 6349 | * array. This is set to zero if an error occurred. |
| 6350 | * @return An array of ASCII encoded extension names, or `NULL` if an |
| 6351 | * [error](@ref error_handling) occurred. |
| 6352 | * |
| 6353 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 6354 | * GLFW_API_UNAVAILABLE. |
| 6355 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 6356 | * @remark Additional extensions may be required by future versions of GLFW. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6357 | * You should check if any extensions you wish to enable are already in the |
| 6358 | * returned array, as it is an error to specify an extension more than once in |
| 6359 | * the `VkInstanceCreateInfo` struct. |
| 6360 | * |
| 6361 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 6362 | * should not free it yourself. It is guaranteed to be valid only until the |
| 6363 | * library is terminated. |
| 6364 | * |
| 6365 | * @thread_safety This function may be called from any thread. |
| 6366 | * |
| 6367 | * @sa @ref vulkan_ext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6368 | * @sa @ref glfwCreateWindowSurface |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6369 | * |
| 6370 | * @since Added in version 3.2. |
| 6371 | * |
| 6372 | * @ingroup vulkan |
| 6373 | */ |
Camilla Berglund | 7ab7d8b | 2016-03-23 10:24:01 +0100 | [diff] [blame] | 6374 | GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count); |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6375 | |
| 6376 | #if defined(VK_VERSION_1_0) |
| 6377 | |
| 6378 | /*! @brief Returns the address of the specified Vulkan instance function. |
| 6379 | * |
| 6380 | * This function returns the address of the specified Vulkan core or extension |
| 6381 | * function for the specified instance. If instance is set to `NULL` it can |
| 6382 | * return any function exported from the Vulkan loader, including at least the |
| 6383 | * following functions: |
| 6384 | * |
| 6385 | * - `vkEnumerateInstanceExtensionProperties` |
| 6386 | * - `vkEnumerateInstanceLayerProperties` |
| 6387 | * - `vkCreateInstance` |
| 6388 | * - `vkGetInstanceProcAddr` |
| 6389 | * |
| 6390 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 6391 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6392 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6393 | * |
| 6394 | * This function is equivalent to calling `vkGetInstanceProcAddr` with |
| 6395 | * a platform-specific query of the Vulkan loader as a fallback. |
| 6396 | * |
| 6397 | * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve |
| 6398 | * functions related to instance creation. |
| 6399 | * @param[in] procname The ASCII encoded name of the function. |
| 6400 | * @return The address of the function, or `NULL` if an |
| 6401 | * [error](@ref error_handling) occurred. |
| 6402 | * |
| 6403 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 6404 | * GLFW_API_UNAVAILABLE. |
| 6405 | * |
| 6406 | * @pointer_lifetime The returned function pointer is valid until the library |
| 6407 | * is terminated. |
| 6408 | * |
| 6409 | * @thread_safety This function may be called from any thread. |
| 6410 | * |
| 6411 | * @sa @ref vulkan_proc |
| 6412 | * |
| 6413 | * @since Added in version 3.2. |
| 6414 | * |
| 6415 | * @ingroup vulkan |
| 6416 | */ |
| 6417 | GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); |
| 6418 | |
| 6419 | /*! @brief Returns whether the specified queue family can present images. |
| 6420 | * |
| 6421 | * This function returns whether the specified queue family of the specified |
| 6422 | * physical device supports presentation to the platform GLFW was built for. |
| 6423 | * |
| 6424 | * If Vulkan or the required window surface creation instance extensions are |
| 6425 | * not available on the machine, or if the specified instance was not created |
| 6426 | * with the required extensions, this function returns `GLFW_FALSE` and |
| 6427 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6428 | * to check whether Vulkan is at least minimally available and @ref |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6429 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 6430 | * required. |
| 6431 | * |
| 6432 | * @param[in] instance The instance that the physical device belongs to. |
| 6433 | * @param[in] device The physical device that the queue family belongs to. |
| 6434 | * @param[in] queuefamily The index of the queue family to query. |
| 6435 | * @return `GLFW_TRUE` if the queue family supports presentation, or |
| 6436 | * `GLFW_FALSE` otherwise. |
| 6437 | * |
| 6438 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6439 | * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
| 6440 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 6441 | * @remark @macos This function currently always returns `GLFW_TRUE`, as the |
Camilla Löwy | 4c90e21 | 2020-12-10 00:28:09 +0100 | [diff] [blame] | 6442 | * `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 6443 | * a `vkGetPhysicalDevice*PresentationSupport` type function. |
| 6444 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6445 | * @thread_safety This function may be called from any thread. For |
| 6446 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 6447 | * |
| 6448 | * @sa @ref vulkan_present |
| 6449 | * |
| 6450 | * @since Added in version 3.2. |
| 6451 | * |
| 6452 | * @ingroup vulkan |
| 6453 | */ |
| 6454 | GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); |
| 6455 | |
| 6456 | /*! @brief Creates a Vulkan surface for the specified window. |
| 6457 | * |
| 6458 | * This function creates a Vulkan surface for the specified window. |
| 6459 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6460 | * If the Vulkan loader or at least one minimally functional ICD were not found, |
| 6461 | * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref |
| 6462 | * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether |
| 6463 | * Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6464 | * |
| 6465 | * If the required window surface creation instance extensions are not |
| 6466 | * available or if the specified instance was not created with these extensions |
| 6467 | * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and |
| 6468 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref |
| 6469 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 6470 | * required. |
| 6471 | * |
Corentin Wallez | 8a8eefa | 2018-01-30 13:25:17 -0500 | [diff] [blame] | 6472 | * The window surface cannot be shared with another API so the window must |
| 6473 | * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib) |
| 6474 | * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error |
| 6475 | * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`. |
| 6476 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6477 | * The window surface must be destroyed before the specified Vulkan instance. |
| 6478 | * It is the responsibility of the caller to destroy the window surface. GLFW |
| 6479 | * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the |
| 6480 | * surface. |
| 6481 | * |
| 6482 | * @param[in] instance The Vulkan instance to create the surface in. |
| 6483 | * @param[in] window The window to create the surface for. |
| 6484 | * @param[in] allocator The allocator to use, or `NULL` to use the default |
| 6485 | * allocator. |
| 6486 | * @param[out] surface Where to store the handle of the surface. This is set |
| 6487 | * to `VK_NULL_HANDLE` if an error occurred. |
| 6488 | * @return `VK_SUCCESS` if successful, or a Vulkan error code if an |
| 6489 | * [error](@ref error_handling) occurred. |
| 6490 | * |
| 6491 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Corentin Wallez | 8a8eefa | 2018-01-30 13:25:17 -0500 | [diff] [blame] | 6492 | * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6493 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 6494 | * @remark If an error occurs before the creation call is made, GLFW returns |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6495 | * the Vulkan error code most appropriate for the error. Appropriate use of |
| 6496 | * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should |
Camilla Berglund | ee33dcd | 2016-03-07 14:42:51 +0100 | [diff] [blame] | 6497 | * eliminate almost all occurrences of these errors. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6498 | * |
Camilla Löwy | 05b0e2f | 2021-12-26 18:02:00 +0100 | [diff] [blame] | 6499 | * @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the |
| 6500 | * `VK_MVK_macos_surface` extension as a fallback. The name of the selected |
| 6501 | * extension, if any, is included in the array returned by @ref |
| 6502 | * glfwGetRequiredInstanceExtensions. |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 6503 | * |
| 6504 | * @remark @macos This function creates and sets a `CAMetalLayer` instance for |
| 6505 | * the window content view, which is required for MoltenVK to function. |
| 6506 | * |
Camilla Löwy | 05b0e2f | 2021-12-26 18:02:00 +0100 | [diff] [blame] | 6507 | * @remark @x11 By default GLFW prefers the `VK_KHR_xcb_surface` extension, |
| 6508 | * with the `VK_KHR_xlib_surface` extension as a fallback. You can make |
| 6509 | * `VK_KHR_xlib_surface` the preferred extension by setting the |
Camilla Löwy | a25e8eb | 2020-12-10 00:11:44 +0100 | [diff] [blame] | 6510 | * [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init |
Camilla Löwy | 05b0e2f | 2021-12-26 18:02:00 +0100 | [diff] [blame] | 6511 | * hint. The name of the selected extension, if any, is included in the array |
| 6512 | * returned by @ref glfwGetRequiredInstanceExtensions. |
Camilla Löwy | a25e8eb | 2020-12-10 00:11:44 +0100 | [diff] [blame] | 6513 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6514 | * @thread_safety This function may be called from any thread. For |
| 6515 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 6516 | * |
| 6517 | * @sa @ref vulkan_surface |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6518 | * @sa @ref glfwGetRequiredInstanceExtensions |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6519 | * |
| 6520 | * @since Added in version 3.2. |
| 6521 | * |
| 6522 | * @ingroup vulkan |
| 6523 | */ |
| 6524 | GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); |
| 6525 | |
| 6526 | #endif /*VK_VERSION_1_0*/ |
| 6527 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6528 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 6529 | /************************************************************************* |
| 6530 | * Global definition cleanup |
| 6531 | *************************************************************************/ |
| 6532 | |
| 6533 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 6534 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 6535 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 6536 | #undef WINGDIAPI |
| 6537 | #undef GLFW_WINGDIAPI_DEFINED |
| 6538 | #endif |
| 6539 | |
| 6540 | #ifdef GLFW_CALLBACK_DEFINED |
| 6541 | #undef CALLBACK |
| 6542 | #undef GLFW_CALLBACK_DEFINED |
| 6543 | #endif |
| 6544 | |
Camilla Löwy | be51c20 | 2017-07-03 14:25:47 +0200 | [diff] [blame] | 6545 | /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally |
| 6546 | * defined by some gl.h variants (OpenBSD) so define it after if needed. |
| 6547 | */ |
| 6548 | #ifndef GLAPIENTRY |
| 6549 | #define GLAPIENTRY APIENTRY |
Camilla Löwy | ce85c7d | 2022-05-03 19:54:08 +0200 | [diff] [blame] | 6550 | #define GLFW_GLAPIENTRY_DEFINED |
Camilla Löwy | be51c20 | 2017-07-03 14:25:47 +0200 | [diff] [blame] | 6551 | #endif |
| 6552 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 6553 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 6554 | |
| 6555 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6556 | #ifdef __cplusplus |
| 6557 | } |
| 6558 | #endif |
| 6559 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 6560 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6561 | |