Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 1 | /************************************************************************* |
Camilla Löwy | a337c56 | 2019-04-16 14:43:29 +0200 | [diff] [blame] | 2 | * GLFW 3.4 - 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 | a337c56 | 2019-04-16 14:43:29 +0200 | [diff] [blame] | 294 | #define GLFW_VERSION_MINOR 4 |
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) |
| 364 | /*! @} */ |
| 365 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 366 | /*! @defgroup keys Keyboard keys |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 367 | * @brief Keyboard key IDs. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 368 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 369 | * See [key input](@ref input_key) for how these are used. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 370 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 371 | * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), |
| 372 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
| 373 | * put in the 256+ range). |
| 374 | * |
| 375 | * The naming of the key codes follow these rules: |
| 376 | * - The US keyboard layout is used |
luz paz | 0fe96ec | 2021-09-15 08:20:56 -0400 | [diff] [blame] | 377 | * - Names of printable alphanumeric characters are used (e.g. "A", "R", |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 378 | * "3", etc.) |
| 379 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
| 380 | * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not |
| 381 | * correspond to the Unicode standard (usually for brevity) |
| 382 | * - Keys that lack a clear US mapping are named "WORLD_x" |
| 383 | * - For non-printable keys, custom names are used (e.g. "F4", |
| 384 | * "BACKSPACE", etc.) |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 385 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 386 | * @ingroup input |
| 387 | * @{ |
| 388 | */ |
| 389 | |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 390 | /* The unknown key */ |
| 391 | #define GLFW_KEY_UNKNOWN -1 |
| 392 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 393 | /* Printable keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 394 | #define GLFW_KEY_SPACE 32 |
| 395 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
| 396 | #define GLFW_KEY_COMMA 44 /* , */ |
| 397 | #define GLFW_KEY_MINUS 45 /* - */ |
| 398 | #define GLFW_KEY_PERIOD 46 /* . */ |
| 399 | #define GLFW_KEY_SLASH 47 /* / */ |
| 400 | #define GLFW_KEY_0 48 |
| 401 | #define GLFW_KEY_1 49 |
| 402 | #define GLFW_KEY_2 50 |
| 403 | #define GLFW_KEY_3 51 |
| 404 | #define GLFW_KEY_4 52 |
| 405 | #define GLFW_KEY_5 53 |
| 406 | #define GLFW_KEY_6 54 |
| 407 | #define GLFW_KEY_7 55 |
| 408 | #define GLFW_KEY_8 56 |
| 409 | #define GLFW_KEY_9 57 |
| 410 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
| 411 | #define GLFW_KEY_EQUAL 61 /* = */ |
| 412 | #define GLFW_KEY_A 65 |
| 413 | #define GLFW_KEY_B 66 |
| 414 | #define GLFW_KEY_C 67 |
| 415 | #define GLFW_KEY_D 68 |
| 416 | #define GLFW_KEY_E 69 |
| 417 | #define GLFW_KEY_F 70 |
| 418 | #define GLFW_KEY_G 71 |
| 419 | #define GLFW_KEY_H 72 |
| 420 | #define GLFW_KEY_I 73 |
| 421 | #define GLFW_KEY_J 74 |
| 422 | #define GLFW_KEY_K 75 |
| 423 | #define GLFW_KEY_L 76 |
| 424 | #define GLFW_KEY_M 77 |
| 425 | #define GLFW_KEY_N 78 |
| 426 | #define GLFW_KEY_O 79 |
| 427 | #define GLFW_KEY_P 80 |
| 428 | #define GLFW_KEY_Q 81 |
| 429 | #define GLFW_KEY_R 82 |
| 430 | #define GLFW_KEY_S 83 |
| 431 | #define GLFW_KEY_T 84 |
| 432 | #define GLFW_KEY_U 85 |
| 433 | #define GLFW_KEY_V 86 |
| 434 | #define GLFW_KEY_W 87 |
| 435 | #define GLFW_KEY_X 88 |
| 436 | #define GLFW_KEY_Y 89 |
| 437 | #define GLFW_KEY_Z 90 |
| 438 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
| 439 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
| 440 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
| 441 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
| 442 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
| 443 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 444 | |
| 445 | /* Function keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 446 | #define GLFW_KEY_ESCAPE 256 |
| 447 | #define GLFW_KEY_ENTER 257 |
| 448 | #define GLFW_KEY_TAB 258 |
| 449 | #define GLFW_KEY_BACKSPACE 259 |
| 450 | #define GLFW_KEY_INSERT 260 |
| 451 | #define GLFW_KEY_DELETE 261 |
| 452 | #define GLFW_KEY_RIGHT 262 |
| 453 | #define GLFW_KEY_LEFT 263 |
| 454 | #define GLFW_KEY_DOWN 264 |
| 455 | #define GLFW_KEY_UP 265 |
| 456 | #define GLFW_KEY_PAGE_UP 266 |
| 457 | #define GLFW_KEY_PAGE_DOWN 267 |
| 458 | #define GLFW_KEY_HOME 268 |
| 459 | #define GLFW_KEY_END 269 |
| 460 | #define GLFW_KEY_CAPS_LOCK 280 |
| 461 | #define GLFW_KEY_SCROLL_LOCK 281 |
| 462 | #define GLFW_KEY_NUM_LOCK 282 |
| 463 | #define GLFW_KEY_PRINT_SCREEN 283 |
| 464 | #define GLFW_KEY_PAUSE 284 |
| 465 | #define GLFW_KEY_F1 290 |
| 466 | #define GLFW_KEY_F2 291 |
| 467 | #define GLFW_KEY_F3 292 |
| 468 | #define GLFW_KEY_F4 293 |
| 469 | #define GLFW_KEY_F5 294 |
| 470 | #define GLFW_KEY_F6 295 |
| 471 | #define GLFW_KEY_F7 296 |
| 472 | #define GLFW_KEY_F8 297 |
| 473 | #define GLFW_KEY_F9 298 |
| 474 | #define GLFW_KEY_F10 299 |
| 475 | #define GLFW_KEY_F11 300 |
| 476 | #define GLFW_KEY_F12 301 |
| 477 | #define GLFW_KEY_F13 302 |
| 478 | #define GLFW_KEY_F14 303 |
| 479 | #define GLFW_KEY_F15 304 |
| 480 | #define GLFW_KEY_F16 305 |
| 481 | #define GLFW_KEY_F17 306 |
| 482 | #define GLFW_KEY_F18 307 |
| 483 | #define GLFW_KEY_F19 308 |
| 484 | #define GLFW_KEY_F20 309 |
| 485 | #define GLFW_KEY_F21 310 |
| 486 | #define GLFW_KEY_F22 311 |
| 487 | #define GLFW_KEY_F23 312 |
| 488 | #define GLFW_KEY_F24 313 |
| 489 | #define GLFW_KEY_F25 314 |
| 490 | #define GLFW_KEY_KP_0 320 |
| 491 | #define GLFW_KEY_KP_1 321 |
| 492 | #define GLFW_KEY_KP_2 322 |
| 493 | #define GLFW_KEY_KP_3 323 |
| 494 | #define GLFW_KEY_KP_4 324 |
| 495 | #define GLFW_KEY_KP_5 325 |
| 496 | #define GLFW_KEY_KP_6 326 |
| 497 | #define GLFW_KEY_KP_7 327 |
| 498 | #define GLFW_KEY_KP_8 328 |
| 499 | #define GLFW_KEY_KP_9 329 |
| 500 | #define GLFW_KEY_KP_DECIMAL 330 |
| 501 | #define GLFW_KEY_KP_DIVIDE 331 |
| 502 | #define GLFW_KEY_KP_MULTIPLY 332 |
| 503 | #define GLFW_KEY_KP_SUBTRACT 333 |
| 504 | #define GLFW_KEY_KP_ADD 334 |
| 505 | #define GLFW_KEY_KP_ENTER 335 |
| 506 | #define GLFW_KEY_KP_EQUAL 336 |
| 507 | #define GLFW_KEY_LEFT_SHIFT 340 |
| 508 | #define GLFW_KEY_LEFT_CONTROL 341 |
| 509 | #define GLFW_KEY_LEFT_ALT 342 |
| 510 | #define GLFW_KEY_LEFT_SUPER 343 |
| 511 | #define GLFW_KEY_RIGHT_SHIFT 344 |
| 512 | #define GLFW_KEY_RIGHT_CONTROL 345 |
| 513 | #define GLFW_KEY_RIGHT_ALT 346 |
| 514 | #define GLFW_KEY_RIGHT_SUPER 347 |
| 515 | #define GLFW_KEY_MENU 348 |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 516 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 517 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 518 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 519 | /*! @} */ |
| 520 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 521 | /*! @defgroup mods Modifier key flags |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 522 | * @brief Modifier key flags. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 523 | * |
| 524 | * See [key input](@ref input_key) for how these are used. |
| 525 | * |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 526 | * @ingroup input |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 527 | * @{ */ |
| 528 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 529 | /*! @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] | 530 | * |
| 531 | * 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] | 532 | */ |
| 533 | #define GLFW_MOD_SHIFT 0x0001 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 534 | /*! @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] | 535 | * |
| 536 | * 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] | 537 | */ |
Camilla Berglund | 3bcffba | 2013-05-23 14:11:05 +0200 | [diff] [blame] | 538 | #define GLFW_MOD_CONTROL 0x0002 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 539 | /*! @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] | 540 | * |
| 541 | * 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] | 542 | */ |
| 543 | #define GLFW_MOD_ALT 0x0004 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 544 | /*! @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] | 545 | * |
| 546 | * 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] | 547 | */ |
| 548 | #define GLFW_MOD_SUPER 0x0008 |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 549 | /*! @brief If this bit is set the Caps Lock key is enabled. |
| 550 | * |
| 551 | * If this bit is set the Caps Lock key is enabled and the @ref |
| 552 | * GLFW_LOCK_KEY_MODS input mode is set. |
| 553 | */ |
| 554 | #define GLFW_MOD_CAPS_LOCK 0x0010 |
| 555 | /*! @brief If this bit is set the Num Lock key is enabled. |
| 556 | * |
| 557 | * If this bit is set the Num Lock key is enabled and the @ref |
| 558 | * GLFW_LOCK_KEY_MODS input mode is set. |
| 559 | */ |
| 560 | #define GLFW_MOD_NUM_LOCK 0x0020 |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 561 | |
| 562 | /*! @} */ |
| 563 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 564 | /*! @defgroup buttons Mouse buttons |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 565 | * @brief Mouse button IDs. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 566 | * |
| 567 | * See [mouse button input](@ref input_mouse_button) for how these are used. |
| 568 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 569 | * @ingroup input |
| 570 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 571 | #define GLFW_MOUSE_BUTTON_1 0 |
| 572 | #define GLFW_MOUSE_BUTTON_2 1 |
| 573 | #define GLFW_MOUSE_BUTTON_3 2 |
| 574 | #define GLFW_MOUSE_BUTTON_4 3 |
| 575 | #define GLFW_MOUSE_BUTTON_5 4 |
| 576 | #define GLFW_MOUSE_BUTTON_6 5 |
| 577 | #define GLFW_MOUSE_BUTTON_7 6 |
| 578 | #define GLFW_MOUSE_BUTTON_8 7 |
| 579 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
| 580 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
| 581 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
| 582 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 583 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 584 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 585 | /*! @defgroup joysticks Joysticks |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 586 | * @brief Joystick IDs. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 587 | * |
| 588 | * See [joystick input](@ref joystick) for how these are used. |
| 589 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 590 | * @ingroup input |
| 591 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 592 | #define GLFW_JOYSTICK_1 0 |
| 593 | #define GLFW_JOYSTICK_2 1 |
| 594 | #define GLFW_JOYSTICK_3 2 |
| 595 | #define GLFW_JOYSTICK_4 3 |
| 596 | #define GLFW_JOYSTICK_5 4 |
| 597 | #define GLFW_JOYSTICK_6 5 |
| 598 | #define GLFW_JOYSTICK_7 6 |
| 599 | #define GLFW_JOYSTICK_8 7 |
| 600 | #define GLFW_JOYSTICK_9 8 |
| 601 | #define GLFW_JOYSTICK_10 9 |
| 602 | #define GLFW_JOYSTICK_11 10 |
| 603 | #define GLFW_JOYSTICK_12 11 |
| 604 | #define GLFW_JOYSTICK_13 12 |
| 605 | #define GLFW_JOYSTICK_14 13 |
| 606 | #define GLFW_JOYSTICK_15 14 |
| 607 | #define GLFW_JOYSTICK_16 15 |
| 608 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 609 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 610 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 611 | /*! @defgroup gamepad_buttons Gamepad buttons |
| 612 | * @brief Gamepad buttons. |
| 613 | * |
| 614 | * See @ref gamepad for how these are used. |
| 615 | * |
| 616 | * @ingroup input |
| 617 | * @{ */ |
| 618 | #define GLFW_GAMEPAD_BUTTON_A 0 |
| 619 | #define GLFW_GAMEPAD_BUTTON_B 1 |
| 620 | #define GLFW_GAMEPAD_BUTTON_X 2 |
| 621 | #define GLFW_GAMEPAD_BUTTON_Y 3 |
| 622 | #define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4 |
| 623 | #define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5 |
| 624 | #define GLFW_GAMEPAD_BUTTON_BACK 6 |
| 625 | #define GLFW_GAMEPAD_BUTTON_START 7 |
| 626 | #define GLFW_GAMEPAD_BUTTON_GUIDE 8 |
| 627 | #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9 |
| 628 | #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10 |
| 629 | #define GLFW_GAMEPAD_BUTTON_DPAD_UP 11 |
| 630 | #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12 |
| 631 | #define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13 |
| 632 | #define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14 |
| 633 | #define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT |
| 634 | |
| 635 | #define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A |
| 636 | #define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B |
| 637 | #define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X |
| 638 | #define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y |
| 639 | /*! @} */ |
| 640 | |
| 641 | /*! @defgroup gamepad_axes Gamepad axes |
| 642 | * @brief Gamepad axes. |
| 643 | * |
| 644 | * See @ref gamepad for how these are used. |
| 645 | * |
| 646 | * @ingroup input |
| 647 | * @{ */ |
| 648 | #define GLFW_GAMEPAD_AXIS_LEFT_X 0 |
| 649 | #define GLFW_GAMEPAD_AXIS_LEFT_Y 1 |
| 650 | #define GLFW_GAMEPAD_AXIS_RIGHT_X 2 |
| 651 | #define GLFW_GAMEPAD_AXIS_RIGHT_Y 3 |
| 652 | #define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4 |
| 653 | #define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5 |
| 654 | #define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER |
| 655 | /*! @} */ |
| 656 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 657 | /*! @defgroup errors Error codes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 658 | * @brief Error codes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 659 | * |
| 660 | * See [error handling](@ref error_handling) for how these are used. |
| 661 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 662 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 663 | * @{ */ |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 664 | /*! @brief No error has occurred. |
| 665 | * |
| 666 | * No error has occurred. |
| 667 | * |
| 668 | * @analysis Yay. |
| 669 | */ |
| 670 | #define GLFW_NO_ERROR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 671 | /*! @brief GLFW has not been initialized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 672 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 673 | * 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] | 674 | * library is [initialized](@ref intro_init). |
| 675 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 676 | * @analysis Application programmer error. Initialize GLFW before calling any |
| 677 | * function that requires initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 678 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 679 | #define GLFW_NOT_INITIALIZED 0x00010001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 680 | /*! @brief No context is current for this thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 681 | * |
| 682 | * This occurs if a GLFW function was called that needs and operates on the |
| 683 | * current OpenGL or OpenGL ES context but no context is current on the calling |
| 684 | * thread. One such function is @ref glfwSwapInterval. |
| 685 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 686 | * @analysis Application programmer error. Ensure a context is current before |
| 687 | * calling functions that require a current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 688 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 689 | #define GLFW_NO_CURRENT_CONTEXT 0x00010002 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 690 | /*! @brief One of the arguments to the function was an invalid enum value. |
| 691 | * |
| 692 | * 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] | 693 | * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 694 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 695 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 696 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 697 | #define GLFW_INVALID_ENUM 0x00010003 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 698 | /*! @brief One of the arguments to the function was an invalid value. |
| 699 | * |
| 700 | * One of the arguments to the function was an invalid value, for example |
| 701 | * requesting a non-existent OpenGL or OpenGL ES version like 2.7. |
| 702 | * |
| 703 | * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead |
| 704 | * result in a @ref GLFW_VERSION_UNAVAILABLE error. |
| 705 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 706 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 707 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 708 | #define GLFW_INVALID_VALUE 0x00010004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 709 | /*! @brief A memory allocation failed. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 710 | * |
| 711 | * A memory allocation failed. |
| 712 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 713 | * @analysis A bug in GLFW or the underlying operating system. Report the bug |
| 714 | * to our [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 715 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 716 | #define GLFW_OUT_OF_MEMORY 0x00010005 |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 717 | /*! @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] | 718 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 719 | * 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 | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 721 | * @analysis The installed graphics driver does not support the requested |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 722 | * API, or does not support it via the chosen context creation API. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 723 | * Below are a few examples. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 724 | * |
| 725 | * @par |
| 726 | * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only |
Camilla Berglund | d95b79f | 2015-03-30 23:20:49 +0200 | [diff] [blame] | 727 | * 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] | 728 | * 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] | 729 | * 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] | 730 | * driver. Older graphics drivers do not support Vulkan. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 731 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 732 | #define GLFW_API_UNAVAILABLE 0x00010006 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 733 | /*! @brief The requested OpenGL or OpenGL ES version is not available. |
| 734 | * |
Camilla Berglund | d493a82 | 2015-03-10 19:51:14 +0100 | [diff] [blame] | 735 | * The requested OpenGL or OpenGL ES version (including any requested context |
| 736 | * or framebuffer hints) is not available on this machine. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 737 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 738 | * @analysis The machine does not support your requirements. If your |
| 739 | * application is sufficiently flexible, downgrade your requirements and try |
| 740 | * again. Otherwise, inform the user that their machine does not match your |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 741 | * requirements. |
| 742 | * |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 743 | * @par |
| 744 | * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 |
| 745 | * comes out before the 4.x series gets that far, also fail with this error and |
| 746 | * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions |
| 747 | * will exist. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 748 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 749 | #define GLFW_VERSION_UNAVAILABLE 0x00010007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 750 | /*! @brief A platform-specific error occurred that does not match any of the |
| 751 | * more specific categories. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 752 | * |
| 753 | * A platform-specific error occurred that does not match any of the more |
| 754 | * specific categories. |
| 755 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 756 | * @analysis A bug or configuration error in GLFW, the underlying operating |
| 757 | * system or its drivers, or a lack of required resources. Report the issue to |
| 758 | * our [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 759 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 760 | #define GLFW_PLATFORM_ERROR 0x00010008 |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 761 | /*! @brief The requested format is not supported or available. |
| 762 | * |
| 763 | * If emitted during window creation, the requested pixel format is not |
| 764 | * supported. |
| 765 | * |
| 766 | * If emitted when querying the clipboard, the contents of the clipboard could |
| 767 | * not be converted to the requested format. |
| 768 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 769 | * @analysis If emitted during window creation, one or more |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 770 | * [hard constraints](@ref window_hints_hard) did not match any of the |
| 771 | * available pixel formats. If your application is sufficiently flexible, |
| 772 | * downgrade your requirements and try again. Otherwise, inform the user that |
| 773 | * their machine does not match your requirements. |
| 774 | * |
| 775 | * @par |
| 776 | * If emitted when querying the clipboard, ignore the error or report it to |
| 777 | * the user, as appropriate. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 778 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 779 | #define GLFW_FORMAT_UNAVAILABLE 0x00010009 |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 780 | /*! @brief The specified window does not have an OpenGL or OpenGL ES context. |
| 781 | * |
| 782 | * A window that does not have an OpenGL or OpenGL ES context was passed to |
| 783 | * a function that requires it to have one. |
| 784 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 785 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 786 | */ |
| 787 | #define GLFW_NO_WINDOW_CONTEXT 0x0001000A |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 788 | /*! @brief The specified cursor shape is not available. |
| 789 | * |
| 790 | * The specified standard cursor shape is not available, either because the |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 791 | * 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] | 792 | * available on the platform. |
| 793 | * |
| 794 | * @analysis Platform or system settings limitation. Pick another |
| 795 | * [standard cursor shape](@ref shapes) or create a |
| 796 | * [custom cursor](@ref cursor_custom). |
| 797 | */ |
| 798 | #define GLFW_CURSOR_UNAVAILABLE 0x0001000B |
Luflosi | b66f105 | 2020-06-23 16:20:27 +0200 | [diff] [blame] | 799 | /*! @brief The requested feature is not provided by the platform. |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 800 | * |
| 801 | * The requested feature is not provided by the platform, so GLFW is unable to |
| 802 | * implement it. The documentation for each function notes if it could emit |
| 803 | * this error. |
| 804 | * |
| 805 | * @analysis Platform or platform version limitation. The error can be ignored |
| 806 | * unless the feature is critical to the application. |
| 807 | * |
| 808 | * @par |
| 809 | * A function call that emits this error has no effect other than the error and |
| 810 | * updating any existing out parameters. |
| 811 | */ |
| 812 | #define GLFW_FEATURE_UNAVAILABLE 0x0001000C |
| 813 | /*! @brief The requested feature is not implemented for the platform. |
| 814 | * |
| 815 | * The requested feature has not yet been implemented in GLFW for this platform. |
| 816 | * |
| 817 | * @analysis An incomplete implementation of GLFW for this platform, hopefully |
| 818 | * fixed in a future release. The error can be ignored unless the feature is |
| 819 | * critical to the application. |
| 820 | * |
| 821 | * @par |
| 822 | * A function call that emits this error has no effect other than the error and |
| 823 | * updating any existing out parameters. |
| 824 | */ |
| 825 | #define GLFW_FEATURE_UNIMPLEMENTED 0x0001000D |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 826 | /*! @brief Platform unavailable or no matching platform was found. |
| 827 | * |
| 828 | * If emitted during initialization, no matching platform was found. If @ref |
| 829 | * GLFW_PLATFORM is set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of the |
| 830 | * platforms supported by this library binary, except for the Null platform. If set to |
| 831 | * a specific platform, it is either not supported by this library binary or GLFW was not |
| 832 | * able to detect it. |
| 833 | * |
| 834 | * If emitted by a native access function, GLFW was initialized for a different platform |
| 835 | * than the function is for. |
| 836 | * |
| 837 | * @analysis Failure to detect any platform usually only happens on non-macOS Unix |
| 838 | * systems, either when no window system is running or the program was run from |
| 839 | * a terminal that does not have the necessary environment variables. Fall back to |
| 840 | * a different platform if possible or notify the user that no usable platform was |
| 841 | * detected. |
| 842 | * |
| 843 | * Failure to detect a specific platform may have the same cause as above or be because |
| 844 | * support for that platform was not compiled in. Call @ref glfwPlatformSupported to |
| 845 | * check whether a specific platform is supported by a library binary. |
| 846 | */ |
| 847 | #define GLFW_PLATFORM_UNAVAILABLE 0x0001000E |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 848 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 849 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 850 | /*! @addtogroup window |
| 851 | * @{ */ |
| 852 | /*! @brief Input focus window hint and attribute |
| 853 | * |
| 854 | * Input focus [window hint](@ref GLFW_FOCUSED_hint) or |
| 855 | * [window attribute](@ref GLFW_FOCUSED_attrib). |
| 856 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 857 | #define GLFW_FOCUSED 0x00020001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 858 | /*! @brief Window iconification window attribute |
| 859 | * |
| 860 | * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib). |
| 861 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 862 | #define GLFW_ICONIFIED 0x00020002 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 863 | /*! @brief Window resize-ability window hint and attribute |
| 864 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 865 | * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 866 | * [window attribute](@ref GLFW_RESIZABLE_attrib). |
| 867 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 868 | #define GLFW_RESIZABLE 0x00020003 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 869 | /*! @brief Window visibility window hint and attribute |
| 870 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 871 | * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 872 | * [window attribute](@ref GLFW_VISIBLE_attrib). |
| 873 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 874 | #define GLFW_VISIBLE 0x00020004 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 875 | /*! @brief Window decoration window hint and attribute |
| 876 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 877 | * Window decoration [window hint](@ref GLFW_DECORATED_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 878 | * [window attribute](@ref GLFW_DECORATED_attrib). |
| 879 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 880 | #define GLFW_DECORATED 0x00020005 |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 881 | /*! @brief Window auto-iconification window hint and attribute |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 882 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 883 | * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 884 | * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib). |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 885 | */ |
Camilla Berglund | 25e7ff1 | 2014-04-08 15:32:34 +0200 | [diff] [blame] | 886 | #define GLFW_AUTO_ICONIFY 0x00020006 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 887 | /*! @brief Window decoration window hint and attribute |
| 888 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 889 | * Window decoration [window hint](@ref GLFW_FLOATING_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 890 | * [window attribute](@ref GLFW_FLOATING_attrib). |
| 891 | */ |
Camilla Berglund | 3ce7bfe | 2014-05-23 14:01:02 +0200 | [diff] [blame] | 892 | #define GLFW_FLOATING 0x00020007 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 893 | /*! @brief Window maximization window hint and attribute |
| 894 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 895 | * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 896 | * [window attribute](@ref GLFW_MAXIMIZED_attrib). |
| 897 | */ |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 898 | #define GLFW_MAXIMIZED 0x00020008 |
Camilla Löwy | 5a74b50 | 2017-02-06 15:03:50 +0100 | [diff] [blame] | 899 | /*! @brief Cursor centering window hint |
| 900 | * |
| 901 | * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint). |
| 902 | */ |
Liam Middlebrook | 72ac5ba | 2016-08-18 11:47:54 -0400 | [diff] [blame] | 903 | #define GLFW_CENTER_CURSOR 0x00020009 |
Camilla Löwy | 32e78ae | 2017-09-18 18:10:57 +0200 | [diff] [blame] | 904 | /*! @brief Window framebuffer transparency hint and attribute |
| 905 | * |
Camilla Löwy | 49130ab | 2017-11-07 22:50:01 +0100 | [diff] [blame] | 906 | * Window framebuffer transparency |
| 907 | * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and |
| 908 | * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib). |
Camilla Löwy | 32e78ae | 2017-09-18 18:10:57 +0200 | [diff] [blame] | 909 | */ |
Camilla Löwy | 49130ab | 2017-11-07 22:50:01 +0100 | [diff] [blame] | 910 | #define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A |
Camilla Löwy | d6b3a60 | 2018-01-11 14:13:54 +0100 | [diff] [blame] | 911 | /*! @brief Mouse cursor hover window attribute. |
| 912 | * |
| 913 | * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib). |
| 914 | */ |
Camilla Löwy | ee9dffc | 2018-01-04 13:50:58 +0100 | [diff] [blame] | 915 | #define GLFW_HOVERED 0x0002000B |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 916 | /*! @brief Input focus on calling show window hint and attribute |
| 917 | * |
| 918 | * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or |
| 919 | * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). |
| 920 | */ |
| 921 | #define GLFW_FOCUS_ON_SHOW 0x0002000C |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 922 | |
Camilla Löwy | a122d91 | 2020-07-08 23:21:28 +0200 | [diff] [blame] | 923 | /*! @brief Mouse input transparency window hint and attribute |
Rokas Kupstys | d285a9f | 2019-09-30 15:44:43 +0300 | [diff] [blame] | 924 | * |
Camilla Löwy | a122d91 | 2020-07-08 23:21:28 +0200 | [diff] [blame] | 925 | * Mouse input transparency [window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or |
Rokas Kupstys | d285a9f | 2019-09-30 15:44:43 +0300 | [diff] [blame] | 926 | * [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib). |
| 927 | */ |
| 928 | #define GLFW_MOUSE_PASSTHROUGH 0x0002000D |
| 929 | |
Camilla Löwy | 0f9a957 | 2021-10-26 14:25:03 +0200 | [diff] [blame] | 930 | /*! @brief Initial position x-coordinate window hint. |
| 931 | * |
| 932 | * Initial position x-coordinate [window hint](@ref GLFW_POSITION_X). |
| 933 | */ |
| 934 | #define GLFW_POSITION_X 0x0002000E |
| 935 | |
| 936 | /*! @brief Initial position y-coordinate window hint. |
| 937 | * |
| 938 | * Initial position y-coordinate [window hint](@ref GLFW_POSITION_Y). |
| 939 | */ |
| 940 | #define GLFW_POSITION_Y 0x0002000F |
| 941 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 942 | /*! @brief Framebuffer bit depth hint. |
| 943 | * |
| 944 | * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). |
| 945 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 946 | #define GLFW_RED_BITS 0x00021001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 947 | /*! @brief Framebuffer bit depth hint. |
| 948 | * |
| 949 | * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS). |
| 950 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 951 | #define GLFW_GREEN_BITS 0x00021002 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 952 | /*! @brief Framebuffer bit depth hint. |
| 953 | * |
| 954 | * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS). |
| 955 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 956 | #define GLFW_BLUE_BITS 0x00021003 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 957 | /*! @brief Framebuffer bit depth hint. |
| 958 | * |
| 959 | * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS). |
| 960 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 961 | #define GLFW_ALPHA_BITS 0x00021004 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 962 | /*! @brief Framebuffer bit depth hint. |
| 963 | * |
| 964 | * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS). |
| 965 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 966 | #define GLFW_DEPTH_BITS 0x00021005 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 967 | /*! @brief Framebuffer bit depth hint. |
| 968 | * |
| 969 | * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS). |
| 970 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 971 | #define GLFW_STENCIL_BITS 0x00021006 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 972 | /*! @brief Framebuffer bit depth hint. |
| 973 | * |
| 974 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS). |
| 975 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 976 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 977 | /*! @brief Framebuffer bit depth hint. |
| 978 | * |
| 979 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS). |
| 980 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 981 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 982 | /*! @brief Framebuffer bit depth hint. |
| 983 | * |
| 984 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS). |
| 985 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 986 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 987 | /*! @brief Framebuffer bit depth hint. |
| 988 | * |
| 989 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS). |
| 990 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 991 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 992 | /*! @brief Framebuffer auxiliary buffer hint. |
| 993 | * |
| 994 | * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS). |
| 995 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 996 | #define GLFW_AUX_BUFFERS 0x0002100B |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 997 | /*! @brief OpenGL stereoscopic rendering hint. |
| 998 | * |
| 999 | * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO). |
| 1000 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1001 | #define GLFW_STEREO 0x0002100C |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1002 | /*! @brief Framebuffer MSAA samples hint. |
| 1003 | * |
| 1004 | * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES). |
| 1005 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1006 | #define GLFW_SAMPLES 0x0002100D |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1007 | /*! @brief Framebuffer sRGB hint. |
| 1008 | * |
| 1009 | * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE). |
| 1010 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1011 | #define GLFW_SRGB_CAPABLE 0x0002100E |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1012 | /*! @brief Monitor refresh rate hint. |
| 1013 | * |
| 1014 | * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE). |
| 1015 | */ |
Camilla Berglund | 2cd3438 | 2013-05-30 20:42:50 +0200 | [diff] [blame] | 1016 | #define GLFW_REFRESH_RATE 0x0002100F |
Camilla Löwy | 04f21ab | 2021-05-13 21:38:46 +0200 | [diff] [blame] | 1017 | /*! @brief Framebuffer double buffering hint and attribute. |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1018 | * |
Camilla Löwy | 04f21ab | 2021-05-13 21:38:46 +0200 | [diff] [blame] | 1019 | * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER_hint) and |
| 1020 | * [attribute](@ref GLFW_DOUBLEBUFFER_attrib). |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 1021 | */ |
Camilla Berglund | c980858 | 2014-04-24 19:21:10 +0200 | [diff] [blame] | 1022 | #define GLFW_DOUBLEBUFFER 0x00021010 |
Bailey Cosier | 93e6666 | 2017-09-19 18:27:45 +0200 | [diff] [blame] | 1023 | |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1024 | /*! @brief Context client API hint and attribute. |
| 1025 | * |
| 1026 | * Context client API [hint](@ref GLFW_CLIENT_API_hint) and |
| 1027 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 1028 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1029 | #define GLFW_CLIENT_API 0x00022001 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1030 | /*! @brief Context client API major version hint and attribute. |
| 1031 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1032 | * Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint) |
| 1033 | * and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1034 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1035 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1036 | /*! @brief Context client API minor version hint and attribute. |
| 1037 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1038 | * Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint) |
| 1039 | * and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1040 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1041 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
Stephen Gutekanst | 37fc28b | 2021-11-15 15:50:37 -0700 | [diff] [blame] | 1042 | /*! @brief Context client API revision number attribute. |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1043 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1044 | * Context client API revision number |
| 1045 | * [attribute](@ref GLFW_CONTEXT_REVISION_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1046 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1047 | #define GLFW_CONTEXT_REVISION 0x00022004 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1048 | /*! @brief Context robustness hint and attribute. |
| 1049 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1050 | * Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint) |
| 1051 | * and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1052 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1053 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1054 | /*! @brief OpenGL forward-compatibility hint and attribute. |
| 1055 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1056 | * OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) |
| 1057 | * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1058 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1059 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
Camilla Löwy | 4e3b433 | 2020-06-28 19:21:36 +0200 | [diff] [blame] | 1060 | /*! @brief Debug mode context hint and attribute. |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1061 | * |
Camilla Löwy | b420ca7 | 2020-06-26 18:35:48 +0200 | [diff] [blame] | 1062 | * Debug mode context [hint](@ref GLFW_CONTEXT_DEBUG_hint) and |
| 1063 | * [attribute](@ref GLFW_CONTEXT_DEBUG_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1064 | */ |
Camilla Löwy | b420ca7 | 2020-06-26 18:35:48 +0200 | [diff] [blame] | 1065 | #define GLFW_CONTEXT_DEBUG 0x00022007 |
| 1066 | /*! @brief Legacy name for compatibility. |
| 1067 | * |
| 1068 | * This is an alias for compatibility with earlier versions. |
| 1069 | */ |
| 1070 | #define GLFW_OPENGL_DEBUG_CONTEXT GLFW_CONTEXT_DEBUG |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1071 | /*! @brief OpenGL profile hint and attribute. |
| 1072 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1073 | * OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and |
| 1074 | * [attribute](@ref GLFW_OPENGL_PROFILE_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1075 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 1076 | #define GLFW_OPENGL_PROFILE 0x00022008 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1077 | /*! @brief Context flush-on-release hint and attribute. |
| 1078 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1079 | * Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and |
| 1080 | * [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1081 | */ |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 1082 | #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1083 | /*! @brief Context error suppression hint and attribute. |
| 1084 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1085 | * Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and |
| 1086 | * [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1087 | */ |
Camilla Berglund | 7be8209 | 2015-08-10 12:46:14 +0200 | [diff] [blame] | 1088 | #define GLFW_CONTEXT_NO_ERROR 0x0002200A |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1089 | /*! @brief Context creation API hint and attribute. |
| 1090 | * |
Camilla Löwy | 3cf7645 | 2019-05-19 21:41:57 +0200 | [diff] [blame] | 1091 | * Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and |
| 1092 | * [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib). |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1093 | */ |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1094 | #define GLFW_CONTEXT_CREATION_API 0x0002200B |
Camilla Löwy | 089ea9a | 2018-08-31 13:33:48 +0200 | [diff] [blame] | 1095 | /*! @brief Window content area scaling window |
| 1096 | * [window hint](@ref GLFW_SCALE_TO_MONITOR). |
| 1097 | */ |
| 1098 | #define GLFW_SCALE_TO_MONITOR 0x0002200C |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1099 | /*! @brief macOS specific |
| 1100 | * [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint). |
| 1101 | */ |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 1102 | #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1103 | /*! @brief macOS specific |
| 1104 | * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint). |
| 1105 | */ |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 1106 | #define GLFW_COCOA_FRAME_NAME 0x00023002 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1107 | /*! @brief macOS specific |
| 1108 | * [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint). |
| 1109 | */ |
Camilla Löwy | 77a8f10 | 2017-01-27 12:02:09 +0100 | [diff] [blame] | 1110 | #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1111 | /*! @brief X11 specific |
| 1112 | * [window hint](@ref GLFW_X11_CLASS_NAME_hint). |
| 1113 | */ |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 1114 | #define GLFW_X11_CLASS_NAME 0x00024001 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1115 | /*! @brief X11 specific |
| 1116 | * [window hint](@ref GLFW_X11_CLASS_NAME_hint). |
| 1117 | */ |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 1118 | #define GLFW_X11_INSTANCE_NAME 0x00024002 |
Camilla Löwy | 8e288dc | 2019-08-20 19:00:59 +0200 | [diff] [blame] | 1119 | #define GLFW_WIN32_KEYBOARD_MENU 0x00025001 |
Michael Pennington | b9ed25d | 2022-05-26 20:33:28 -0400 | [diff] [blame] | 1120 | /*! @brief Wayland specific |
| 1121 | * [window hint](@ref GLFW_WAYLAND_APP_ID_hint). |
| 1122 | * |
| 1123 | * Allows specification of the Wayland app_id. |
| 1124 | */ |
| 1125 | #define GLFW_WAYLAND_APP_ID 0x00026001 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1126 | /*! @} */ |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 1127 | |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 1128 | #define GLFW_NO_API 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1129 | #define GLFW_OPENGL_API 0x00030001 |
| 1130 | #define GLFW_OPENGL_ES_API 0x00030002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1131 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1132 | #define GLFW_NO_ROBUSTNESS 0 |
| 1133 | #define GLFW_NO_RESET_NOTIFICATION 0x00031001 |
| 1134 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1135 | |
Camilla Berglund | 44e8401 | 2013-06-05 16:13:30 +0200 | [diff] [blame] | 1136 | #define GLFW_OPENGL_ANY_PROFILE 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1137 | #define GLFW_OPENGL_CORE_PROFILE 0x00032001 |
| 1138 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1139 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1140 | #define GLFW_CURSOR 0x00033001 |
| 1141 | #define GLFW_STICKY_KEYS 0x00033002 |
| 1142 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 1143 | #define GLFW_LOCK_KEY_MODS 0x00033004 |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 1144 | #define GLFW_RAW_MOUSE_MOTION 0x00033005 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1145 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1146 | #define GLFW_CURSOR_NORMAL 0x00034001 |
| 1147 | #define GLFW_CURSOR_HIDDEN 0x00034002 |
| 1148 | #define GLFW_CURSOR_DISABLED 0x00034003 |
Camilla Löwy | 488008e | 2019-12-03 17:58:20 +0100 | [diff] [blame] | 1149 | #define GLFW_CURSOR_CAPTURED 0x00034004 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1150 | |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 1151 | #define GLFW_ANY_RELEASE_BEHAVIOR 0 |
| 1152 | #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 |
| 1153 | #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 |
| 1154 | |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1155 | #define GLFW_NATIVE_CONTEXT_API 0x00036001 |
| 1156 | #define GLFW_EGL_CONTEXT_API 0x00036002 |
Camilla Löwy | e9560ef | 2017-02-28 19:23:25 +0100 | [diff] [blame] | 1157 | #define GLFW_OSMESA_CONTEXT_API 0x00036003 |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1158 | |
Camilla Löwy | 0dea8a4 | 2020-06-25 18:22:08 +0200 | [diff] [blame] | 1159 | #define GLFW_ANGLE_PLATFORM_TYPE_NONE 0x00037001 |
| 1160 | #define GLFW_ANGLE_PLATFORM_TYPE_OPENGL 0x00037002 |
| 1161 | #define GLFW_ANGLE_PLATFORM_TYPE_OPENGLES 0x00037003 |
| 1162 | #define GLFW_ANGLE_PLATFORM_TYPE_D3D9 0x00037004 |
| 1163 | #define GLFW_ANGLE_PLATFORM_TYPE_D3D11 0x00037005 |
| 1164 | #define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007 |
| 1165 | #define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008 |
| 1166 | |
Camilla Löwy | 0f9a957 | 2021-10-26 14:25:03 +0200 | [diff] [blame] | 1167 | #define GLFW_ANY_POSITION 0x80000000 |
| 1168 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1169 | /*! @defgroup shapes Standard cursor shapes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 1170 | * @brief Standard system cursor shapes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1171 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1172 | * 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] | 1173 | * requested from the platform (window system). |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1174 | * |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1175 | * @ingroup input |
| 1176 | * @{ */ |
| 1177 | |
| 1178 | /*! @brief The regular arrow cursor shape. |
| 1179 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1180 | * The regular arrow cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1181 | */ |
| 1182 | #define GLFW_ARROW_CURSOR 0x00036001 |
| 1183 | /*! @brief The text input I-beam cursor shape. |
| 1184 | * |
| 1185 | * The text input I-beam cursor shape. |
| 1186 | */ |
| 1187 | #define GLFW_IBEAM_CURSOR 0x00036002 |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1188 | /*! @brief The crosshair cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1189 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1190 | * The crosshair cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1191 | */ |
| 1192 | #define GLFW_CROSSHAIR_CURSOR 0x00036003 |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1193 | /*! @brief The pointing hand cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1194 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1195 | * The pointing hand cursor shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1196 | */ |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1197 | #define GLFW_POINTING_HAND_CURSOR 0x00036004 |
| 1198 | /*! @brief The horizontal resize/move arrow shape. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1199 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1200 | * The horizontal resize/move arrow shape. This is usually a horizontal |
| 1201 | * double-headed arrow. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1202 | */ |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1203 | #define GLFW_RESIZE_EW_CURSOR 0x00036005 |
| 1204 | /*! @brief The vertical resize/move arrow 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 vertical resize/move shape. This is usually a vertical double-headed |
| 1207 | * arrow. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1208 | */ |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 1209 | #define GLFW_RESIZE_NS_CURSOR 0x00036006 |
| 1210 | /*! @brief The top-left to bottom-right diagonal resize/move arrow shape. |
| 1211 | * |
| 1212 | * The top-left to bottom-right diagonal resize/move shape. This is usually |
| 1213 | * a diagonal double-headed arrow. |
| 1214 | * |
| 1215 | * @note @macos This shape is provided by a private system API and may fail |
| 1216 | * with @ref GLFW_CURSOR_UNAVAILABLE in the future. |
| 1217 | * |
| 1218 | * @note @x11 This shape is provided by a newer standard not supported by all |
| 1219 | * cursor themes. |
| 1220 | * |
| 1221 | * @note @wayland This shape is provided by a newer standard not supported by |
| 1222 | * all cursor themes. |
| 1223 | */ |
| 1224 | #define GLFW_RESIZE_NWSE_CURSOR 0x00036007 |
| 1225 | /*! @brief The top-right to bottom-left diagonal resize/move arrow shape. |
| 1226 | * |
| 1227 | * The top-right to bottom-left diagonal resize/move shape. This is usually |
| 1228 | * a diagonal double-headed arrow. |
| 1229 | * |
| 1230 | * @note @macos This shape is provided by a private system API and may fail |
| 1231 | * with @ref GLFW_CURSOR_UNAVAILABLE in the future. |
| 1232 | * |
| 1233 | * @note @x11 This shape is provided by a newer standard not supported by all |
| 1234 | * cursor themes. |
| 1235 | * |
| 1236 | * @note @wayland This shape is provided by a newer standard not supported by |
| 1237 | * all cursor themes. |
| 1238 | */ |
| 1239 | #define GLFW_RESIZE_NESW_CURSOR 0x00036008 |
| 1240 | /*! @brief The omni-directional resize/move cursor shape. |
| 1241 | * |
| 1242 | * The omni-directional resize cursor/move shape. This is usually either |
| 1243 | * a combined horizontal and vertical double-headed arrow or a grabbing hand. |
| 1244 | */ |
| 1245 | #define GLFW_RESIZE_ALL_CURSOR 0x00036009 |
| 1246 | /*! @brief The operation-not-allowed shape. |
| 1247 | * |
| 1248 | * The operation-not-allowed shape. This is usually a circle with a diagonal |
| 1249 | * line through it. |
| 1250 | * |
| 1251 | * @note @x11 This shape is provided by a newer standard not supported by all |
| 1252 | * cursor themes. |
| 1253 | * |
| 1254 | * @note @wayland This shape is provided by a newer standard not supported by |
| 1255 | * all cursor themes. |
| 1256 | */ |
| 1257 | #define GLFW_NOT_ALLOWED_CURSOR 0x0003600A |
| 1258 | /*! @brief Legacy name for compatibility. |
| 1259 | * |
| 1260 | * This is an alias for compatibility with earlier versions. |
| 1261 | */ |
| 1262 | #define GLFW_HRESIZE_CURSOR GLFW_RESIZE_EW_CURSOR |
| 1263 | /*! @brief Legacy name for compatibility. |
| 1264 | * |
| 1265 | * This is an alias for compatibility with earlier versions. |
| 1266 | */ |
| 1267 | #define GLFW_VRESIZE_CURSOR GLFW_RESIZE_NS_CURSOR |
| 1268 | /*! @brief Legacy name for compatibility. |
| 1269 | * |
| 1270 | * This is an alias for compatibility with earlier versions. |
| 1271 | */ |
| 1272 | #define GLFW_HAND_CURSOR GLFW_POINTING_HAND_CURSOR |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1273 | /*! @} */ |
| 1274 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1275 | #define GLFW_CONNECTED 0x00040001 |
| 1276 | #define GLFW_DISCONNECTED 0x00040002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1277 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1278 | /*! @addtogroup init |
| 1279 | * @{ */ |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1280 | /*! @brief Joystick hat buttons init hint. |
| 1281 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1282 | * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1283 | */ |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 1284 | #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001 |
Camilla Löwy | 0dea8a4 | 2020-06-25 18:22:08 +0200 | [diff] [blame] | 1285 | /*! @brief ANGLE rendering backend init hint. |
| 1286 | * |
| 1287 | * ANGLE rendering backend [init hint](@ref GLFW_ANGLE_PLATFORM_TYPE_hint). |
| 1288 | */ |
| 1289 | #define GLFW_ANGLE_PLATFORM_TYPE 0x00050002 |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 1290 | /*! @brief Platform selection init hint. |
| 1291 | * |
| 1292 | * Platform selection [init hint](@ref GLFW_PLATFORM). |
| 1293 | */ |
| 1294 | #define GLFW_PLATFORM 0x00050003 |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1295 | /*! @brief macOS specific init hint. |
| 1296 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1297 | * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1298 | */ |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1299 | #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001 |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1300 | /*! @brief macOS specific init hint. |
| 1301 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1302 | * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1303 | */ |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1304 | #define GLFW_COCOA_MENUBAR 0x00051002 |
Nicolas Caramelli | 84f95a7 | 2020-10-23 18:55:37 +0200 | [diff] [blame] | 1305 | /*! @brief X11 specific init hint. |
| 1306 | * |
| 1307 | * X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint). |
| 1308 | */ |
| 1309 | #define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001 |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1310 | /*! @} */ |
| 1311 | |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 1312 | /*! @addtogroup init |
| 1313 | * @{ */ |
| 1314 | /*! @brief Hint value that enables automatic platform selection. |
| 1315 | * |
| 1316 | * Hint value for @ref GLFW_PLATFORM that enables automatic platform selection. |
| 1317 | */ |
| 1318 | #define GLFW_ANY_PLATFORM 0x00060000 |
| 1319 | #define GLFW_PLATFORM_WIN32 0x00060001 |
| 1320 | #define GLFW_PLATFORM_COCOA 0x00060002 |
| 1321 | #define GLFW_PLATFORM_WAYLAND 0x00060003 |
| 1322 | #define GLFW_PLATFORM_X11 0x00060004 |
| 1323 | #define GLFW_PLATFORM_NULL 0x00060005 |
| 1324 | /*! @} */ |
| 1325 | |
Camilla Berglund | 2810130 | 2014-04-08 18:57:43 +0200 | [diff] [blame] | 1326 | #define GLFW_DONT_CARE -1 |
| 1327 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 1328 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1329 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1330 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1331 | *************************************************************************/ |
| 1332 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1333 | /*! @brief Client API function pointer type. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1334 | * |
| 1335 | * Generic function pointer used for returning client API function pointers |
| 1336 | * without forcing a cast from a regular pointer. |
| 1337 | * |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1338 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1339 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1340 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1341 | * @since Added in version 3.0. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 1342 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1343 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1344 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 1345 | typedef void (*GLFWglproc)(void); |
| 1346 | |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1347 | /*! @brief Vulkan API function pointer type. |
| 1348 | * |
| 1349 | * Generic function pointer used for returning Vulkan API function pointers |
| 1350 | * without forcing a cast from a regular pointer. |
| 1351 | * |
| 1352 | * @sa @ref vulkan_proc |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1353 | * @sa @ref glfwGetInstanceProcAddress |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1354 | * |
| 1355 | * @since Added in version 3.2. |
| 1356 | * |
| 1357 | * @ingroup vulkan |
| 1358 | */ |
| 1359 | typedef void (*GLFWvkproc)(void); |
| 1360 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1361 | /*! @brief Opaque monitor object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1362 | * |
| 1363 | * Opaque monitor object. |
| 1364 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1365 | * @see @ref monitor_object |
| 1366 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1367 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1368 | * |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1369 | * @ingroup monitor |
| 1370 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1371 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 1372 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1373 | /*! @brief Opaque window object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1374 | * |
| 1375 | * Opaque window object. |
| 1376 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1377 | * @see @ref window_object |
| 1378 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1379 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1380 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1381 | * @ingroup window |
| 1382 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1383 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1384 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1385 | /*! @brief Opaque cursor object. |
| 1386 | * |
| 1387 | * Opaque cursor object. |
| 1388 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1389 | * @see @ref cursor_object |
| 1390 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1391 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1392 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1393 | * @ingroup input |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1394 | */ |
| 1395 | typedef struct GLFWcursor GLFWcursor; |
| 1396 | |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 1397 | /*! @brief The function pointer type for memory allocation callbacks. |
| 1398 | * |
| 1399 | * This is the function pointer type for memory allocation callbacks. A memory |
| 1400 | * allocation callback function has the following signature: |
| 1401 | * @code |
| 1402 | * void* function_name(size_t size, void* user) |
| 1403 | * @endcode |
| 1404 | * |
| 1405 | * This function must return either a memory block at least `size` bytes long, |
| 1406 | * or `NULL` if allocation failed. Note that not all parts of GLFW handle allocation |
| 1407 | * failures gracefully yet. |
| 1408 | * |
| 1409 | * This function may be called during @ref glfwInit but before the library is |
| 1410 | * flagged as initialized, as well as during @ref glfwTerminate after the |
| 1411 | * library is no longer flagged as initialized. |
| 1412 | * |
| 1413 | * Any memory allocated by this function will be deallocated during library |
| 1414 | * termination or earlier. |
| 1415 | * |
| 1416 | * The size will always be greater than zero. Allocations of size zero are filtered out |
| 1417 | * before reaching the custom allocator. |
| 1418 | * |
| 1419 | * @param[in] size The minimum size, in bytes, of the memory block. |
| 1420 | * @param[in] user The user-defined pointer from the allocator. |
| 1421 | * @return The address of the newly allocated memory block, or `NULL` if an |
| 1422 | * error occurred. |
| 1423 | * |
| 1424 | * @pointer_lifetime The returned memory block must be valid at least until it |
| 1425 | * is deallocated. |
| 1426 | * |
| 1427 | * @reentrancy This function should not call any GLFW function. |
| 1428 | * |
| 1429 | * @thread_safety This function may be called from any thread that calls GLFW functions. |
| 1430 | * |
| 1431 | * @sa @ref init_allocator |
| 1432 | * @sa @ref GLFWallocator |
| 1433 | * |
| 1434 | * @since Added in version 3.4. |
| 1435 | * |
| 1436 | * @ingroup init |
| 1437 | */ |
| 1438 | typedef void* (* GLFWallocatefun)(size_t size, void* user); |
| 1439 | |
| 1440 | /*! @brief The function pointer type for memory reallocation callbacks. |
| 1441 | * |
| 1442 | * This is the function pointer type for memory reallocation callbacks. |
| 1443 | * A memory reallocation callback function has the following signature: |
| 1444 | * @code |
| 1445 | * void* function_name(void* block, size_t size, void* user) |
| 1446 | * @endcode |
| 1447 | * |
| 1448 | * This function must return a memory block at least `size` bytes long, or |
| 1449 | * `NULL` if allocation failed. Note that not all parts of GLFW handle allocation |
| 1450 | * failures gracefully yet. |
| 1451 | * |
| 1452 | * This function may be called during @ref glfwInit but before the library is |
| 1453 | * flagged as initialized, as well as during @ref glfwTerminate after the |
| 1454 | * library is no longer flagged as initialized. |
| 1455 | * |
| 1456 | * Any memory allocated by this function will be deallocated during library |
| 1457 | * termination or earlier. |
| 1458 | * |
| 1459 | * The block address will never be `NULL` and the size will always be greater than zero. |
| 1460 | * Reallocations of a block to size zero are converted into deallocations. Reallocations |
| 1461 | * of `NULL` to a non-zero size are converted into regular allocations. |
| 1462 | * |
| 1463 | * @param[in] block The address of the memory block to reallocate. |
| 1464 | * @param[in] size The new minimum size, in bytes, of the memory block. |
| 1465 | * @param[in] user The user-defined pointer from the allocator. |
| 1466 | * @return The address of the newly allocated or resized memory block, or |
| 1467 | * `NULL` if an error occurred. |
| 1468 | * |
| 1469 | * @pointer_lifetime The returned memory block must be valid at least until it |
| 1470 | * is deallocated. |
| 1471 | * |
| 1472 | * @reentrancy This function should not call any GLFW function. |
| 1473 | * |
| 1474 | * @thread_safety This function may be called from any thread that calls GLFW functions. |
| 1475 | * |
| 1476 | * @sa @ref init_allocator |
| 1477 | * @sa @ref GLFWallocator |
| 1478 | * |
| 1479 | * @since Added in version 3.4. |
| 1480 | * |
| 1481 | * @ingroup init |
| 1482 | */ |
| 1483 | typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user); |
| 1484 | |
| 1485 | /*! @brief The function pointer type for memory deallocation callbacks. |
| 1486 | * |
| 1487 | * This is the function pointer type for memory deallocation callbacks. |
| 1488 | * A memory deallocation callback function has the following signature: |
| 1489 | * @code |
| 1490 | * void function_name(void* block, void* user) |
| 1491 | * @endcode |
| 1492 | * |
| 1493 | * This function may deallocate the specified memory block. This memory block |
| 1494 | * will have been allocated with the same allocator. |
| 1495 | * |
| 1496 | * This function may be called during @ref glfwInit but before the library is |
| 1497 | * flagged as initialized, as well as during @ref glfwTerminate after the |
| 1498 | * library is no longer flagged as initialized. |
| 1499 | * |
| 1500 | * The block address will never be `NULL`. Deallocations of `NULL` are filtered out |
| 1501 | * before reaching the custom allocator. |
| 1502 | * |
| 1503 | * @param[in] block The address of the memory block to deallocate. |
| 1504 | * @param[in] user The user-defined pointer from the allocator. |
| 1505 | * |
| 1506 | * @pointer_lifetime The specified memory block will not be accessed by GLFW |
| 1507 | * after this function is called. |
| 1508 | * |
| 1509 | * @reentrancy This function should not call any GLFW function. |
| 1510 | * |
| 1511 | * @thread_safety This function may be called from any thread that calls GLFW functions. |
| 1512 | * |
| 1513 | * @sa @ref init_allocator |
| 1514 | * @sa @ref GLFWallocator |
| 1515 | * |
| 1516 | * @since Added in version 3.4. |
| 1517 | * |
| 1518 | * @ingroup init |
| 1519 | */ |
| 1520 | typedef void (* GLFWdeallocatefun)(void* block, void* user); |
| 1521 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1522 | /*! @brief The function pointer type for error callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1523 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1524 | * This is the function pointer type for error callbacks. An error callback |
| 1525 | * function has the following signature: |
| 1526 | * @code |
| 1527 | * void callback_name(int error_code, const char* description) |
| 1528 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1529 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1530 | * @param[in] error_code An [error code](@ref errors). Future releases may add |
| 1531 | * more error codes. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1532 | * @param[in] description A UTF-8 encoded string describing the error. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1533 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1534 | * @pointer_lifetime The error description string is valid until the callback |
| 1535 | * function returns. |
| 1536 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1537 | * @sa @ref error_handling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1538 | * @sa @ref glfwSetErrorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1539 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1540 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1541 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1542 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1543 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1544 | typedef void (* GLFWerrorfun)(int error_code, const char* description); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1545 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1546 | /*! @brief The function pointer type for window position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1547 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1548 | * This is the function pointer type for window position callbacks. A window |
| 1549 | * position callback function has the following signature: |
| 1550 | * @code |
| 1551 | * void callback_name(GLFWwindow* window, int xpos, int ypos) |
| 1552 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1553 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1554 | * @param[in] window The window that was moved. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1555 | * @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] | 1556 | * upper-left corner of the content area of the window. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1557 | * @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] | 1558 | * upper-left corner of the content area of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1559 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1560 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1561 | * @sa @ref glfwSetWindowPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1562 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1563 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1564 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1565 | * @ingroup window |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1566 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1567 | typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1568 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1569 | /*! @brief The function pointer type for window size 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 window size callbacks. A window size |
| 1572 | * callback function has the following signature: |
| 1573 | * @code |
| 1574 | * void callback_name(GLFWwindow* window, int width, int height) |
| 1575 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1576 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1577 | * @param[in] window The window that was resized. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1578 | * @param[in] width The new width, in screen coordinates, of the window. |
| 1579 | * @param[in] height The new height, in screen coordinates, of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1580 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1581 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1582 | * @sa @ref glfwSetWindowSizeCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1583 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1584 | * @since Added in version 1.0. |
| 1585 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1586 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1587 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1588 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1589 | typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1590 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1591 | /*! @brief The function pointer type for window close callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1592 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1593 | * This is the function pointer type for window close callbacks. A window |
| 1594 | * close callback function has the following signature: |
| 1595 | * @code |
| 1596 | * void function_name(GLFWwindow* window) |
| 1597 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1598 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1599 | * @param[in] window The window that the user attempted to close. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1600 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1601 | * @sa @ref window_close |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1602 | * @sa @ref glfwSetWindowCloseCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1603 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1604 | * @since Added in version 2.5. |
| 1605 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1606 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1607 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1608 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1609 | typedef void (* GLFWwindowclosefun)(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1610 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1611 | /*! @brief The function pointer type for window content refresh callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1612 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1613 | * This is the function pointer type for window content refresh callbacks. |
| 1614 | * A window content refresh callback function has the following signature: |
| 1615 | * @code |
| 1616 | * void function_name(GLFWwindow* window); |
| 1617 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1618 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1619 | * @param[in] window The window whose content needs to be refreshed. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1620 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1621 | * @sa @ref window_refresh |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1622 | * @sa @ref glfwSetWindowRefreshCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1623 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1624 | * @since Added in version 2.5. |
| 1625 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1626 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1627 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1628 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1629 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1630 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1631 | /*! @brief The function pointer type for window focus callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1632 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1633 | * This is the function pointer type for window focus callbacks. A window |
| 1634 | * focus callback function has the following signature: |
| 1635 | * @code |
| 1636 | * void function_name(GLFWwindow* window, int focused) |
| 1637 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1638 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1639 | * @param[in] window The window that gained or lost input focus. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1640 | * @param[in] focused `GLFW_TRUE` if the window was given input focus, or |
| 1641 | * `GLFW_FALSE` if it lost it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1642 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1643 | * @sa @ref window_focus |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1644 | * @sa @ref glfwSetWindowFocusCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1645 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1646 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1647 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1648 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1649 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1650 | typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1651 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1652 | /*! @brief The function pointer type for window iconify callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1653 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1654 | * This is the function pointer type for window iconify callbacks. A window |
| 1655 | * iconify callback function has the following signature: |
| 1656 | * @code |
| 1657 | * void function_name(GLFWwindow* window, int iconified) |
| 1658 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1659 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1660 | * @param[in] window The window that was iconified or restored. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1661 | * @param[in] iconified `GLFW_TRUE` if the window was iconified, or |
| 1662 | * `GLFW_FALSE` if it was restored. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1663 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1664 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1665 | * @sa @ref glfwSetWindowIconifyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1666 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1667 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1668 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1669 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1670 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1671 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1672 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1673 | /*! @brief The function pointer type for window maximize callbacks. |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1674 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1675 | * This is the function pointer type for window maximize callbacks. A window |
| 1676 | * maximize callback function has the following signature: |
| 1677 | * @code |
| 1678 | * void function_name(GLFWwindow* window, int maximized) |
| 1679 | * @endcode |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1680 | * |
| 1681 | * @param[in] window The window that was maximized or restored. |
Emmanuel Gil Peyrot | 1ed1489 | 2020-09-07 20:19:51 +0200 | [diff] [blame] | 1682 | * @param[in] maximized `GLFW_TRUE` if the window was maximized, or |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1683 | * `GLFW_FALSE` if it was restored. |
| 1684 | * |
| 1685 | * @sa @ref window_maximize |
| 1686 | * @sa glfwSetWindowMaximizeCallback |
| 1687 | * |
| 1688 | * @since Added in version 3.3. |
| 1689 | * |
| 1690 | * @ingroup window |
| 1691 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1692 | typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized); |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1693 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1694 | /*! @brief The function pointer type for framebuffer size callbacks. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1695 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1696 | * This is the function pointer type for framebuffer size callbacks. |
| 1697 | * A framebuffer size callback function has the following signature: |
| 1698 | * @code |
| 1699 | * void function_name(GLFWwindow* window, int width, int height) |
| 1700 | * @endcode |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1701 | * |
| 1702 | * @param[in] window The window whose framebuffer was resized. |
| 1703 | * @param[in] width The new width, in pixels, of the framebuffer. |
| 1704 | * @param[in] height The new height, in pixels, of the framebuffer. |
| 1705 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1706 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1707 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1708 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1709 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1710 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1711 | * @ingroup window |
| 1712 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1713 | typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height); |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1714 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1715 | /*! @brief The function pointer type for window content scale callbacks. |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1716 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1717 | * This is the function pointer type for window content scale callbacks. |
| 1718 | * A window content scale callback function has the following signature: |
| 1719 | * @code |
| 1720 | * void function_name(GLFWwindow* window, float xscale, float yscale) |
| 1721 | * @endcode |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1722 | * |
| 1723 | * @param[in] window The window whose content scale changed. |
| 1724 | * @param[in] xscale The new x-axis content scale of the window. |
| 1725 | * @param[in] yscale The new y-axis content scale of the window. |
| 1726 | * |
| 1727 | * @sa @ref window_scale |
| 1728 | * @sa @ref glfwSetWindowContentScaleCallback |
| 1729 | * |
| 1730 | * @since Added in version 3.3. |
| 1731 | * |
| 1732 | * @ingroup window |
| 1733 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1734 | typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale); |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1735 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1736 | /*! @brief The function pointer type for mouse button callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1737 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1738 | * This is the function pointer type for mouse button callback functions. |
| 1739 | * A mouse button callback function has the following signature: |
| 1740 | * @code |
| 1741 | * void function_name(GLFWwindow* window, int button, int action, int mods) |
| 1742 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1743 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1744 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1745 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
| 1746 | * released. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1747 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. Future releases |
| 1748 | * may add more actions. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1749 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1750 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1751 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1752 | * @sa @ref input_mouse_button |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1753 | * @sa @ref glfwSetMouseButtonCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1754 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1755 | * @since Added in version 1.0. |
| 1756 | * @glfw3 Added window handle and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1757 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1758 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1759 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1760 | typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1761 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1762 | /*! @brief The function pointer type for cursor position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1763 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1764 | * This is the function pointer type for cursor position callbacks. A cursor |
| 1765 | * position callback function has the following signature: |
| 1766 | * @code |
| 1767 | * void function_name(GLFWwindow* window, double xpos, double ypos); |
| 1768 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1769 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1770 | * @param[in] window The window that received the event. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1771 | * @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] | 1772 | * the content area. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1773 | * @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] | 1774 | * content area. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1775 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1776 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1777 | * @sa @ref glfwSetCursorPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1778 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1779 | * @since Added in version 3.0. Replaces `GLFWmouseposfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1780 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1781 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1782 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1783 | typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1784 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1785 | /*! @brief The function pointer type for cursor enter/leave callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1786 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1787 | * This is the function pointer type for cursor enter/leave callbacks. |
| 1788 | * A cursor enter/leave callback function has the following signature: |
| 1789 | * @code |
| 1790 | * void function_name(GLFWwindow* window, int entered) |
| 1791 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1792 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1793 | * @param[in] window The window that received the event. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 1794 | * @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] | 1795 | * area, or `GLFW_FALSE` if it left it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1796 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1797 | * @sa @ref cursor_enter |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1798 | * @sa @ref glfwSetCursorEnterCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1799 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1800 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1801 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1802 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1803 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1804 | typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1805 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1806 | /*! @brief The function pointer type for scroll callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1807 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1808 | * This is the function pointer type for scroll callbacks. A scroll callback |
| 1809 | * function has the following signature: |
| 1810 | * @code |
| 1811 | * void function_name(GLFWwindow* window, double xoffset, double yoffset) |
| 1812 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1813 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1814 | * @param[in] window The window that received the event. |
mewmew | cf2d260 | 2013-06-06 19:49:23 +0200 | [diff] [blame] | 1815 | * @param[in] xoffset The scroll offset along the x-axis. |
| 1816 | * @param[in] yoffset The scroll offset along the y-axis. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1817 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1818 | * @sa @ref scrolling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1819 | * @sa @ref glfwSetScrollCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1820 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1821 | * @since Added in version 3.0. Replaces `GLFWmousewheelfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1822 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1823 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1824 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1825 | typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1826 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1827 | /*! @brief The function pointer type for keyboard key callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1828 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1829 | * This is the function pointer type for keyboard key callbacks. A keyboard |
| 1830 | * key callback function has the following signature: |
| 1831 | * @code |
| 1832 | * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods) |
| 1833 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1834 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1835 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1836 | * @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] | 1837 | * @param[in] scancode The platform-specific scancode of the key. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1838 | * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. Future |
| 1839 | * releases may add more actions. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1840 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1841 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1842 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1843 | * @sa @ref input_key |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1844 | * @sa @ref glfwSetKeyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1845 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1846 | * @since Added in version 1.0. |
| 1847 | * @glfw3 Added window handle, scancode and modifier mask parameters. |
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 (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods); |
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 Unicode character 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 Unicode character callbacks. |
| 1856 | * A Unicode character callback function has the following signature: |
| 1857 | * @code |
| 1858 | * void function_name(GLFWwindow* window, unsigned int codepoint) |
| 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. |
Camilla Berglund | 2c920fb | 2013-10-10 19:41:56 +0200 | [diff] [blame] | 1862 | * @param[in] codepoint The Unicode code point of the character. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1863 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1864 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1865 | * @sa @ref glfwSetCharCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1866 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1867 | * @since Added in version 2.4. |
| 1868 | * @glfw3 Added window handle parameter. |
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 (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1873 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1874 | /*! @brief The function pointer type for Unicode character with modifiers |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1875 | * callbacks. |
| 1876 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1877 | * This is the function pointer type for Unicode character with modifiers |
| 1878 | * callbacks. It is called for each input character, regardless of what |
| 1879 | * modifier keys are held down. A Unicode character with modifiers callback |
| 1880 | * function has the following signature: |
| 1881 | * @code |
| 1882 | * void function_name(GLFWwindow* window, unsigned int codepoint, int mods) |
| 1883 | * @endcode |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1884 | * |
| 1885 | * @param[in] window The window that received the event. |
| 1886 | * @param[in] codepoint The Unicode code point of the character. |
| 1887 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1888 | * held down. |
| 1889 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1890 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1891 | * @sa @ref glfwSetCharModsCallback |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1892 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 1893 | * @deprecated Scheduled for removal in version 4.0. |
| 1894 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1895 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1896 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1897 | * @ingroup input |
| 1898 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1899 | typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods); |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1900 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1901 | /*! @brief The function pointer type for path drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1902 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1903 | * This is the function pointer type for path drop callbacks. A path drop |
| 1904 | * callback function has the following signature: |
| 1905 | * @code |
| 1906 | * void function_name(GLFWwindow* window, int path_count, const char* paths[]) |
| 1907 | * @endcode |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1908 | * |
| 1909 | * @param[in] window The window that received the event. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1910 | * @param[in] path_count The number of dropped paths. |
Camilla Berglund | 93855ae | 2015-01-27 23:04:22 +0100 | [diff] [blame] | 1911 | * @param[in] paths The UTF-8 encoded file and/or directory path names. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1912 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1913 | * @pointer_lifetime The path array and its strings are valid until the |
| 1914 | * callback function returns. |
| 1915 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1916 | * @sa @ref path_drop |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1917 | * @sa @ref glfwSetDropCallback |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1918 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1919 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1920 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1921 | * @ingroup input |
| 1922 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1923 | typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]); |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1924 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1925 | /*! @brief The function pointer type for monitor configuration callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1926 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1927 | * This is the function pointer type for monitor configuration callbacks. |
| 1928 | * A monitor callback function has the following signature: |
| 1929 | * @code |
| 1930 | * void function_name(GLFWmonitor* monitor, int event) |
| 1931 | * @endcode |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1932 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1933 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1934 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future |
| 1935 | * releases may add more events. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1936 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1937 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1938 | * @sa @ref glfwSetMonitorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1939 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1940 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1941 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1942 | * @ingroup monitor |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1943 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1944 | typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 1945 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1946 | /*! @brief The function pointer type for joystick configuration callbacks. |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1947 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1948 | * This is the function pointer type for joystick configuration callbacks. |
| 1949 | * A joystick configuration callback function has the following signature: |
| 1950 | * @code |
| 1951 | * void function_name(int jid, int event) |
| 1952 | * @endcode |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1953 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 1954 | * @param[in] jid The joystick that was connected or disconnected. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 1955 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future |
| 1956 | * releases may add more events. |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1957 | * |
| 1958 | * @sa @ref joystick_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1959 | * @sa @ref glfwSetJoystickCallback |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1960 | * |
| 1961 | * @since Added in version 3.2. |
| 1962 | * |
| 1963 | * @ingroup input |
| 1964 | */ |
Camilla Löwy | 4e55743 | 2021-08-25 20:47:17 +0200 | [diff] [blame] | 1965 | typedef void (* GLFWjoystickfun)(int jid, int event); |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1966 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1967 | /*! @brief Video mode type. |
| 1968 | * |
| 1969 | * This describes a single video mode. |
| 1970 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1971 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1972 | * @sa @ref glfwGetVideoMode |
| 1973 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1974 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1975 | * @since Added in version 1.0. |
| 1976 | * @glfw3 Added refresh rate member. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1977 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1978 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1979 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1980 | typedef struct GLFWvidmode |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1981 | { |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1982 | /*! The width, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1983 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1984 | int width; |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1985 | /*! The height, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1986 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1987 | int height; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1988 | /*! The bit depth of the red channel of the video mode. |
| 1989 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1990 | int redBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1991 | /*! The bit depth of the green channel of the video mode. |
| 1992 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1993 | int greenBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1994 | /*! The bit depth of the blue channel of the video mode. |
| 1995 | */ |
Camilla Berglund | 2e8446f | 2013-04-11 01:31:00 +0200 | [diff] [blame] | 1996 | int blueBits; |
Camilla Berglund | 731812c | 2013-05-30 15:52:42 +0200 | [diff] [blame] | 1997 | /*! The refresh rate, in Hz, of the video mode. |
| 1998 | */ |
| 1999 | int refreshRate; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2000 | } GLFWvidmode; |
| 2001 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2002 | /*! @brief Gamma ramp. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2003 | * |
| 2004 | * This describes the gamma ramp for a monitor. |
| 2005 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 2006 | * @sa @ref monitor_gamma |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2007 | * @sa @ref glfwGetGammaRamp |
| 2008 | * @sa @ref glfwSetGammaRamp |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2009 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2010 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 2011 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2012 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2013 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 2014 | typedef struct GLFWgammaramp |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 2015 | { |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2016 | /*! An array of value describing the response of the red channel. |
| 2017 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2018 | unsigned short* red; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2019 | /*! An array of value describing the response of the green channel. |
| 2020 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2021 | unsigned short* green; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2022 | /*! An array of value describing the response of the blue channel. |
| 2023 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2024 | unsigned short* blue; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 2025 | /*! The number of elements in each array. |
| 2026 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2027 | unsigned int size; |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 2028 | } GLFWgammaramp; |
| 2029 | |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 2030 | /*! @brief Image data. |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 2031 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 2032 | * This describes a single 2D image. See the documentation for each related |
| 2033 | * function what the expected pixel format is. |
| 2034 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 2035 | * @sa @ref cursor_custom |
Camilla Berglund | fe0317a | 2016-08-01 11:51:30 +0200 | [diff] [blame] | 2036 | * @sa @ref window_icon |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 2037 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2038 | * @since Added in version 2.1. |
| 2039 | * @glfw3 Removed format and bytes-per-pixel members. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 2040 | * |
| 2041 | * @ingroup window |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 2042 | */ |
| 2043 | typedef struct GLFWimage |
| 2044 | { |
| 2045 | /*! The width, in pixels, of this image. |
| 2046 | */ |
| 2047 | int width; |
| 2048 | /*! The height, in pixels, of this image. |
| 2049 | */ |
| 2050 | int height; |
| 2051 | /*! The pixel data of this image, arranged left-to-right, top-to-bottom. |
| 2052 | */ |
| 2053 | unsigned char* pixels; |
| 2054 | } GLFWimage; |
| 2055 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 2056 | /*! @brief Gamepad input state |
| 2057 | * |
| 2058 | * This describes the input state of a gamepad. |
| 2059 | * |
| 2060 | * @sa @ref gamepad |
| 2061 | * @sa @ref glfwGetGamepadState |
| 2062 | * |
| 2063 | * @since Added in version 3.3. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 2064 | * |
| 2065 | * @ingroup input |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 2066 | */ |
| 2067 | typedef struct GLFWgamepadstate |
| 2068 | { |
| 2069 | /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS` |
| 2070 | * or `GLFW_RELEASE`. |
| 2071 | */ |
Camilla Löwy | 2d8d8f5 | 2017-07-17 21:18:15 +0200 | [diff] [blame] | 2072 | unsigned char buttons[15]; |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 2073 | /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0 |
| 2074 | * to 1.0 inclusive. |
| 2075 | */ |
| 2076 | float axes[6]; |
| 2077 | } GLFWgamepadstate; |
| 2078 | |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2079 | /*! @brief |
| 2080 | * |
| 2081 | * @sa @ref init_allocator |
| 2082 | * @sa @ref glfwInitAllocator |
| 2083 | * |
| 2084 | * @since Added in version 3.4. |
| 2085 | * |
| 2086 | * @ingroup init |
| 2087 | */ |
| 2088 | typedef struct GLFWallocator |
| 2089 | { |
| 2090 | GLFWallocatefun allocate; |
| 2091 | GLFWreallocatefun reallocate; |
| 2092 | GLFWdeallocatefun deallocate; |
| 2093 | void* user; |
| 2094 | } GLFWallocator; |
| 2095 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2096 | |
| 2097 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 2098 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2099 | *************************************************************************/ |
| 2100 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2101 | /*! @brief Initializes the GLFW library. |
| 2102 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2103 | * This function initializes the GLFW library. Before most GLFW functions can |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2104 | * be used, GLFW must be initialized, and before an application terminates GLFW |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2105 | * should be terminated in order to free any resources allocated during or |
| 2106 | * after initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2107 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 2108 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2109 | * succeeds, you should call @ref glfwTerminate before the application exits. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 2110 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2111 | * Additional calls to this function after successful initialization but before |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 2112 | * termination will return `GLFW_TRUE` immediately. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2113 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2114 | * The @ref GLFW_PLATFORM init hint controls which platforms are considered during |
| 2115 | * initialization. This also depends on which platforms the library was compiled to |
| 2116 | * support. |
| 2117 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 2118 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2119 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2120 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2121 | * @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref |
| 2122 | * GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2123 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2124 | * @remark @macos This function will change the current directory of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2125 | * application to the `Contents/Resources` subdirectory of the application's |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2126 | * bundle, if present. This can be disabled with the @ref |
| 2127 | * GLFW_COCOA_CHDIR_RESOURCES init hint. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2128 | * |
Camilla Löwy | 72366ac | 2020-03-05 20:32:19 +0100 | [diff] [blame] | 2129 | * @remark @macos This function will create the main menu and dock icon for the |
| 2130 | * application. If GLFW finds a `MainMenu.nib` it is loaded and assumed to |
| 2131 | * contain a menu bar. Otherwise a minimal menu bar is created manually with |
| 2132 | * common commands like Hide, Quit and About. The About entry opens a minimal |
| 2133 | * about dialog with information from the application's bundle. The menu bar |
| 2134 | * and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init |
| 2135 | * hint. |
| 2136 | * |
Camilla Löwy | 4381b86 | 2020-02-06 15:46:37 +0100 | [diff] [blame] | 2137 | * @remark @x11 This function will set the `LC_CTYPE` category of the |
| 2138 | * application locale according to the current environment if that category is |
| 2139 | * still "C". This is because the "C" locale breaks Unicode text input. |
| 2140 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2141 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2142 | * |
| 2143 | * @sa @ref intro_init |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2144 | * @sa @ref glfwInitHint |
| 2145 | * @sa @ref glfwInitAllocator |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2146 | * @sa @ref glfwTerminate |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2147 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2148 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2149 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2150 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2151 | */ |
| 2152 | GLFWAPI int glfwInit(void); |
| 2153 | |
| 2154 | /*! @brief Terminates the GLFW library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2155 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2156 | * This function destroys all remaining windows and cursors, restores any |
| 2157 | * modified gamma ramps and frees any other allocated resources. Once this |
| 2158 | * function is called, you must again call @ref glfwInit successfully before |
| 2159 | * you will be able to use most GLFW functions. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 2160 | * |
| 2161 | * If GLFW has been successfully initialized, this function should be called |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2162 | * before the application exits. If initialization fails, there is no need to |
| 2163 | * call this function, as it is called by @ref glfwInit before it returns |
| 2164 | * failure. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 2165 | * |
A. Tombs | 7486e12 | 2020-05-22 14:37:58 +0100 | [diff] [blame] | 2166 | * This function has no effect if GLFW is not initialized. |
| 2167 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2168 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
| 2169 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2170 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2171 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 2172 | * @warning The contexts of any remaining windows must not be current on any |
| 2173 | * other thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2174 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2175 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 2176 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2177 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2178 | * |
| 2179 | * @sa @ref intro_init |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2180 | * @sa @ref glfwInit |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2181 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2182 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2183 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2184 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2185 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 2186 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2187 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2188 | /*! @brief Sets the specified init hint to the desired value. |
| 2189 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2190 | * This function sets hints for the next initialization of GLFW. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2191 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 2192 | * The values you set hints to are never reset by GLFW, but they only take |
| 2193 | * effect during initialization. Once GLFW has been initialized, any values |
| 2194 | * you set will be ignored until the library is terminated and initialized |
| 2195 | * again. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2196 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 2197 | * 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] | 2198 | * will only affect their specific platform. Other platforms will ignore them. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 2199 | * Setting these hints requires no platform specific headers or functions. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 2200 | * |
| 2201 | * @param[in] hint The [init hint](@ref init_hints) to set. |
| 2202 | * @param[in] value The new value of the init hint. |
| 2203 | * |
| 2204 | * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref |
| 2205 | * GLFW_INVALID_VALUE. |
| 2206 | * |
| 2207 | * @remarks This function may be called before @ref glfwInit. |
| 2208 | * |
| 2209 | * @thread_safety This function must only be called from the main thread. |
| 2210 | * |
| 2211 | * @sa init_hints |
| 2212 | * @sa glfwInit |
| 2213 | * |
| 2214 | * @since Added in version 3.3. |
| 2215 | * |
| 2216 | * @ingroup init |
| 2217 | */ |
| 2218 | GLFWAPI void glfwInitHint(int hint, int value); |
| 2219 | |
Camilla Löwy | 22b586b | 2021-08-03 20:53:48 +0200 | [diff] [blame] | 2220 | /*! @brief Sets the init allocator to the desired value. |
| 2221 | * |
| 2222 | * To use the default allocator, call this function with a `NULL` argument. |
| 2223 | * |
| 2224 | * If you specify an allocator struct, every member must be a valid function |
| 2225 | * pointer. If any member is `NULL`, this function emits @ref |
| 2226 | * GLFW_INVALID_VALUE and the init allocator is unchanged. |
| 2227 | * |
| 2228 | * @param[in] allocator The allocator to use at the next initialization, or |
| 2229 | * `NULL` to use the default one. |
| 2230 | * |
| 2231 | * @errors Possible errors include @ref GLFW_INVALID_VALUE. |
| 2232 | * |
| 2233 | * @pointer_lifetime The specified allocator is copied before this function |
| 2234 | * returns. |
| 2235 | * |
| 2236 | * @thread_safety This function must only be called from the main thread. |
| 2237 | * |
| 2238 | * @sa @ref init_allocator |
| 2239 | * @sa @ref glfwInit |
| 2240 | * |
| 2241 | * @since Added in version 3.4. |
| 2242 | * |
| 2243 | * @ingroup init |
| 2244 | */ |
| 2245 | GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator); |
| 2246 | |
Camilla Löwy | 76a5f78 | 2021-10-21 20:45:44 +0200 | [diff] [blame] | 2247 | #if defined(VK_VERSION_1_0) |
| 2248 | |
| 2249 | /*! @brief Sets the desired Vulkan `vkGetInstanceProcAddr` function. |
| 2250 | * |
| 2251 | * This function sets the `vkGetInstanceProcAddr` function that GLFW will use for all |
| 2252 | * Vulkan related entry point queries. |
| 2253 | * |
| 2254 | * This feature is mostly useful on macOS, if your copy of the Vulkan loader is in |
| 2255 | * a location where GLFW cannot find it through dynamic loading, or if you are still |
| 2256 | * using the static library version of the loader. |
| 2257 | * |
| 2258 | * If set to `NULL`, GLFW will try to load the Vulkan loader dynamically by its standard |
| 2259 | * name and get this function from there. This is the default behavior. |
| 2260 | * |
| 2261 | * The standard name of the loader is `vulkan-1.dll` on Windows, `libvulkan.so.1` on |
| 2262 | * Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS. If your code is |
| 2263 | * also loading it via these names then you probably don't need to use this function. |
| 2264 | * |
| 2265 | * The function address you set is never reset by GLFW, but it only takes effect during |
| 2266 | * initialization. Once GLFW has been initialized, any updates will be ignored until the |
| 2267 | * library is terminated and initialized again. |
| 2268 | * |
| 2269 | * @param[in] loader The address of the function to use, or `NULL`. |
| 2270 | * |
| 2271 | * @par Loader function signature |
| 2272 | * @code |
| 2273 | * PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* name) |
| 2274 | * @endcode |
| 2275 | * For more information about this function, see the |
| 2276 | * [Vulkan Registry](https://www.khronos.org/registry/vulkan/). |
| 2277 | * |
| 2278 | * @errors None. |
| 2279 | * |
| 2280 | * @remark This function may be called before @ref glfwInit. |
| 2281 | * |
| 2282 | * @thread_safety This function must only be called from the main thread. |
| 2283 | * |
| 2284 | * @sa @ref vulkan_loader |
| 2285 | * @sa @ref glfwInit |
| 2286 | * |
| 2287 | * @since Added in version 3.4. |
| 2288 | * |
| 2289 | * @ingroup init |
| 2290 | */ |
| 2291 | GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader); |
| 2292 | |
| 2293 | #endif /*VK_VERSION_1_0*/ |
| 2294 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2295 | /*! @brief Retrieves the version of the GLFW library. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2296 | * |
| 2297 | * This function retrieves the major, minor and revision numbers of the GLFW |
| 2298 | * library. It is intended for when you are using GLFW as a shared library and |
| 2299 | * want to ensure that you are using the minimum required version. |
| 2300 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2301 | * Any or all of the version arguments may be `NULL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2302 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2303 | * @param[out] major Where to store the major version number, or `NULL`. |
| 2304 | * @param[out] minor Where to store the minor version number, or `NULL`. |
| 2305 | * @param[out] rev Where to store the revision number, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2306 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2307 | * @errors None. |
| 2308 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2309 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2310 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2311 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2312 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2313 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2314 | * @sa @ref glfwGetVersionString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2315 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2316 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2317 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2318 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2319 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 2320 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2321 | |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 2322 | /*! @brief Returns a string describing the compile-time configuration. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2323 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2324 | * This function returns the compile-time generated |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2325 | * [version string](@ref intro_version_string) of the GLFW library binary. It describes |
| 2326 | * the version, platforms, compiler and any platform or operating system specific |
| 2327 | * compile-time options. It should not be confused with the OpenGL or OpenGL ES version |
| 2328 | * string, queried with `glGetString`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2329 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2330 | * __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] | 2331 | * @ref glfwGetVersion function provides the version of the running library |
| 2332 | * binary in numerical format. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2333 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2334 | * __Do not use the version string__ to parse what platforms are supported. The @ref |
| 2335 | * glfwPlatformSupported function lets you query platform support. |
| 2336 | * |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 2337 | * @return The ASCII encoded GLFW version string. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2338 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2339 | * @errors None. |
| 2340 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2341 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2342 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2343 | * @pointer_lifetime The returned string is static and compile-time generated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2344 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2345 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2346 | * |
| 2347 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2348 | * @sa @ref glfwGetVersion |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2349 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2350 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2351 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2352 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2353 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 2354 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2355 | |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2356 | /*! @brief Returns and clears the last error for the calling thread. |
| 2357 | * |
Camilla Löwy | 2e9aff7 | 2017-07-09 14:46:39 +0200 | [diff] [blame] | 2358 | * 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] | 2359 | * error that occurred on the calling thread, and optionally a UTF-8 encoded |
| 2360 | * 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] | 2361 | * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is |
| 2362 | * set to `NULL`. |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2363 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 2364 | * @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] | 2365 | * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR |
| 2366 | * (zero). |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2367 | * |
| 2368 | * @errors None. |
| 2369 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 2370 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 2371 | * should not free it yourself. It is guaranteed to be valid only until the |
| 2372 | * next error occurs or the library is terminated. |
| 2373 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2374 | * @remark This function may be called before @ref glfwInit. |
| 2375 | * |
| 2376 | * @thread_safety This function may be called from any thread. |
| 2377 | * |
| 2378 | * @sa @ref error_handling |
| 2379 | * @sa @ref glfwSetErrorCallback |
| 2380 | * |
| 2381 | * @since Added in version 3.3. |
| 2382 | * |
| 2383 | * @ingroup init |
| 2384 | */ |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 2385 | GLFWAPI int glfwGetError(const char** description); |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2386 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2387 | /*! @brief Sets the error callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2388 | * |
| 2389 | * This function sets the error callback, which is called with an error code |
| 2390 | * and a human-readable description each time a GLFW error occurs. |
| 2391 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2392 | * The error code is set before the callback is called. Calling @ref |
| 2393 | * glfwGetError from the error callback will return the same value as the error |
| 2394 | * code argument. |
| 2395 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2396 | * The error callback is called on the thread where the error occurred. If you |
| 2397 | * are using GLFW from multiple threads, your error callback needs to be |
| 2398 | * written accordingly. |
| 2399 | * |
| 2400 | * Because the description string may have been generated specifically for that |
| 2401 | * error, it is not guaranteed to be valid after the callback has returned. If |
| 2402 | * you wish to use it after the callback returns, you need to make a copy. |
| 2403 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 2404 | * Once set, the error callback remains set even after the library has been |
| 2405 | * terminated. |
| 2406 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2407 | * @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] | 2408 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2409 | * @return The previously set callback, or `NULL` if no callback was set. |
| 2410 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2411 | * @callback_signature |
| 2412 | * @code |
| 2413 | * void callback_name(int error_code, const char* description) |
| 2414 | * @endcode |
| 2415 | * For more information about the callback parameters, see the |
| 2416 | * [callback pointer type](@ref GLFWerrorfun). |
| 2417 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2418 | * @errors None. |
| 2419 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2420 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2421 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2422 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2423 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2424 | * @sa @ref error_handling |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 2425 | * @sa @ref glfwGetError |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2426 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2427 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2428 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2429 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2430 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2431 | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 2432 | |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2433 | /*! @brief Returns the currently selected platform. |
| 2434 | * |
| 2435 | * This function returns the platform that was selected during initialization. The |
| 2436 | * returned value will be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, |
| 2437 | * `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`. |
| 2438 | * |
| 2439 | * @return The currently selected platform, or zero if an error occurred. |
| 2440 | * |
| 2441 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2442 | * |
| 2443 | * @thread_safety This function may be called from any thread. |
| 2444 | * |
| 2445 | * @sa @ref platform |
| 2446 | * @sa @ref glfwPlatformSupported |
| 2447 | * |
| 2448 | * @since Added in version 3.4. |
| 2449 | * |
| 2450 | * @ingroup init |
| 2451 | */ |
| 2452 | GLFWAPI int glfwGetPlatform(void); |
| 2453 | |
| 2454 | /*! @brief Returns whether the library includes support for the specified platform. |
| 2455 | * |
| 2456 | * This function returns whether the library was compiled with support for the specified |
| 2457 | * platform. The platform must be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, |
| 2458 | * `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`. |
| 2459 | * |
| 2460 | * @param[in] platform The platform to query. |
| 2461 | * @return `GLFW_TRUE` if the platform is supported, or `GLFW_FALSE` otherwise. |
| 2462 | * |
| 2463 | * @errors Possible errors include @ref GLFW_INVALID_ENUM. |
| 2464 | * |
| 2465 | * @remark This function may be called before @ref glfwInit. |
| 2466 | * |
| 2467 | * @thread_safety This function may be called from any thread. |
| 2468 | * |
| 2469 | * @sa @ref platform |
| 2470 | * @sa @ref glfwGetPlatform |
| 2471 | * |
| 2472 | * @since Added in version 3.4. |
| 2473 | * |
| 2474 | * @ingroup init |
| 2475 | */ |
| 2476 | GLFWAPI int glfwPlatformSupported(int platform); |
| 2477 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2478 | /*! @brief Returns the currently connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2479 | * |
| 2480 | * This function returns an array of handles for all currently connected |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2481 | * monitors. The primary monitor is always first in the returned array. If no |
| 2482 | * monitors were found, this function returns `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2483 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2484 | * @param[out] count Where to store the number of monitors in the returned |
| 2485 | * array. This is set to zero if an error occurred. |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2486 | * @return An array of monitor handles, or `NULL` if no monitors were found or |
| 2487 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2488 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2489 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2490 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2491 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2492 | * should not free it yourself. It is guaranteed to be valid only until the |
| 2493 | * monitor configuration changes or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +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 | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2496 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2497 | * @sa @ref monitor_monitors |
| 2498 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2499 | * @sa @ref glfwGetPrimaryMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2500 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2501 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2502 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2503 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2504 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2505 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2506 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2507 | /*! @brief Returns the primary monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2508 | * |
| 2509 | * This function returns the primary monitor. This is usually the monitor |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2510 | * where elements like the task bar or global menu bar are located. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2511 | * |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 2512 | * @return The primary monitor, or `NULL` if no monitors were found or if an |
| 2513 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2514 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2515 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2516 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2517 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2518 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2519 | * @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] | 2520 | * glfwGetMonitors. |
| 2521 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2522 | * @sa @ref monitor_monitors |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2523 | * @sa @ref glfwGetMonitors |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2524 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2525 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2526 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2527 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2528 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2529 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2530 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2531 | /*! @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] | 2532 | * |
| 2533 | * This function returns the position, in screen coordinates, of the upper-left |
| 2534 | * corner of the specified monitor. |
| 2535 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2536 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 2537 | * non-`NULL` position arguments will be set to zero. |
| 2538 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2539 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2540 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 2541 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2542 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2543 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2544 | * GLFW_PLATFORM_ERROR. |
| 2545 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2546 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2547 | * |
| 2548 | * @sa @ref monitor_properties |
| 2549 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2550 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2551 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2552 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2553 | */ |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2554 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
| 2555 | |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 2556 | /*! @brief Retrieves the work area of the monitor. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2557 | * |
| 2558 | * 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] | 2559 | * corner of the work area of the specified monitor along with the work area |
| 2560 | * 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] | 2561 | * 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] | 2562 | * task bar exists then the work area is the monitor resolution in screen |
| 2563 | * coordinates. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2564 | * |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame] | 2565 | * Any or all of the position and size arguments may be `NULL`. If an error |
| 2566 | * 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] | 2567 | * |
| 2568 | * @param[in] monitor The monitor to query. |
| 2569 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 2570 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Doug Binks | 3fd70cc | 2018-09-08 17:16:07 +0200 | [diff] [blame] | 2571 | * @param[out] width Where to store the monitor width, or `NULL`. |
| 2572 | * @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] | 2573 | * |
| 2574 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2575 | * GLFW_PLATFORM_ERROR. |
| 2576 | * |
| 2577 | * @thread_safety This function must only be called from the main thread. |
| 2578 | * |
Camilla Löwy | a43d1a4 | 2019-02-25 14:46:48 +0100 | [diff] [blame] | 2579 | * @sa @ref monitor_workarea |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2580 | * |
Doug Binks | 6907629 | 2018-09-08 17:24:20 +0200 | [diff] [blame] | 2581 | * @since Added in version 3.3. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 2582 | * |
| 2583 | * @ingroup monitor |
| 2584 | */ |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame] | 2585 | 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] | 2586 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2587 | /*! @brief Returns the physical size of the monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2588 | * |
| 2589 | * This function returns the size, in millimetres, of the display area of the |
| 2590 | * specified monitor. |
| 2591 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 2592 | * Some platforms do not provide accurate monitor size information, either |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2593 | * because the monitor |
| 2594 | * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) |
| 2595 | * data is incorrect or because the driver does not report it accurately. |
| 2596 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2597 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2598 | * non-`NULL` size arguments will be set to zero. |
| 2599 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2600 | * @param[in] monitor The monitor to query. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2601 | * @param[out] widthMM Where to store the width, in millimetres, of the |
| 2602 | * monitor's display area, or `NULL`. |
| 2603 | * @param[out] heightMM Where to store the height, in millimetres, of the |
| 2604 | * monitor's display area, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2605 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2606 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2607 | * |
Camilla Löwy | 6a20053 | 2021-10-12 00:23:37 +0200 | [diff] [blame] | 2608 | * @remark @win32 On Windows 8 and earlier the physical size is calculated from |
| 2609 | * 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] | 2610 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2611 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2612 | * |
| 2613 | * @sa @ref monitor_properties |
| 2614 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2615 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2616 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2617 | * @ingroup monitor |
| 2618 | */ |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2619 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2620 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2621 | /*! @brief Retrieves the content scale for the specified monitor. |
| 2622 | * |
| 2623 | * This function retrieves the content scale for the specified monitor. The |
| 2624 | * 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] | 2625 | * default DPI. This is especially important for text and any UI elements. If |
| 2626 | * the pixel dimensions of your UI scaled by this look appropriate on your |
| 2627 | * machine then it should appear at a reasonable size on other machines |
| 2628 | * regardless of their DPI and scaling settings. This relies on the system DPI |
| 2629 | * and scaling settings being somewhat correct. |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2630 | * |
| 2631 | * The content scale may depend on both the monitor resolution and pixel |
| 2632 | * density and on user settings. It may be very different from the raw DPI |
| 2633 | * calculated from the physical size and current resolution. |
| 2634 | * |
| 2635 | * @param[in] monitor The monitor to query. |
| 2636 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 2637 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 2638 | * |
| 2639 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2640 | * GLFW_PLATFORM_ERROR. |
| 2641 | * |
| 2642 | * @thread_safety This function must only be called from the main thread. |
| 2643 | * |
| 2644 | * @sa @ref monitor_scale |
| 2645 | * @sa @ref glfwGetWindowContentScale |
| 2646 | * |
| 2647 | * @since Added in version 3.3. |
| 2648 | * |
| 2649 | * @ingroup monitor |
| 2650 | */ |
| 2651 | GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); |
| 2652 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2653 | /*! @brief Returns the name of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2654 | * |
| 2655 | * 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] | 2656 | * specified monitor. The name typically reflects the make and model of the |
| 2657 | * monitor and is not guaranteed to be unique among the connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2658 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2659 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2660 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an |
| 2661 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2662 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2663 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2664 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2665 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 2666 | * should not free it yourself. It is valid until the specified monitor is |
| 2667 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2668 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2669 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2670 | * |
| 2671 | * @sa @ref monitor_properties |
| 2672 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2673 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2674 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2675 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2676 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2677 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2678 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 2679 | /*! @brief Sets the user pointer of the specified monitor. |
| 2680 | * |
| 2681 | * This function sets the user-defined pointer of the specified monitor. The |
| 2682 | * current value is retained until the monitor is disconnected. The initial |
| 2683 | * value is `NULL`. |
| 2684 | * |
| 2685 | * This function may be called from the monitor callback, even for a monitor |
| 2686 | * that is being disconnected. |
| 2687 | * |
| 2688 | * @param[in] monitor The monitor whose pointer to set. |
| 2689 | * @param[in] pointer The new value. |
| 2690 | * |
| 2691 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2692 | * |
| 2693 | * @thread_safety This function may be called from any thread. Access is not |
| 2694 | * synchronized. |
| 2695 | * |
| 2696 | * @sa @ref monitor_userptr |
| 2697 | * @sa @ref glfwGetMonitorUserPointer |
| 2698 | * |
| 2699 | * @since Added in version 3.3. |
| 2700 | * |
| 2701 | * @ingroup monitor |
| 2702 | */ |
| 2703 | GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); |
| 2704 | |
| 2705 | /*! @brief Returns the user pointer of the specified monitor. |
| 2706 | * |
| 2707 | * This function returns the current value of the user-defined pointer of the |
| 2708 | * specified monitor. The initial value is `NULL`. |
| 2709 | * |
| 2710 | * This function may be called from the monitor callback, even for a monitor |
| 2711 | * that is being disconnected. |
| 2712 | * |
| 2713 | * @param[in] monitor The monitor whose pointer to return. |
| 2714 | * |
| 2715 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2716 | * |
| 2717 | * @thread_safety This function may be called from any thread. Access is not |
| 2718 | * synchronized. |
| 2719 | * |
| 2720 | * @sa @ref monitor_userptr |
| 2721 | * @sa @ref glfwSetMonitorUserPointer |
| 2722 | * |
| 2723 | * @since Added in version 3.3. |
| 2724 | * |
| 2725 | * @ingroup monitor |
| 2726 | */ |
| 2727 | GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); |
| 2728 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2729 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2730 | * |
| 2731 | * This function sets the monitor configuration callback, or removes the |
| 2732 | * currently set callback. This is called when a monitor is connected to or |
| 2733 | * disconnected from the system. |
| 2734 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2735 | * @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] | 2736 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2737 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2738 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2739 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2740 | * @callback_signature |
| 2741 | * @code |
| 2742 | * void function_name(GLFWmonitor* monitor, int event) |
| 2743 | * @endcode |
| 2744 | * For more information about the callback parameters, see the |
| 2745 | * [function pointer type](@ref GLFWmonitorfun). |
| 2746 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2747 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2748 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2749 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2750 | * |
| 2751 | * @sa @ref monitor_event |
| 2752 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2753 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2754 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2755 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2756 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 2757 | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 2758 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2759 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2760 | * |
| 2761 | * 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] | 2762 | * 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] | 2763 | * bit depth (the sum of all channel depths), then by resolution area (the |
| 2764 | * product of width and height), then resolution width and finally by refresh |
| 2765 | * rate. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2766 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2767 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2768 | * @param[out] count Where to store the number of video modes in the returned |
| 2769 | * array. This is set to zero if an error occurred. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2770 | * @return An array of video modes, or `NULL` if an |
| 2771 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2772 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2773 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2774 | * GLFW_PLATFORM_ERROR. |
| 2775 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2776 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2777 | * should not free it yourself. It is valid until the specified monitor is |
| 2778 | * disconnected, this function is called again for that monitor or the library |
| 2779 | * is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2780 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2781 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2782 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2783 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2784 | * @sa @ref glfwGetVideoMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2785 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2786 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2787 | * @glfw3 Changed to return an array of modes for a specific monitor. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2788 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2789 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2790 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2791 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2792 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2793 | /*! @brief Returns the current mode of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2794 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2795 | * This function returns the current video mode of the specified monitor. If |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2796 | * you have created a full screen window for that monitor, the return value |
| 2797 | * will depend on whether that window is iconified. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2798 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2799 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2800 | * @return The current mode of the monitor, or `NULL` if an |
| 2801 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2802 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2803 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2804 | * GLFW_PLATFORM_ERROR. |
| 2805 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2806 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2807 | * should not free it yourself. It is valid until the specified monitor is |
| 2808 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2809 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2810 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2811 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2812 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2813 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2814 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2815 | * @since Added in version 3.0. Replaces `glfwGetDesktopMode`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2816 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2817 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2818 | */ |
Camilla Berglund | ce1e84d | 2013-05-22 22:16:43 +0200 | [diff] [blame] | 2819 | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2820 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2821 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2822 | * |
Camilla Löwy | 3531c32 | 2018-12-17 17:40:18 +0100 | [diff] [blame] | 2823 | * This function generates an appropriately sized gamma ramp from the specified |
| 2824 | * exponent and then calls @ref glfwSetGammaRamp with it. The value must be |
| 2825 | * a finite number greater than zero. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2826 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2827 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2828 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2829 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2830 | * the default (usually sRGB-like) behavior. |
| 2831 | * |
| 2832 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2833 | * GLFW_SRGB_CAPABLE hint. |
| 2834 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2835 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 2836 | * @param[in] gamma The desired exponent. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2837 | * |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame^] | 2838 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE, |
| 2839 | * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2840 | * |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 2841 | * @remark @wayland Gamma handling is a privileged protocol, this function |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame^] | 2842 | * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2843 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2844 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2845 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2846 | * @sa @ref monitor_gamma |
| 2847 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2848 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2849 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2850 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2851 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2852 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2853 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2854 | /*! @brief Returns the current gamma ramp for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2855 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2856 | * This function returns the current gamma ramp of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2857 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2858 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2859 | * @return The current gamma ramp, or `NULL` if an |
| 2860 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2861 | * |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame^] | 2862 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR |
| 2863 | * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2864 | * |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 2865 | * @remark @wayland Gamma handling is a privileged protocol, this function |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame^] | 2866 | * 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] | 2867 | * returning `NULL`. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2868 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2869 | * @pointer_lifetime The returned structure and its arrays are allocated and |
| 2870 | * freed by GLFW. You should not free them yourself. They are valid until the |
| 2871 | * specified monitor is disconnected, this function is called again for that |
| 2872 | * monitor or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2873 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2874 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2875 | * |
| 2876 | * @sa @ref monitor_gamma |
| 2877 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2878 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2879 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2880 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2881 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2882 | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2883 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2884 | /*! @brief Sets the current gamma ramp for the specified monitor. |
| 2885 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2886 | * This function sets the current gamma ramp for the specified monitor. The |
| 2887 | * original gamma ramp for that monitor is saved by GLFW the first time this |
| 2888 | * function is called and is restored by @ref glfwTerminate. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2889 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2890 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2891 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2892 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2893 | * the default (usually sRGB-like) behavior. |
| 2894 | * |
| 2895 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2896 | * GLFW_SRGB_CAPABLE hint. |
| 2897 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2898 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2899 | * @param[in] ramp The gamma ramp to use. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 2900 | * |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame^] | 2901 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR |
| 2902 | * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2903 | * |
Camilla Löwy | 3531c32 | 2018-12-17 17:40:18 +0100 | [diff] [blame] | 2904 | * @remark The size of the specified gamma ramp should match the size of the |
| 2905 | * current ramp for that monitor. |
Camilla Berglund | 76fff4d | 2015-03-10 19:02:28 +0100 | [diff] [blame] | 2906 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2907 | * @remark @win32 The gamma ramp size must be 256. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2908 | * |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 2909 | * @remark @wayland Gamma handling is a privileged protocol, this function |
Camilla Löwy | b2b087c | 2022-09-20 16:17:22 +0200 | [diff] [blame^] | 2910 | * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2911 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2912 | * @pointer_lifetime The specified gamma ramp is copied before this function |
| 2913 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2914 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2915 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2916 | * |
| 2917 | * @sa @ref monitor_gamma |
| 2918 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2919 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2920 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2921 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2922 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2923 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 2924 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2925 | /*! @brief Resets all window hints to their default values. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2926 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2927 | * This function resets all window hints to their |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2928 | * [default values](@ref window_hints_values). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2929 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2930 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2931 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2932 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2933 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2934 | * @sa @ref window_hints |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2935 | * @sa @ref glfwWindowHint |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2936 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2937 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2938 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2939 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2940 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2941 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 2942 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2943 | |
| 2944 | /*! @brief Sets the specified window hint to the desired value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2945 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 2946 | * 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] | 2947 | * hints, once set, retain their values until changed by a call to this |
| 2948 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 2949 | * |
| 2950 | * Only integer value hints can be set with this function. String value hints |
| 2951 | * are set with @ref glfwWindowHintString. |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 2952 | * |
Camilla Berglund | d6e0a43 | 2016-02-09 07:41:48 +0100 | [diff] [blame] | 2953 | * This function does not check whether the specified hint values are valid. |
| 2954 | * If you set hints to invalid values this will instead be reported by the next |
| 2955 | * call to @ref glfwCreateWindow. |
| 2956 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2957 | * Some hints are platform specific. These may be set on any platform but they |
| 2958 | * will only affect their specific platform. Other platforms will ignore them. |
| 2959 | * Setting these hints requires no platform specific headers or functions. |
| 2960 | * |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 2961 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 2962 | * @param[in] value The new value of the window hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2963 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2964 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2965 | * GLFW_INVALID_ENUM. |
| 2966 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2967 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 2968 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2969 | * @sa @ref window_hints |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2970 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2971 | * @sa @ref glfwDefaultWindowHints |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2972 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2973 | * @since Added in version 3.0. Replaces `glfwOpenWindowHint`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2974 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2975 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2976 | */ |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 2977 | GLFWAPI void glfwWindowHint(int hint, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2978 | |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2979 | /*! @brief Sets the specified window hint to the desired value. |
| 2980 | * |
| 2981 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 2982 | * hints, once set, retain their values until changed by a call to this |
| 2983 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 2984 | * |
| 2985 | * Only string type hints can be set with this function. Integer value hints |
| 2986 | * are set with @ref glfwWindowHint. |
| 2987 | * |
| 2988 | * This function does not check whether the specified hint values are valid. |
| 2989 | * If you set hints to invalid values this will instead be reported by the next |
| 2990 | * call to @ref glfwCreateWindow. |
| 2991 | * |
| 2992 | * Some hints are platform specific. These may be set on any platform but they |
| 2993 | * will only affect their specific platform. Other platforms will ignore them. |
| 2994 | * Setting these hints requires no platform specific headers or functions. |
| 2995 | * |
| 2996 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 2997 | * @param[in] value The new value of the window hint. |
| 2998 | * |
| 2999 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3000 | * GLFW_INVALID_ENUM. |
| 3001 | * |
| 3002 | * @pointer_lifetime The specified string is copied before this function |
| 3003 | * returns. |
| 3004 | * |
| 3005 | * @thread_safety This function must only be called from the main thread. |
| 3006 | * |
| 3007 | * @sa @ref window_hints |
| 3008 | * @sa @ref glfwWindowHint |
| 3009 | * @sa @ref glfwDefaultWindowHints |
| 3010 | * |
| 3011 | * @since Added in version 3.3. |
| 3012 | * |
| 3013 | * @ingroup window |
| 3014 | */ |
| 3015 | GLFWAPI void glfwWindowHintString(int hint, const char* value); |
| 3016 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3017 | /*! @brief Creates a window and its associated context. |
| 3018 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3019 | * This function creates a window and its associated OpenGL or OpenGL ES |
| 3020 | * context. Most of the options controlling how the window and its context |
| 3021 | * should be created are specified with [window hints](@ref window_hints). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3022 | * |
| 3023 | * Successful creation does not change which context is current. Before you |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3024 | * can use the newly created context, you need to |
| 3025 | * [make it current](@ref context_current). For information about the `share` |
| 3026 | * parameter, see @ref context_sharing. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3027 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3028 | * The created window, framebuffer and context may differ from what you |
| 3029 | * requested, as not all parameters and hints are |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 3030 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3031 | * window, especially for full screen windows. To query the actual attributes |
Camilla Berglund | e8bceaa | 2015-04-07 14:37:42 +0200 | [diff] [blame] | 3032 | * of the created window, framebuffer and context, see @ref |
| 3033 | * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3034 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3035 | * 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] | 3036 | * will cover. If no monitor is specified, the window will be windowed mode. |
| 3037 | * Unless you have a way for the user to choose a specific monitor, it is |
| 3038 | * recommended that you pick the primary monitor. For more information on how |
| 3039 | * to query connected monitors, see @ref monitor_monitors. |
Camilla Berglund | 4b7ae49 | 2013-07-07 12:06:59 +0200 | [diff] [blame] | 3040 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3041 | * For full screen windows, the specified size becomes the resolution of the |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3042 | * window's _desired video mode_. As long as a full screen window is not |
| 3043 | * iconified, the supported video mode most closely matching the desired video |
| 3044 | * mode is set for the specified monitor. For more information about full |
| 3045 | * screen windows, including the creation of so called _windowed full screen_ |
| 3046 | * or _borderless full screen_ windows, see @ref window_windowed_full_screen. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3047 | * |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 3048 | * 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] | 3049 | * full screen mode with @ref glfwSetWindowMonitor. This will not affect its |
| 3050 | * OpenGL or OpenGL ES context. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 3051 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3052 | * By default, newly created windows use the placement recommended by the |
Camilla Löwy | 0f9a957 | 2021-10-26 14:25:03 +0200 | [diff] [blame] | 3053 | * window system. To create the window at a specific position, set the @ref |
| 3054 | * GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints before creation. To |
| 3055 | * restore the default behavior, set either or both hints back to |
| 3056 | * `GLFW_ANY_POSITION`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3057 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3058 | * As long as at least one full screen window is not iconified, the screensaver |
| 3059 | * is prohibited from starting. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3060 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3061 | * Window systems put limits on window sizes. Very large or very small window |
| 3062 | * dimensions may be overridden by the window system on creation. Check the |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3063 | * actual [size](@ref window_size) after creation. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3064 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3065 | * 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] | 3066 | * the initial value may vary depending on driver settings and defaults. |
| 3067 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3068 | * @param[in] width The desired width, in screen coordinates, of the window. |
| 3069 | * This must be greater than zero. |
| 3070 | * @param[in] height The desired height, in screen coordinates, of the window. |
| 3071 | * This must be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3072 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3073 | * @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] | 3074 | * windowed mode. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3075 | * @param[in] share The window whose context to share resources with, or `NULL` |
| 3076 | * to not share resources. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3077 | * @return The handle of the created window, or `NULL` if an |
| 3078 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3079 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3080 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3081 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref |
| 3082 | * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref |
| 3083 | * GLFW_PLATFORM_ERROR. |
| 3084 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3085 | * @remark @win32 Window creation will fail if the Microsoft GDI software |
| 3086 | * OpenGL implementation is the only one available. |
Camilla Berglund | 07db5da | 2013-09-26 19:15:36 +0200 | [diff] [blame] | 3087 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 3088 | * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it |
| 3089 | * 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] | 3090 | * the `IDI_APPLICATION` icon will be used instead. To set a different icon, |
| 3091 | * see @ref glfwSetWindowIcon. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3092 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3093 | * @remark @win32 The context to share resources with must not be current on |
| 3094 | * any other thread. |
Camilla Berglund | b19fb4c | 2014-12-27 21:14:41 +0100 | [diff] [blame] | 3095 | * |
Camilla Löwy | 82978bb | 2019-10-18 13:21:59 +0200 | [diff] [blame] | 3096 | * @remark @macos The OS only supports core profile contexts for OpenGL |
| 3097 | * versions 3.2 and later. Before creating an OpenGL context of version 3.2 or |
| 3098 | * later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) |
| 3099 | * hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all |
| 3100 | * on macOS. |
Camilla Löwy | fd127d5 | 2016-12-03 19:32:00 +0100 | [diff] [blame] | 3101 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 3102 | * @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] | 3103 | * 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] | 3104 | * For more information on bundles, see the |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3105 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 3106 | * in the Mac Developer Library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3107 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 3108 | * @remark @macos On OS X 10.10 and later the window frame will not be rendered |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 3109 | * at full resolution on Retina displays unless the |
| 3110 | * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) |
| 3111 | * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the |
| 3112 | * application bundle's `Info.plist`. For more information, see |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 3113 | * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html) |
Camilla Berglund | d12b343 | 2015-07-21 17:42:01 +0200 | [diff] [blame] | 3114 | * in the Mac Developer Library. The GLFW test and example programs use |
| 3115 | * a custom `Info.plist` template for this, which can be found as |
Camilla Löwy | 2fb3362 | 2019-12-03 22:03:36 +0100 | [diff] [blame] | 3116 | * `CMake/Info.plist.in` in the source tree. |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 3117 | * |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 3118 | * @remark @macos When activating frame autosaving with |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 3119 | * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 3120 | * window size and position may be overridden by previously saved values. |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 3121 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3122 | * @remark @x11 Some window managers will not respect the placement of |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3123 | * initially hidden windows. |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 3124 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3125 | * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for |
| 3126 | * a window to reach its requested state. This means you may not be able to |
| 3127 | * query the final size, position or other attributes directly after window |
| 3128 | * creation. |
Camilla Berglund | 20ed0a1 | 2015-08-12 21:31:54 +0200 | [diff] [blame] | 3129 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 3130 | * @remark @x11 The class part of the `WM_CLASS` window property will by |
| 3131 | * default be set to the window title passed to this function. The instance |
| 3132 | * 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] | 3133 | * present and not empty, or fall back to the window title. Set the |
| 3134 | * [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and |
| 3135 | * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to |
| 3136 | * override this. |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 3137 | * |
Emmanuel Gil Peyrot | bcd8f9a | 2019-02-15 19:02:32 +0100 | [diff] [blame] | 3138 | * @remark @wayland Compositors should implement the xdg-decoration protocol |
| 3139 | * for GLFW to decorate the window properly. If this protocol isn't |
| 3140 | * supported, or if the compositor prefers client-side decorations, a very |
| 3141 | * simple fallback frame will be drawn using the wp_viewporter protocol. A |
| 3142 | * compositor can still emit close, maximize or fullscreen events, using for |
| 3143 | * instance a keybind mechanism. If neither of these protocols is supported, |
| 3144 | * the window won't be decorated. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3145 | * |
| 3146 | * @remark @wayland A full screen window will not attempt to change the mode, |
| 3147 | * no matter what the requested size or refresh rate. |
| 3148 | * |
Emmanuel Gil Peyrot | 6516685 | 2017-02-17 15:52:50 +0000 | [diff] [blame] | 3149 | * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol |
| 3150 | * to be implemented in the user's compositor. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3151 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3152 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3153 | * |
| 3154 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3155 | * @sa @ref glfwDestroyWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3156 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3157 | * @since Added in version 3.0. Replaces `glfwOpenWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3158 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3159 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3160 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3161 | 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] | 3162 | |
| 3163 | /*! @brief Destroys the specified window and its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3164 | * |
| 3165 | * This function destroys the specified window and its context. On calling |
| 3166 | * this function, no further callbacks will be called for that window. |
| 3167 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3168 | * If the context of the specified window is current on the main thread, it is |
| 3169 | * detached before being destroyed. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3170 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3171 | * @param[in] window The window to destroy. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3172 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3173 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3174 | * GLFW_PLATFORM_ERROR. |
| 3175 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3176 | * @note The context of the specified window must not be current on any other |
| 3177 | * thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3178 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3179 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 3180 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3181 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3182 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3183 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3184 | * @sa @ref glfwCreateWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3185 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3186 | * @since Added in version 3.0. Replaces `glfwCloseWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3187 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3188 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3189 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3190 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3191 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 3192 | /*! @brief Checks the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3193 | * |
| 3194 | * This function returns the value of the close flag of the specified window. |
| 3195 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3196 | * @param[in] window The window to query. |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 3197 | * @return The value of the close flag. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3198 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3199 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3200 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3201 | * @thread_safety This function may be called from any thread. Access is not |
| 3202 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3203 | * |
| 3204 | * @sa @ref window_close |
| 3205 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3206 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 3207 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3208 | * @ingroup window |
| 3209 | */ |
| 3210 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
| 3211 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 3212 | /*! @brief Sets the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3213 | * |
| 3214 | * This function sets the value of the close flag of the specified window. |
| 3215 | * This can be used to override the user's attempt to close the window, or |
| 3216 | * to signal that it should be closed. |
| 3217 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 3218 | * @param[in] window The window whose flag to change. |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3219 | * @param[in] value The new value. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3220 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3221 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3222 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3223 | * @thread_safety This function may be called from any thread. Access is not |
| 3224 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3225 | * |
| 3226 | * @sa @ref window_close |
| 3227 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3228 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 3229 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3230 | * @ingroup window |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 3231 | */ |
| 3232 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
| 3233 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3234 | /*! @brief Sets the title of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3235 | * |
| 3236 | * This function sets the window title, encoded as UTF-8, of the specified |
| 3237 | * window. |
| 3238 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3239 | * @param[in] window The window whose title to change. |
| 3240 | * @param[in] title The UTF-8 encoded window title. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3241 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3242 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3243 | * GLFW_PLATFORM_ERROR. |
| 3244 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 3245 | * @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] | 3246 | * process events. |
Camilla Berglund | 6412dcb | 2015-04-07 21:52:29 +0200 | [diff] [blame] | 3247 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3248 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3249 | * |
| 3250 | * @sa @ref window_title |
| 3251 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3252 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3253 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3254 | * |
| 3255 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3256 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3257 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3258 | |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3259 | /*! @brief Sets the icon for the specified window. |
| 3260 | * |
| 3261 | * This function sets the icon of the specified window. If passed an array of |
| 3262 | * candidate images, those of or closest to the sizes desired by the system are |
| 3263 | * selected. If no images are specified, the window reverts to its default |
| 3264 | * icon. |
| 3265 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 3266 | * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight |
| 3267 | * bits per channel with the red channel first. They are arranged canonically |
| 3268 | * as packed sequential rows, starting from the top-left corner. |
| 3269 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3270 | * The desired image sizes varies depending on platform and system settings. |
| 3271 | * The selected images will be rescaled as needed. Good sizes include 16x16, |
| 3272 | * 32x32 and 48x48. |
| 3273 | * |
| 3274 | * @param[in] window The window whose icon to set. |
| 3275 | * @param[in] count The number of images in the specified array, or zero to |
| 3276 | * revert to the default window icon. |
| 3277 | * @param[in] images The images to create the icon from. This is ignored if |
| 3278 | * count is zero. |
| 3279 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3280 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 66a4882 | 2022-03-15 21:22:49 +0100 | [diff] [blame] | 3281 | * GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref |
| 3282 | * GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3283 | * |
| 3284 | * @pointer_lifetime The specified image data is copied before this function |
| 3285 | * returns. |
| 3286 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3287 | * @remark @macos Regular windows do not have icons on macOS. This function |
| 3288 | * 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] | 3289 | * the application bundle's icon. For more information on bundles, see the |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3290 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 3291 | * in the Mac Developer Library. |
| 3292 | * |
Emmanuel Gil Peyrot | a162004 | 2017-12-03 04:19:15 +0100 | [diff] [blame] | 3293 | * @remark @wayland There is no existing protocol to change an icon, the |
| 3294 | * 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] | 3295 | * This function will emit @ref GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3296 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 3297 | * @thread_safety This function must only be called from the main thread. |
| 3298 | * |
| 3299 | * @sa @ref window_icon |
| 3300 | * |
| 3301 | * @since Added in version 3.2. |
| 3302 | * |
| 3303 | * @ingroup window |
| 3304 | */ |
| 3305 | GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images); |
| 3306 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3307 | /*! @brief Retrieves the position of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3308 | * |
| 3309 | * This function retrieves the position, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3310 | * upper-left corner of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3311 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3312 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 3313 | * non-`NULL` position arguments will be set to zero. |
| 3314 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3315 | * @param[in] window The window to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3316 | * @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] | 3317 | * the content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3318 | * @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] | 3319 | * the content area, or `NULL`. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3320 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3321 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3322 | * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3323 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3324 | * @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] | 3325 | * position of its windows. This function will emit @ref |
| 3326 | * GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3327 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3328 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3329 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3330 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3331 | * @sa @ref glfwSetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3332 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3333 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3334 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3335 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3336 | */ |
| 3337 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
| 3338 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3339 | /*! @brief Sets the position of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3340 | * |
| 3341 | * 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] | 3342 | * 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] | 3343 | * window is a full screen window, this function does nothing. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3344 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3345 | * __Do not use this function__ to move an already visible window unless you |
| 3346 | * have very good reasons for doing so, as it will confuse and annoy the user. |
| 3347 | * |
| 3348 | * The window manager may put limits on what positions are allowed. GLFW |
| 3349 | * cannot and should not override these limits. |
| 3350 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3351 | * @param[in] window The window to query. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3352 | * @param[in] xpos The x-coordinate of the upper-left corner of the content area. |
| 3353 | * @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] | 3354 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3355 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3356 | * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3357 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3358 | * @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] | 3359 | * position of its windows. This function will emit @ref |
| 3360 | * GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3361 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3362 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3363 | * |
| 3364 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3365 | * @sa @ref glfwGetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3366 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3367 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3368 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3369 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3370 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3371 | */ |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 3372 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 3373 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3374 | /*! @brief Retrieves the size of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3375 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3376 | * This function retrieves the size, in screen coordinates, of the content area |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 3377 | * 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] | 3378 | * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3379 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3380 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 3381 | * non-`NULL` size arguments will be set to zero. |
| 3382 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3383 | * @param[in] window The window whose size to retrieve. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3384 | * @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] | 3385 | * content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3386 | * @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] | 3387 | * content area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3388 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3389 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3390 | * GLFW_PLATFORM_ERROR. |
| 3391 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3392 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3393 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3394 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3395 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3396 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3397 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3398 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3399 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3400 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3401 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3402 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3403 | |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3404 | /*! @brief Sets the size limits of the specified window. |
| 3405 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3406 | * 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] | 3407 | * 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] | 3408 | * once it is made windowed. If the window is not resizable, this function |
| 3409 | * does nothing. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3410 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3411 | * The size limits are applied immediately to a windowed mode window and may |
| 3412 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3413 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 3414 | * The maximum dimensions must be greater than or equal to the minimum |
| 3415 | * dimensions and all must be greater than or equal to zero. |
| 3416 | * |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3417 | * @param[in] window The window to set limits for. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3418 | * @param[in] minwidth The minimum width, in screen coordinates, of the content |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3419 | * area, or `GLFW_DONT_CARE`. |
| 3420 | * @param[in] minheight The minimum height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3421 | * content area, or `GLFW_DONT_CARE`. |
| 3422 | * @param[in] maxwidth The maximum width, in screen coordinates, of the content |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3423 | * area, or `GLFW_DONT_CARE`. |
| 3424 | * @param[in] maxheight The maximum height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3425 | * content area, or `GLFW_DONT_CARE`. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3426 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 3427 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3428 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3429 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3430 | * @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] | 3431 | * results are undefined. |
| 3432 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3433 | * @remark @wayland The size limits will not be applied until the window is |
| 3434 | * actually resized, either by the user or by the compositor. |
| 3435 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3436 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3437 | * |
| 3438 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3439 | * @sa @ref glfwSetWindowAspectRatio |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3440 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3441 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3442 | * |
| 3443 | * @ingroup window |
| 3444 | */ |
| 3445 | GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); |
| 3446 | |
| 3447 | /*! @brief Sets the aspect ratio of the specified window. |
| 3448 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3449 | * 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] | 3450 | * specified window. If the window is full screen, the aspect ratio only takes |
| 3451 | * 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] | 3452 | * function does nothing. |
| 3453 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 3454 | * The aspect ratio is specified as a numerator and a denominator and both |
| 3455 | * values must be greater than zero. For example, the common 16:9 aspect ratio |
| 3456 | * is specified as 16 and 9, respectively. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3457 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 3458 | * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect |
| 3459 | * ratio limit is disabled. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3460 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3461 | * The aspect ratio is applied immediately to a windowed mode window and may |
| 3462 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3463 | * |
| 3464 | * @param[in] window The window to set limits for. |
| 3465 | * @param[in] numer The numerator of the desired aspect ratio, or |
| 3466 | * `GLFW_DONT_CARE`. |
| 3467 | * @param[in] denom The denominator of the desired aspect ratio, or |
| 3468 | * `GLFW_DONT_CARE`. |
| 3469 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3470 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3471 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 3472 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3473 | * @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] | 3474 | * results are undefined. |
| 3475 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3476 | * @remark @wayland The aspect ratio will not be applied until the window is |
| 3477 | * actually resized, either by the user or by the compositor. |
| 3478 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3479 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3480 | * |
| 3481 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3482 | * @sa @ref glfwSetWindowSizeLimits |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3483 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3484 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 3485 | * |
| 3486 | * @ingroup window |
| 3487 | */ |
| 3488 | GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); |
| 3489 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3490 | /*! @brief Sets the size of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3491 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3492 | * 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] | 3493 | * the specified window. |
| 3494 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3495 | * For full screen windows, this function updates the resolution of its desired |
| 3496 | * video mode and switches to the video mode closest to it, without affecting |
| 3497 | * the window's context. As the context is unaffected, the bit depths of the |
| 3498 | * framebuffer remain unchanged. |
| 3499 | * |
| 3500 | * If you wish to update the refresh rate of the desired video mode in addition |
| 3501 | * to its resolution, see @ref glfwSetWindowMonitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3502 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3503 | * The window manager may put limits on what sizes are allowed. GLFW cannot |
| 3504 | * and should not override these limits. |
| 3505 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3506 | * @param[in] window The window to resize. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3507 | * @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] | 3508 | * content area. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3509 | * @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] | 3510 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3511 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3512 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3513 | * GLFW_PLATFORM_ERROR. |
| 3514 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3515 | * @remark @wayland A full screen window will not attempt to change the mode, |
| 3516 | * no matter what the requested size. |
| 3517 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3518 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3519 | * |
| 3520 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3521 | * @sa @ref glfwGetWindowSize |
| 3522 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3523 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3524 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3525 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3526 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3527 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3528 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3529 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3530 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3531 | /*! @brief Retrieves the size of the framebuffer of the specified window. |
| 3532 | * |
| 3533 | * This function retrieves the size, in pixels, of the framebuffer of the |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 3534 | * specified window. If you wish to retrieve the size of the window in screen |
| 3535 | * coordinates, see @ref glfwGetWindowSize. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3536 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3537 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 3538 | * non-`NULL` size arguments will be set to zero. |
| 3539 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3540 | * @param[in] window The window whose framebuffer to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3541 | * @param[out] width Where to store the width, in pixels, of the framebuffer, |
| 3542 | * or `NULL`. |
| 3543 | * @param[out] height Where to store the height, in pixels, of the framebuffer, |
| 3544 | * or `NULL`. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3545 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3546 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3547 | * GLFW_PLATFORM_ERROR. |
| 3548 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3549 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3550 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3551 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3552 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3553 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3554 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3555 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3556 | * @ingroup window |
| 3557 | */ |
| 3558 | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); |
| 3559 | |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3560 | /*! @brief Retrieves the size of the frame of the window. |
| 3561 | * |
| 3562 | * This function retrieves the size, in screen coordinates, of each edge of the |
| 3563 | * frame of the specified window. This size includes the title bar, if the |
| 3564 | * window has one. The size of the frame may vary depending on the |
| 3565 | * [window-related hints](@ref window_hints_wnd) used to create it. |
| 3566 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3567 | * Because this function retrieves the size of each window frame edge and not |
| 3568 | * the offset along a particular coordinate axis, the retrieved values will |
| 3569 | * always be zero or positive. |
| 3570 | * |
| 3571 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 3572 | * non-`NULL` size arguments will be set to zero. |
| 3573 | * |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3574 | * @param[in] window The window whose frame size to query. |
| 3575 | * @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] | 3576 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 3577 | * @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] | 3578 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 3579 | * @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] | 3580 | * right edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 3581 | * @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] | 3582 | * bottom edge of the window frame, or `NULL`. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3583 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3584 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3585 | * GLFW_PLATFORM_ERROR. |
| 3586 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3587 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3588 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3589 | * @sa @ref window_size |
| 3590 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3591 | * @since Added in version 3.1. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 3592 | * |
| 3593 | * @ingroup window |
| 3594 | */ |
| 3595 | GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); |
| 3596 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 3597 | /*! @brief Retrieves the content scale for the specified window. |
| 3598 | * |
| 3599 | * This function retrieves the content scale for the specified window. The |
| 3600 | * 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] | 3601 | * default DPI. This is especially important for text and any UI elements. If |
| 3602 | * the pixel dimensions of your UI scaled by this look appropriate on your |
| 3603 | * machine then it should appear at a reasonable size on other machines |
| 3604 | * regardless of their DPI and scaling settings. This relies on the system DPI |
| 3605 | * and scaling settings being somewhat correct. |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 3606 | * |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 3607 | * 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] | 3608 | * content scale will depend on which monitor the system considers the window |
| 3609 | * to be on. |
| 3610 | * |
| 3611 | * @param[in] window The window to query. |
| 3612 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 3613 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 3614 | * |
| 3615 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3616 | * GLFW_PLATFORM_ERROR. |
| 3617 | * |
| 3618 | * @thread_safety This function must only be called from the main thread. |
| 3619 | * |
| 3620 | * @sa @ref window_scale |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 3621 | * @sa @ref glfwSetWindowContentScaleCallback |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 3622 | * @sa @ref glfwGetMonitorContentScale |
| 3623 | * |
| 3624 | * @since Added in version 3.3. |
| 3625 | * |
| 3626 | * @ingroup window |
| 3627 | */ |
| 3628 | GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); |
| 3629 | |
Camilla Löwy | 11e47f0 | 2017-09-25 23:14:45 +0200 | [diff] [blame] | 3630 | /*! @brief Returns the opacity of the whole window. |
| 3631 | * |
| 3632 | * This function returns the opacity of the window, including any decorations. |
| 3633 | * |
| 3634 | * The opacity (or alpha) value is a positive finite number between zero and |
| 3635 | * one, where zero is fully transparent and one is fully opaque. If the system |
| 3636 | * does not support whole window transparency, this function always returns one. |
| 3637 | * |
| 3638 | * The initial opacity value for newly created windows is one. |
| 3639 | * |
| 3640 | * @param[in] window The window to query. |
| 3641 | * @return The opacity value of the specified window. |
| 3642 | * |
| 3643 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3644 | * GLFW_PLATFORM_ERROR. |
| 3645 | * |
| 3646 | * @thread_safety This function must only be called from the main thread. |
| 3647 | * |
| 3648 | * @sa @ref window_transparency |
| 3649 | * @sa @ref glfwSetWindowOpacity |
| 3650 | * |
| 3651 | * @since Added in version 3.3. |
| 3652 | * |
| 3653 | * @ingroup window |
| 3654 | */ |
| 3655 | GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window); |
| 3656 | |
| 3657 | /*! @brief Sets the opacity of the whole window. |
| 3658 | * |
| 3659 | * This function sets the opacity of the window, including any decorations. |
| 3660 | * |
| 3661 | * The opacity (or alpha) value is a positive finite number between zero and |
| 3662 | * one, where zero is fully transparent and one is fully opaque. |
| 3663 | * |
| 3664 | * The initial opacity value for newly created windows is one. |
| 3665 | * |
| 3666 | * A window created with framebuffer transparency may not use whole window |
| 3667 | * transparency. The results of doing this are undefined. |
| 3668 | * |
| 3669 | * @param[in] window The window to set the opacity for. |
| 3670 | * @param[in] opacity The desired opacity of the specified window. |
| 3671 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3672 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3673 | * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
| 3674 | * |
| 3675 | * @remark @wayland There is no way to set an opacity factor for a window. |
| 3676 | * This function will emit @ref GLFW_FEATURE_UNAVAILABLE. |
Camilla Löwy | 11e47f0 | 2017-09-25 23:14:45 +0200 | [diff] [blame] | 3677 | * |
| 3678 | * @thread_safety This function must only be called from the main thread. |
| 3679 | * |
| 3680 | * @sa @ref window_transparency |
| 3681 | * @sa @ref glfwGetWindowOpacity |
| 3682 | * |
| 3683 | * @since Added in version 3.3. |
| 3684 | * |
| 3685 | * @ingroup window |
| 3686 | */ |
| 3687 | GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); |
| 3688 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3689 | /*! @brief Iconifies the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3690 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3691 | * This function iconifies (minimizes) the specified window if it was |
| 3692 | * previously restored. If the window is already iconified, this function does |
| 3693 | * nothing. |
| 3694 | * |
Camilla Löwy | 2796e61 | 2022-06-24 19:29:29 +0200 | [diff] [blame] | 3695 | * If the specified window is a full screen window, GLFW restores the original |
| 3696 | * video mode of the monitor. The window's desired video mode is set again |
| 3697 | * when the window is restored. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3698 | * |
| 3699 | * @param[in] window The window to iconify. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3700 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3701 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3702 | * GLFW_PLATFORM_ERROR. |
| 3703 | * |
Emmanuel Gil Peyrot | 599fb3d | 2019-03-01 18:46:06 +0100 | [diff] [blame] | 3704 | * @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t |
| 3705 | * 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] | 3706 | * protocol. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3707 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3708 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3709 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3710 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3711 | * @sa @ref glfwRestoreWindow |
| 3712 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3713 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3714 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3715 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3716 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3717 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3718 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3719 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3720 | |
| 3721 | /*! @brief Restores the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3722 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3723 | * This function restores the specified window if it was previously iconified |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3724 | * (minimized) or maximized. If the window is already restored, this function |
| 3725 | * does nothing. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3726 | * |
Camilla Löwy | 2796e61 | 2022-06-24 19:29:29 +0200 | [diff] [blame] | 3727 | * If the specified window is an iconified full screen window, its desired |
| 3728 | * 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] | 3729 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3730 | * @param[in] window The window to restore. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3731 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3732 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3733 | * GLFW_PLATFORM_ERROR. |
| 3734 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3735 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3736 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3737 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3738 | * @sa @ref glfwIconifyWindow |
| 3739 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3740 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3741 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3742 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3743 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3744 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3745 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3746 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3747 | |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3748 | /*! @brief Maximizes the specified window. |
| 3749 | * |
| 3750 | * This function maximizes the specified window if it was previously not |
| 3751 | * maximized. If the window is already maximized, this function does nothing. |
| 3752 | * |
| 3753 | * If the specified window is a full screen window, this function does nothing. |
| 3754 | * |
| 3755 | * @param[in] window The window to maximize. |
| 3756 | * |
Camilla Berglund | f5b71f5 | 2016-05-27 14:20:39 +0200 | [diff] [blame] | 3757 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3758 | * GLFW_PLATFORM_ERROR. |
| 3759 | * |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3760 | * @par Thread Safety |
| 3761 | * This function may only be called from the main thread. |
| 3762 | * |
| 3763 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3764 | * @sa @ref glfwIconifyWindow |
| 3765 | * @sa @ref glfwRestoreWindow |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3766 | * |
| 3767 | * @since Added in GLFW 3.2. |
| 3768 | * |
| 3769 | * @ingroup window |
| 3770 | */ |
| 3771 | GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); |
| 3772 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3773 | /*! @brief Makes the specified window visible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3774 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3775 | * This function makes the specified window visible if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3776 | * 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] | 3777 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3778 | * |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3779 | * By default, windowed mode windows are focused when shown |
| 3780 | * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint |
| 3781 | * to change this behavior for all newly created windows, or change the |
| 3782 | * behavior for an existing window with @ref glfwSetWindowAttrib. |
| 3783 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3784 | * @param[in] window The window to make visible. |
| 3785 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3786 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3787 | * GLFW_PLATFORM_ERROR. |
| 3788 | * |
Camilla Löwy | 8edbc49 | 2021-12-27 01:31:38 +0100 | [diff] [blame] | 3789 | * @remark @wayland Because Wayland wants every frame of the desktop to be |
| 3790 | * complete, this function does not immediately make the window visible. |
| 3791 | * Instead it will become visible the next time the window framebuffer is |
| 3792 | * updated after this call. |
| 3793 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3794 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3795 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3796 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3797 | * @sa @ref glfwHideWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3798 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3799 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3800 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3801 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3802 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3803 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3804 | |
| 3805 | /*! @brief Hides the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3806 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3807 | * This function hides the specified window if it was previously visible. If |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3808 | * 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] | 3809 | * nothing. |
| 3810 | * |
| 3811 | * @param[in] window The window to hide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3812 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3813 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3814 | * GLFW_PLATFORM_ERROR. |
| 3815 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3816 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3817 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3818 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3819 | * @sa @ref glfwShowWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3820 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3821 | * @since Added in version 3.0. |
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 glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3826 | |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3827 | /*! @brief Brings the specified window to front and sets input focus. |
| 3828 | * |
| 3829 | * This function brings the specified window to front and sets input focus. |
| 3830 | * The window should already be visible and not iconified. |
| 3831 | * |
| 3832 | * 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] | 3833 | * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to |
| 3834 | * disable this behavior. |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3835 | * |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3836 | * Also by default, windowed mode windows are focused when shown |
| 3837 | * with @ref glfwShowWindow. Set the |
| 3838 | * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior. |
| 3839 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3840 | * __Do not use this function__ to steal focus from other applications unless |
| 3841 | * you are certain that is what the user wants. Focus stealing can be |
| 3842 | * extremely disruptive. |
| 3843 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3844 | * For a less disruptive way of getting the user's attention, see |
| 3845 | * [attention requests](@ref window_attention). |
| 3846 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3847 | * @param[in] window The window to give input focus. |
| 3848 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3849 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3850 | * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3851 | * |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 3852 | * @remark @wayland It is not possible for an application to set the input |
| 3853 | * focus. This function will emit @ref GLFW_FEATURE_UNAVAILABLE. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3854 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3855 | * @thread_safety This function must only be called from the main thread. |
| 3856 | * |
| 3857 | * @sa @ref window_focus |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3858 | * @sa @ref window_attention |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3859 | * |
| 3860 | * @since Added in version 3.2. |
| 3861 | * |
| 3862 | * @ingroup window |
| 3863 | */ |
| 3864 | GLFWAPI void glfwFocusWindow(GLFWwindow* window); |
| 3865 | |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3866 | /*! @brief Requests user attention to the specified window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3867 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3868 | * This function requests user attention to the specified window. On |
| 3869 | * platforms where this is not supported, attention is requested to the |
| 3870 | * application as a whole. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3871 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3872 | * Once the user has given attention, usually by focusing the window or |
| 3873 | * application, the system will end the request automatically. |
| 3874 | * |
| 3875 | * @param[in] window The window to request attention to. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3876 | * |
| 3877 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3878 | * GLFW_PLATFORM_ERROR. |
| 3879 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3880 | * @remark @macos Attention is requested to the application as a whole, not the |
| 3881 | * specific window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3882 | * |
| 3883 | * @thread_safety This function must only be called from the main thread. |
| 3884 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3885 | * @sa @ref window_attention |
| 3886 | * |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3887 | * @since Added in version 3.3. |
| 3888 | * |
| 3889 | * @ingroup window |
| 3890 | */ |
| 3891 | GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window); |
| 3892 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3893 | /*! @brief Returns the monitor that the window uses for full screen mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3894 | * |
| 3895 | * 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] | 3896 | * in full screen on. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3897 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 3898 | * @param[in] window The window to query. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 3899 | * @return The monitor, or `NULL` if the window is in windowed mode or an |
| 3900 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3901 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3902 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3903 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3904 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3905 | * |
| 3906 | * @sa @ref window_monitor |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3907 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3908 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3909 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3910 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 3911 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3912 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3913 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3914 | |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3915 | /*! @brief Sets the mode, monitor, video mode and placement of a window. |
| 3916 | * |
| 3917 | * This function sets the monitor that the window uses for full screen mode or, |
| 3918 | * if the monitor is `NULL`, makes it windowed mode. |
| 3919 | * |
| 3920 | * When setting a monitor, this function updates the width, height and refresh |
| 3921 | * rate of the desired video mode and switches to the video mode closest to it. |
| 3922 | * The window position is ignored when setting a monitor. |
| 3923 | * |
| 3924 | * 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] | 3925 | * 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] | 3926 | * is specified. |
| 3927 | * |
| 3928 | * If you only wish to update the resolution of a full screen window or the |
| 3929 | * size of a windowed mode window, see @ref glfwSetWindowSize. |
| 3930 | * |
| 3931 | * When a window transitions from full screen to windowed mode, this function |
| 3932 | * restores any previous window settings such as whether it is decorated, |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3933 | * floating, resizable, has size or aspect ratio limits, etc. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3934 | * |
| 3935 | * @param[in] window The window whose monitor, size or video mode to set. |
| 3936 | * @param[in] monitor The desired monitor, or `NULL` to set windowed mode. |
| 3937 | * @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] | 3938 | * content area. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3939 | * @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] | 3940 | * content area. |
| 3941 | * @param[in] width The desired with, in screen coordinates, of the content |
| 3942 | * area or video mode. |
| 3943 | * @param[in] height The desired height, in screen coordinates, of the content |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3944 | * area or video mode. |
Camilla Berglund | 325729d | 2016-05-22 14:25:04 +0200 | [diff] [blame] | 3945 | * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode, |
| 3946 | * or `GLFW_DONT_CARE`. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3947 | * |
| 3948 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3949 | * GLFW_PLATFORM_ERROR. |
| 3950 | * |
Camilla Berglund | ec17161 | 2016-10-28 06:20:20 +0200 | [diff] [blame] | 3951 | * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise |
| 3952 | * affected by any resizing or mode switching, although you may need to update |
| 3953 | * your viewport if the framebuffer size has changed. |
| 3954 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3955 | * @remark @wayland The desired window position is ignored, as there is no way |
| 3956 | * for an application to set this property. |
| 3957 | * |
| 3958 | * @remark @wayland Setting the window to full screen will not attempt to |
| 3959 | * change the mode, no matter what the requested size or refresh rate. |
| 3960 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3961 | * @thread_safety This function must only be called from the main thread. |
| 3962 | * |
| 3963 | * @sa @ref window_monitor |
| 3964 | * @sa @ref window_full_screen |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3965 | * @sa @ref glfwGetWindowMonitor |
| 3966 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3967 | * |
| 3968 | * @since Added in version 3.2. |
| 3969 | * |
| 3970 | * @ingroup window |
| 3971 | */ |
| 3972 | GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); |
| 3973 | |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 3974 | /*! @brief Returns an attribute of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3975 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3976 | * This function returns the value of an attribute of the specified window or |
| 3977 | * its OpenGL or OpenGL ES context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3978 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3979 | * @param[in] window The window to query. |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 3980 | * @param[in] attrib The [window attribute](@ref window_attribs) whose value to |
| 3981 | * return. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3982 | * @return The value of the attribute, or zero if an |
| 3983 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3984 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3985 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3986 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 3987 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3988 | * @remark Framebuffer related hints are not window attributes. See @ref |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 3989 | * window_attribs_fb for more information. |
| 3990 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3991 | * @remark Zero is a valid value for many window and context related |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 3992 | * attributes so you cannot use a return value of zero as an indication of |
| 3993 | * errors. However, this function should not fail as long as it is passed |
| 3994 | * valid arguments and the library has been [initialized](@ref intro_init). |
| 3995 | * |
Camilla Löwy | 2796e61 | 2022-06-24 19:29:29 +0200 | [diff] [blame] | 3996 | * @remark @wayland The Wayland protocol provides no way to check whether a |
| 3997 | * window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`. |
| 3998 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3999 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4000 | * |
| 4001 | * @sa @ref window_attribs |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 4002 | * @sa @ref glfwSetWindowAttrib |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4003 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4004 | * @since Added in version 3.0. Replaces `glfwGetWindowParam` and |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4005 | * `glfwGetGLVersion`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4006 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4007 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4008 | */ |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 4009 | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4010 | |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 4011 | /*! @brief Sets an attribute of the specified window. |
| 4012 | * |
| 4013 | * This function sets the value of an attribute of the specified window. |
| 4014 | * |
| 4015 | * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), |
| 4016 | * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 4017 | * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), |
| 4018 | * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and |
| 4019 | * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib). |
Rokas Kupstys | d285a9f | 2019-09-30 15:44:43 +0300 | [diff] [blame] | 4020 | * [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_attrib) |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 4021 | * |
| 4022 | * Some of these attributes are ignored for full screen windows. The new |
| 4023 | * value will take effect if the window is later made windowed. |
| 4024 | * |
| 4025 | * Some of these attributes are ignored for windowed mode windows. The new |
| 4026 | * value will take effect if the window is later made full screen. |
| 4027 | * |
| 4028 | * @param[in] window The window to set the attribute for. |
| 4029 | * @param[in] attrib A supported window attribute. |
| 4030 | * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`. |
| 4031 | * |
| 4032 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4033 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 4034 | * |
| 4035 | * @remark Calling @ref glfwGetWindowAttrib will always return the latest |
| 4036 | * value, even if that value is ignored by the current mode of the window. |
| 4037 | * |
| 4038 | * @thread_safety This function must only be called from the main thread. |
| 4039 | * |
| 4040 | * @sa @ref window_attribs |
| 4041 | * @sa @ref glfwGetWindowAttrib |
| 4042 | * |
| 4043 | * @since Added in version 3.3. |
| 4044 | * |
| 4045 | * @ingroup window |
| 4046 | */ |
| 4047 | GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value); |
| 4048 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4049 | /*! @brief Sets the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4050 | * |
| 4051 | * This function sets the user-defined pointer of the specified window. The |
| 4052 | * current value is retained until the window is destroyed. The initial value |
| 4053 | * is `NULL`. |
| 4054 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4055 | * @param[in] window The window whose pointer to set. |
| 4056 | * @param[in] pointer The new value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4057 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4058 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4059 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4060 | * @thread_safety This function may be called from any thread. Access is not |
| 4061 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4062 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4063 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4064 | * @sa @ref glfwGetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4065 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4066 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4067 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4068 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4069 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4070 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4071 | |
| 4072 | /*! @brief Returns the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4073 | * |
| 4074 | * This function returns the current value of the user-defined pointer of the |
| 4075 | * specified window. The initial value is `NULL`. |
| 4076 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4077 | * @param[in] window The window whose pointer to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4078 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4079 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4080 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4081 | * @thread_safety This function may be called from any thread. Access is not |
| 4082 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4083 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4084 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4085 | * @sa @ref glfwSetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4086 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4087 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4088 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4089 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4090 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4091 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4092 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4093 | /*! @brief Sets the position callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4094 | * |
| 4095 | * 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] | 4096 | * 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] | 4097 | * position, in screen coordinates, of the upper-left corner of the content |
| 4098 | * area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4099 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4100 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4101 | * @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] | 4102 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4103 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4104 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4105 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4106 | * @callback_signature |
| 4107 | * @code |
| 4108 | * void function_name(GLFWwindow* window, int xpos, int ypos) |
| 4109 | * @endcode |
| 4110 | * For more information about the callback parameters, see the |
| 4111 | * [function pointer type](@ref GLFWwindowposfun). |
| 4112 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4113 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4114 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4115 | * @remark @wayland This callback will never be called, as there is no way for |
| 4116 | * an application to know its global position. |
| 4117 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4118 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4119 | * |
| 4120 | * @sa @ref window_pos |
| 4121 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4122 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4123 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4124 | * @ingroup window |
| 4125 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4126 | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 4127 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4128 | /*! @brief Sets the size callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4129 | * |
| 4130 | * This function sets the size callback of the specified window, which is |
| 4131 | * 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] | 4132 | * in screen coordinates, of the content area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4133 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4134 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4135 | * @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] | 4136 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4137 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4138 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4139 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4140 | * @callback_signature |
| 4141 | * @code |
| 4142 | * void function_name(GLFWwindow* window, int width, int height) |
| 4143 | * @endcode |
| 4144 | * For more information about the callback parameters, see the |
| 4145 | * [function pointer type](@ref GLFWwindowsizefun). |
| 4146 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4147 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4148 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4149 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4150 | * |
| 4151 | * @sa @ref window_size |
| 4152 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4153 | * @since Added in version 1.0. |
| 4154 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4155 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4156 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4157 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4158 | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4159 | |
| 4160 | /*! @brief Sets the close callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4161 | * |
| 4162 | * This function sets the close callback of the specified window, which is |
| 4163 | * called when the user attempts to close the window, for example by clicking |
| 4164 | * the close widget in the title bar. |
| 4165 | * |
| 4166 | * The close flag is set before this callback is called, but you can modify it |
| 4167 | * at any time with @ref glfwSetWindowShouldClose. |
| 4168 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4169 | * The close callback is not triggered by @ref glfwDestroyWindow. |
| 4170 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4171 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4172 | * @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] | 4173 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4174 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4175 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4176 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4177 | * @callback_signature |
| 4178 | * @code |
| 4179 | * void function_name(GLFWwindow* window) |
| 4180 | * @endcode |
| 4181 | * For more information about the callback parameters, see the |
| 4182 | * [function pointer type](@ref GLFWwindowclosefun). |
| 4183 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4184 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4185 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 4186 | * @remark @macos Selecting Quit from the application menu will trigger the |
| 4187 | * close callback for all windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4188 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4189 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4190 | * |
| 4191 | * @sa @ref window_close |
| 4192 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4193 | * @since Added in version 2.5. |
| 4194 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [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 Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4198 | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4199 | |
| 4200 | /*! @brief Sets the refresh callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4201 | * |
| 4202 | * 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] | 4203 | * 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] | 4204 | * if the window has been exposed after having been covered by another window. |
| 4205 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4206 | * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where |
| 4207 | * the window contents are saved off-screen, this callback may be called only |
| 4208 | * very infrequently or never at all. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 4209 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4210 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4211 | * @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] | 4212 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4213 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4214 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4215 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4216 | * @callback_signature |
| 4217 | * @code |
| 4218 | * void function_name(GLFWwindow* window); |
| 4219 | * @endcode |
| 4220 | * For more information about the callback parameters, see the |
| 4221 | * [function pointer type](@ref GLFWwindowrefreshfun). |
| 4222 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4223 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 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 | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4226 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4227 | * @sa @ref window_refresh |
| 4228 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4229 | * @since Added in version 2.5. |
| 4230 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 4231 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4232 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4233 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4234 | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4235 | |
| 4236 | /*! @brief Sets the focus callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4237 | * |
| 4238 | * This function sets the focus callback of the specified window, which is |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4239 | * called when the window gains or loses input focus. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4240 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4241 | * After the focus callback is called for a window that lost input focus, |
| 4242 | * synthetic key and mouse button release events will be generated for all such |
| 4243 | * that had been pressed. For more information, see @ref glfwSetKeyCallback |
| 4244 | * and @ref glfwSetMouseButtonCallback. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 4245 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4246 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4247 | * @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] | 4248 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4249 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4250 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4251 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4252 | * @callback_signature |
| 4253 | * @code |
| 4254 | * void function_name(GLFWwindow* window, int focused) |
| 4255 | * @endcode |
| 4256 | * For more information about the callback parameters, see the |
| 4257 | * [function pointer type](@ref GLFWwindowfocusfun). |
| 4258 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4259 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4260 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4261 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4262 | * |
| 4263 | * @sa @ref window_focus |
| 4264 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4265 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4266 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4267 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4268 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4269 | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4270 | |
| 4271 | /*! @brief Sets the iconify callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4272 | * |
| 4273 | * This function sets the iconification callback of the specified window, which |
| 4274 | * is called when the window is iconified or restored. |
| 4275 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4276 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4277 | * @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] | 4278 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4279 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4280 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4281 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4282 | * @callback_signature |
| 4283 | * @code |
| 4284 | * void function_name(GLFWwindow* window, int iconified) |
| 4285 | * @endcode |
| 4286 | * For more information about the callback parameters, see the |
| 4287 | * [function pointer type](@ref GLFWwindowiconifyfun). |
| 4288 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4289 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4290 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4291 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4292 | * |
| 4293 | * @sa @ref window_iconify |
| 4294 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4295 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4296 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4297 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4298 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4299 | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 4300 | |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 4301 | /*! @brief Sets the maximize callback for the specified window. |
| 4302 | * |
| 4303 | * This function sets the maximization callback of the specified window, which |
| 4304 | * is called when the window is maximized or restored. |
| 4305 | * |
| 4306 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4307 | * @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] | 4308 | * callback. |
| 4309 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4310 | * library had not been [initialized](@ref intro_init). |
| 4311 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4312 | * @callback_signature |
| 4313 | * @code |
| 4314 | * void function_name(GLFWwindow* window, int maximized) |
| 4315 | * @endcode |
| 4316 | * For more information about the callback parameters, see the |
| 4317 | * [function pointer type](@ref GLFWwindowmaximizefun). |
| 4318 | * |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 4319 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4320 | * |
| 4321 | * @thread_safety This function must only be called from the main thread. |
| 4322 | * |
| 4323 | * @sa @ref window_maximize |
| 4324 | * |
| 4325 | * @since Added in version 3.3. |
| 4326 | * |
| 4327 | * @ingroup window |
| 4328 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4329 | GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback); |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 4330 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4331 | /*! @brief Sets the framebuffer resize callback for the specified window. |
| 4332 | * |
| 4333 | * This function sets the framebuffer resize callback of the specified window, |
| 4334 | * which is called when the framebuffer of the specified window is resized. |
| 4335 | * |
| 4336 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4337 | * @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] | 4338 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4339 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4340 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4341 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4342 | * @callback_signature |
| 4343 | * @code |
| 4344 | * void function_name(GLFWwindow* window, int width, int height) |
| 4345 | * @endcode |
| 4346 | * For more information about the callback parameters, see the |
| 4347 | * [function pointer type](@ref GLFWframebuffersizefun). |
| 4348 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4349 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4350 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4351 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4352 | * |
| 4353 | * @sa @ref window_fbsize |
| 4354 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4355 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4356 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4357 | * @ingroup window |
| 4358 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4359 | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback); |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 4360 | |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 4361 | /*! @brief Sets the window content scale callback for the specified window. |
| 4362 | * |
| 4363 | * This function sets the window content scale callback of the specified window, |
| 4364 | * which is called when the content scale of the specified window changes. |
| 4365 | * |
| 4366 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4367 | * @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] | 4368 | * callback. |
| 4369 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4370 | * library had not been [initialized](@ref intro_init). |
| 4371 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4372 | * @callback_signature |
| 4373 | * @code |
| 4374 | * void function_name(GLFWwindow* window, float xscale, float yscale) |
| 4375 | * @endcode |
| 4376 | * For more information about the callback parameters, see the |
| 4377 | * [function pointer type](@ref GLFWwindowcontentscalefun). |
| 4378 | * |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 4379 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4380 | * |
| 4381 | * @thread_safety This function must only be called from the main thread. |
| 4382 | * |
| 4383 | * @sa @ref window_scale |
| 4384 | * @sa @ref glfwGetWindowContentScale |
| 4385 | * |
| 4386 | * @since Added in version 3.3. |
| 4387 | * |
| 4388 | * @ingroup window |
| 4389 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 4390 | GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback); |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 4391 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4392 | /*! @brief Processes all pending events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4393 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4394 | * This function processes only those events that are already in the event |
| 4395 | * queue and then returns immediately. Processing events will cause the window |
| 4396 | * and input callbacks associated with those events to be called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4397 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4398 | * On some platforms, a window move, resize or menu operation will cause event |
| 4399 | * processing to block. This is due to how event processing is designed on |
| 4400 | * those platforms. You can use the |
| 4401 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 4402 | * your window when necessary during such operations. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4403 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4404 | * Do not assume that callbacks you set will _only_ be called in response to |
| 4405 | * event processing functions like this one. While it is necessary to poll for |
| 4406 | * events, window systems that require GLFW to register callbacks of its own |
| 4407 | * can pass events to GLFW in response to many window system function calls. |
| 4408 | * GLFW will pass those events on to the application callbacks before |
| 4409 | * returning. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 4410 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4411 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 4412 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4413 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4414 | * GLFW_PLATFORM_ERROR. |
| 4415 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4416 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 4417 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4418 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4419 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4420 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4421 | * @sa @ref glfwWaitEvents |
| 4422 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4423 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4424 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4425 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4426 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4427 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 4428 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4429 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4430 | /*! @brief Waits until events are queued and processes them. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4431 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4432 | * This function puts the calling thread to sleep until at least one event is |
| 4433 | * available in the event queue. Once one or more events are available, |
| 4434 | * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue |
| 4435 | * are processed and the function then returns immediately. Processing events |
| 4436 | * will cause the window and input callbacks associated with those events to be |
| 4437 | * called. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4438 | * |
| 4439 | * Since not all events are associated with callbacks, this function may return |
| 4440 | * without a callback having been called even if you are monitoring all |
| 4441 | * callbacks. |
| 4442 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4443 | * On some platforms, a window move, resize or menu operation will cause event |
| 4444 | * processing to block. This is due to how event processing is designed on |
| 4445 | * those platforms. You can use the |
| 4446 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 4447 | * your window when necessary during such operations. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4448 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4449 | * Do not assume that callbacks you set will _only_ be called in response to |
| 4450 | * event processing functions like this one. While it is necessary to poll for |
| 4451 | * events, window systems that require GLFW to register callbacks of its own |
| 4452 | * can pass events to GLFW in response to many window system function calls. |
| 4453 | * GLFW will pass those events on to the application callbacks before |
| 4454 | * returning. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4455 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4456 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 4457 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4458 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4459 | * GLFW_PLATFORM_ERROR. |
| 4460 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4461 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 4462 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4463 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4464 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4465 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4466 | * @sa @ref glfwPollEvents |
| 4467 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4468 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4469 | * @since Added in version 2.5. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4470 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4471 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4472 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 4473 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 4474 | |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4475 | /*! @brief Waits with timeout until events are queued and processes them. |
| 4476 | * |
| 4477 | * This function puts the calling thread to sleep until at least one event is |
| 4478 | * available in the event queue, or until the specified timeout is reached. If |
| 4479 | * one or more events are available, it behaves exactly like @ref |
| 4480 | * glfwPollEvents, i.e. the events in the queue are processed and the function |
| 4481 | * then returns immediately. Processing events will cause the window and input |
| 4482 | * callbacks associated with those events to be called. |
| 4483 | * |
| 4484 | * The timeout value must be a positive finite number. |
| 4485 | * |
| 4486 | * Since not all events are associated with callbacks, this function may return |
| 4487 | * without a callback having been called even if you are monitoring all |
| 4488 | * callbacks. |
| 4489 | * |
| 4490 | * On some platforms, a window move, resize or menu operation will cause event |
| 4491 | * processing to block. This is due to how event processing is designed on |
| 4492 | * those platforms. You can use the |
| 4493 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 4494 | * your window when necessary during such operations. |
| 4495 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4496 | * Do not assume that callbacks you set will _only_ be called in response to |
| 4497 | * event processing functions like this one. While it is necessary to poll for |
| 4498 | * events, window systems that require GLFW to register callbacks of its own |
| 4499 | * can pass events to GLFW in response to many window system function calls. |
| 4500 | * GLFW will pass those events on to the application callbacks before |
| 4501 | * returning. |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4502 | * |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4503 | * Event processing is not required for joystick input to work. |
| 4504 | * |
| 4505 | * @param[in] timeout The maximum amount of time, in seconds, to wait. |
| 4506 | * |
Sylvain Boilard | 3b255af | 2018-09-13 16:23:44 +0200 | [diff] [blame] | 4507 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 8e313d9 | 2018-12-13 20:33:17 +0100 | [diff] [blame] | 4508 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Sylvain Boilard | 3b255af | 2018-09-13 16:23:44 +0200 | [diff] [blame] | 4509 | * |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4510 | * @reentrancy This function must not be called from a callback. |
| 4511 | * |
| 4512 | * @thread_safety This function must only be called from the main thread. |
| 4513 | * |
| 4514 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4515 | * @sa @ref glfwPollEvents |
| 4516 | * @sa @ref glfwWaitEvents |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 4517 | * |
| 4518 | * @since Added in version 3.2. |
| 4519 | * |
| 4520 | * @ingroup window |
| 4521 | */ |
| 4522 | GLFWAPI void glfwWaitEventsTimeout(double timeout); |
| 4523 | |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4524 | /*! @brief Posts an empty event to the event queue. |
| 4525 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4526 | * 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] | 4527 | * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4528 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4529 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4530 | * GLFW_PLATFORM_ERROR. |
| 4531 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4532 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4533 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4534 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4535 | * @sa @ref glfwWaitEvents |
| 4536 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4537 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4538 | * @since Added in version 3.1. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4539 | * |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 4540 | * @ingroup window |
| 4541 | */ |
| 4542 | GLFWAPI void glfwPostEmptyEvent(void); |
| 4543 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4544 | /*! @brief Returns the value of an input option for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4545 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4546 | * 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] | 4547 | * 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] | 4548 | * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4549 | * @ref GLFW_RAW_MOUSE_MOTION. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4550 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4551 | * @param[in] window The window to query. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 4552 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4553 | * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or |
| 4554 | * `GLFW_RAW_MOUSE_MOTION`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4555 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4556 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4557 | * GLFW_INVALID_ENUM. |
| 4558 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4559 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4560 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4561 | * @sa @ref glfwSetInputMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4562 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4563 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4564 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4565 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4566 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4567 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4568 | |
| 4569 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4570 | * |
| 4571 | * 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] | 4572 | * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4573 | * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4574 | * @ref GLFW_RAW_MOUSE_MOTION. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4575 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4576 | * 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] | 4577 | * modes: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 4578 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4579 | * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the |
| 4580 | * 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] | 4581 | * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual |
| 4582 | * and unlimited cursor movement. This is useful for implementing for |
| 4583 | * example 3D camera controls. |
Camilla Löwy | 488008e | 2019-12-03 17:58:20 +0100 | [diff] [blame] | 4584 | * - `GLFW_CURSOR_CAPTURED` makes the cursor visible and confines it to the |
| 4585 | * content area of the window. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 4586 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 4587 | * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to |
| 4588 | * 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] | 4589 | * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` |
| 4590 | * the next time it is called even if the key had been released before the |
| 4591 | * call. This is useful when you are only interested in whether keys have been |
| 4592 | * pressed but not when or in which order. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 4593 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4594 | * 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] | 4595 | * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. |
| 4596 | * If sticky mouse buttons are enabled, a mouse button press will ensure that |
| 4597 | * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even |
| 4598 | * if the mouse button had been released before the call. This is useful when |
| 4599 | * you are only interested in whether mouse buttons have been pressed but not |
| 4600 | * when or in which order. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4601 | * |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 4602 | * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to |
| 4603 | * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled, |
| 4604 | * callbacks that receive modifier bits will also have the @ref |
| 4605 | * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on, |
| 4606 | * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on. |
| 4607 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4608 | * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE` |
| 4609 | * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is |
| 4610 | * 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] | 4611 | * 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] | 4612 | * glfwRawMouseMotionSupported to check for support. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4613 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4614 | * @param[in] window The window whose input mode to set. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 4615 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4616 | * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or |
| 4617 | * `GLFW_RAW_MOUSE_MOTION`. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 4618 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 4619 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4620 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 9a87c2a | 2020-05-20 18:02:58 +0200 | [diff] [blame] | 4621 | * GLFW_INVALID_ENUM, @ref GLFW_PLATFORM_ERROR and @ref |
| 4622 | * GLFW_FEATURE_UNAVAILABLE (see above). |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4623 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4624 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4625 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4626 | * @sa @ref glfwGetInputMode |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4627 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4628 | * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4629 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4630 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4631 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4632 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4633 | |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4634 | /*! @brief Returns whether raw mouse motion is supported. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4635 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4636 | * This function returns whether raw mouse motion is supported on the current |
| 4637 | * system. This status does not change after GLFW has been initialized so you |
| 4638 | * only need to check this once. If you attempt to enable raw motion on |
| 4639 | * 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] | 4640 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4641 | * Raw mouse motion is closer to the actual motion of the mouse across |
| 4642 | * a surface. It is not affected by the scaling and acceleration applied to |
| 4643 | * the motion of the desktop cursor. That processing is suitable for a cursor |
| 4644 | * while raw motion is better for controlling for example a 3D camera. Because |
| 4645 | * 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] | 4646 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4647 | * @return `GLFW_TRUE` if raw mouse motion is supported on the current machine, |
| 4648 | * or `GLFW_FALSE` otherwise. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4649 | * |
| 4650 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4651 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4652 | * @thread_safety This function must only be called from the main thread. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4653 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4654 | * @sa @ref raw_mouse_motion |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4655 | * @sa @ref glfwSetInputMode |
| 4656 | * |
| 4657 | * @since Added in version 3.3. |
| 4658 | * |
| 4659 | * @ingroup input |
| 4660 | */ |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 4661 | GLFWAPI int glfwRawMouseMotionSupported(void); |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 4662 | |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 4663 | /*! @brief Returns the layout-specific name of the specified printable key. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4664 | * |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 4665 | * This function returns the name of the specified printable key, encoded as |
| 4666 | * UTF-8. This is typically the character that key would produce without any |
| 4667 | * modifier keys, intended for displaying key bindings to the user. For dead |
| 4668 | * keys, it is typically the diacritic it would add to a character. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4669 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 4670 | * __Do not use this function__ for [text input](@ref input_char). You will |
| 4671 | * 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] | 4672 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 4673 | * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key, |
| 4674 | * otherwise the scancode is ignored. If you specify a non-printable key, or |
| 4675 | * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this |
| 4676 | * function returns `NULL` but does not emit an error. |
| 4677 | * |
| 4678 | * This behavior allows you to always pass in the arguments in the |
Camilla Berglund | 70ffae7 | 2016-02-22 11:54:56 +0100 | [diff] [blame] | 4679 | * [key callback](@ref input_key) without modification. |
| 4680 | * |
| 4681 | * The printable keys are: |
| 4682 | * - `GLFW_KEY_APOSTROPHE` |
| 4683 | * - `GLFW_KEY_COMMA` |
| 4684 | * - `GLFW_KEY_MINUS` |
| 4685 | * - `GLFW_KEY_PERIOD` |
| 4686 | * - `GLFW_KEY_SLASH` |
| 4687 | * - `GLFW_KEY_SEMICOLON` |
| 4688 | * - `GLFW_KEY_EQUAL` |
| 4689 | * - `GLFW_KEY_LEFT_BRACKET` |
| 4690 | * - `GLFW_KEY_RIGHT_BRACKET` |
| 4691 | * - `GLFW_KEY_BACKSLASH` |
| 4692 | * - `GLFW_KEY_WORLD_1` |
| 4693 | * - `GLFW_KEY_WORLD_2` |
| 4694 | * - `GLFW_KEY_0` to `GLFW_KEY_9` |
| 4695 | * - `GLFW_KEY_A` to `GLFW_KEY_Z` |
| 4696 | * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9` |
| 4697 | * - `GLFW_KEY_KP_DECIMAL` |
| 4698 | * - `GLFW_KEY_KP_DIVIDE` |
| 4699 | * - `GLFW_KEY_KP_MULTIPLY` |
| 4700 | * - `GLFW_KEY_KP_SUBTRACT` |
| 4701 | * - `GLFW_KEY_KP_ADD` |
| 4702 | * - `GLFW_KEY_KP_EQUAL` |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4703 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 4704 | * Names for printable keys depend on keyboard layout, while names for |
| 4705 | * non-printable keys are the same across layouts but depend on the application |
| 4706 | * language and should be localized along with other user interface text. |
| 4707 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4708 | * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`. |
| 4709 | * @param[in] scancode The scancode of the key to query. |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 4710 | * @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] | 4711 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4712 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4713 | * GLFW_PLATFORM_ERROR. |
| 4714 | * |
Camilla Löwy | 56ca0cb | 2019-08-22 21:31:46 +0200 | [diff] [blame] | 4715 | * @remark The contents of the returned string may change when a keyboard |
| 4716 | * layout change event is received. |
| 4717 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4718 | * @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] | 4719 | * 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] | 4720 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4721 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4722 | * |
| 4723 | * @sa @ref input_key_name |
| 4724 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4725 | * @since Added in version 3.2. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4726 | * |
| 4727 | * @ingroup input |
| 4728 | */ |
| 4729 | GLFWAPI const char* glfwGetKeyName(int key, int scancode); |
| 4730 | |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4731 | /*! @brief Returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4732 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4733 | * This function returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4734 | * |
| 4735 | * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this |
| 4736 | * method will return `-1`. |
| 4737 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4738 | * @param[in] key Any [named key](@ref keys). |
| 4739 | * @return The platform-specific scancode for the key, or `-1` if an |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4740 | * [error](@ref error_handling) occurred. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4741 | * |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4742 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4743 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4744 | * |
| 4745 | * @thread_safety This function may be called from any thread. |
| 4746 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4747 | * @sa @ref input_key |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4748 | * |
| 4749 | * @since Added in version 3.3. |
| 4750 | * |
| 4751 | * @ingroup input |
| 4752 | */ |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4753 | GLFWAPI int glfwGetKeyScancode(int key); |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4754 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4755 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 4756 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4757 | * |
| 4758 | * This function returns the last state reported for the specified key to the |
| 4759 | * specified window. The returned state is one of `GLFW_PRESS` or |
Camilla Löwy | aa80d24 | 2022-06-28 23:19:30 +0200 | [diff] [blame] | 4760 | * `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] | 4761 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4762 | * 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] | 4763 | * `GLFW_PRESS` the first time you call it for a key that was pressed, even if |
| 4764 | * that key has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4765 | * |
| 4766 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 4767 | * named after their use on the standard US keyboard layout. If you want to |
| 4768 | * input text, use the Unicode character callback instead. |
| 4769 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4770 | * The [modifier key bit masks](@ref mods) are not key tokens and cannot be |
| 4771 | * used with this function. |
| 4772 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4773 | * __Do not use this function__ to implement [text input](@ref input_char). |
| 4774 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4775 | * @param[in] window The desired window. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4776 | * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is |
| 4777 | * not a valid key for this function. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4778 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4779 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4780 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4781 | * GLFW_INVALID_ENUM. |
| 4782 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4783 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4784 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4785 | * @sa @ref input_key |
| 4786 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4787 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4788 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 4789 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4790 | * @ingroup input |
| 4791 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4792 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4793 | |
| 4794 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 4795 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4796 | * |
| 4797 | * This function returns the last state reported for the specified mouse button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4798 | * 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] | 4799 | * `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4800 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4801 | * 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] | 4802 | * returns `GLFW_PRESS` the first time you call it for a mouse button that was |
| 4803 | * pressed, even if that mouse button has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4804 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4805 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4806 | * @param[in] button The desired [mouse button](@ref buttons). |
| 4807 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4808 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4809 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4810 | * GLFW_INVALID_ENUM. |
| 4811 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4812 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4813 | * |
| 4814 | * @sa @ref input_mouse_button |
| 4815 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4816 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4817 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4818 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4819 | * @ingroup input |
| 4820 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4821 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4822 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4823 | /*! @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] | 4824 | * the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4825 | * |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 4826 | * This function returns the position of the cursor, in screen coordinates, |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4827 | * 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] | 4828 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4829 | * |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4830 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
| 4831 | * position is unbounded and limited only by the minimum and maximum values of |
| 4832 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4833 | * |
Camilla Berglund | 3ec2925 | 2013-04-25 18:03:15 +0200 | [diff] [blame] | 4834 | * The coordinate can be converted to their integer equivalents with the |
| 4835 | * `floor` function. Casting directly to an integer type works for positive |
| 4836 | * coordinates, but fails for negative ones. |
| 4837 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4838 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 4839 | * non-`NULL` position arguments will be set to zero. |
| 4840 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4841 | * @param[in] window The desired window. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4842 | * @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] | 4843 | * left edge of the content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4844 | * @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] | 4845 | * top edge of the content area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4846 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4847 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4848 | * GLFW_PLATFORM_ERROR. |
| 4849 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4850 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4851 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4852 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4853 | * @sa @ref glfwSetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4854 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4855 | * @since Added in version 3.0. Replaces `glfwGetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4856 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4857 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4858 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4859 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4860 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4861 | /*! @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] | 4862 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4863 | * |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 4864 | * This function sets the position, in screen coordinates, of the cursor |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4865 | * 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] | 4866 | * window. The window must have input focus. If the window does not have |
| 4867 | * input focus when this function is called, it fails silently. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4868 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 4869 | * __Do not use this function__ to implement things like camera controls. GLFW |
| 4870 | * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the |
| 4871 | * cursor, transparently re-centers it and provides unconstrained cursor |
| 4872 | * motion. See @ref glfwSetInputMode for more information. |
| 4873 | * |
| 4874 | * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is |
| 4875 | * unconstrained and limited only by the minimum and maximum values of |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4876 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4877 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4878 | * @param[in] window The desired window. |
| 4879 | * @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] | 4880 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4881 | * @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] | 4882 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4883 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4884 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4885 | * GLFW_PLATFORM_ERROR. |
| 4886 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4887 | * @remark @wayland This function will only work when the cursor mode is |
| 4888 | * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing. |
| 4889 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4890 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4891 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4892 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4893 | * @sa @ref glfwGetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4894 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4895 | * @since Added in version 3.0. Replaces `glfwSetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4896 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4897 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4898 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4899 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4900 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4901 | /*! @brief Creates a custom cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4902 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4903 | * Creates a new custom cursor image that can be set for a window with @ref |
| 4904 | * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. |
| 4905 | * Any remaining cursors are destroyed by @ref glfwTerminate. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4906 | * |
Camilla Berglund | 85a01bf | 2015-08-17 21:04:19 +0200 | [diff] [blame] | 4907 | * 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] | 4908 | * bits per channel with the red channel first. They are arranged canonically |
| 4909 | * as packed sequential rows, starting from the top-left corner. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4910 | * |
| 4911 | * The cursor hotspot is specified in pixels, relative to the upper-left corner |
| 4912 | * of the cursor image. Like all other coordinate systems in GLFW, the X-axis |
| 4913 | * points to the right and the Y-axis points down. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4914 | * |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 4915 | * @param[in] image The desired cursor image. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4916 | * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. |
| 4917 | * @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] | 4918 | * @return The handle of the created cursor, or `NULL` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4919 | * [error](@ref error_handling) occurred. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4920 | * |
Camilla Löwy | 66a4882 | 2022-03-15 21:22:49 +0100 | [diff] [blame] | 4921 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4922 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4923 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4924 | * @pointer_lifetime The specified image data is copied before this function |
| 4925 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4926 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4927 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4928 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4929 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4930 | * @sa @ref glfwDestroyCursor |
| 4931 | * @sa @ref glfwCreateStandardCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4932 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4933 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4934 | * |
| 4935 | * @ingroup input |
| 4936 | */ |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 4937 | GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4938 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4939 | /*! @brief Creates a cursor with a standard shape. |
| 4940 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 4941 | * Returns a cursor with a standard shape, that can be set for a window with |
| 4942 | * @ref glfwSetCursor. The images for these cursors come from the system |
| 4943 | * cursor theme and their exact appearance will vary between platforms. |
| 4944 | * |
| 4945 | * Most of these shapes are guaranteed to exist on every supported platform but |
| 4946 | * a few may not be present. See the table below for details. |
| 4947 | * |
| 4948 | * Cursor shape | Windows | macOS | X11 | Wayland |
| 4949 | * ------------------------------ | ------- | ----- | ------ | ------- |
| 4950 | * @ref GLFW_ARROW_CURSOR | Yes | Yes | Yes | Yes |
| 4951 | * @ref GLFW_IBEAM_CURSOR | Yes | Yes | Yes | Yes |
| 4952 | * @ref GLFW_CROSSHAIR_CURSOR | Yes | Yes | Yes | Yes |
| 4953 | * @ref GLFW_POINTING_HAND_CURSOR | Yes | Yes | Yes | Yes |
| 4954 | * @ref GLFW_RESIZE_EW_CURSOR | Yes | Yes | Yes | Yes |
| 4955 | * @ref GLFW_RESIZE_NS_CURSOR | Yes | Yes | Yes | Yes |
| 4956 | * @ref GLFW_RESIZE_NWSE_CURSOR | Yes | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup> |
| 4957 | * @ref GLFW_RESIZE_NESW_CURSOR | Yes | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup> |
| 4958 | * @ref GLFW_RESIZE_ALL_CURSOR | Yes | Yes | Yes | Yes |
| 4959 | * @ref GLFW_NOT_ALLOWED_CURSOR | Yes | Yes | Maybe<sup>2</sup> | Maybe<sup>2</sup> |
| 4960 | * |
| 4961 | * 1) This uses a private system API and may fail in the future. |
| 4962 | * |
| 4963 | * 2) This uses a newer standard that not all cursor themes support. |
| 4964 | * |
| 4965 | * If the requested shape is not available, this function emits a @ref |
| 4966 | * GLFW_CURSOR_UNAVAILABLE error and returns `NULL`. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4967 | * |
| 4968 | * @param[in] shape One of the [standard shapes](@ref shapes). |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4969 | * @return A new cursor ready to use or `NULL` if an |
| 4970 | * [error](@ref error_handling) occurred. |
| 4971 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4972 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 4973 | * GLFW_INVALID_ENUM, @ref GLFW_CURSOR_UNAVAILABLE and @ref |
| 4974 | * GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4975 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4976 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4977 | * |
Camilla Löwy | 7dbdd2e | 2019-05-07 20:40:37 +0200 | [diff] [blame] | 4978 | * @sa @ref cursor_standard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4979 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4980 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4981 | * @since Added in version 3.1. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4982 | * |
| 4983 | * @ingroup input |
| 4984 | */ |
| 4985 | GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); |
| 4986 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4987 | /*! @brief Destroys a cursor. |
| 4988 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4989 | * This function destroys a cursor previously created with @ref |
| 4990 | * glfwCreateCursor. Any remaining cursors will be destroyed by @ref |
| 4991 | * glfwTerminate. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4992 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4993 | * If the specified cursor is current for any window, that window will be |
| 4994 | * reverted to the default cursor. This does not affect the cursor mode. |
| 4995 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4996 | * @param[in] cursor The cursor object to destroy. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4997 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4998 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4999 | * GLFW_PLATFORM_ERROR. |
| 5000 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5001 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5002 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5003 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5004 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5005 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5006 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5007 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5008 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5009 | * |
| 5010 | * @ingroup input |
| 5011 | */ |
| 5012 | GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); |
| 5013 | |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5014 | /*! @brief Sets the cursor for the window. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5015 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5016 | * 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] | 5017 | * 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] | 5018 | * when the [cursor mode](@ref cursor_mode) of the window is |
| 5019 | * `GLFW_CURSOR_NORMAL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5020 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5021 | * On some platforms, the set cursor may not be visible unless the window also |
| 5022 | * has input focus. |
| 5023 | * |
| 5024 | * @param[in] window The window to set the cursor for. |
| 5025 | * @param[in] cursor The cursor to set, or `NULL` to switch back to the default |
| 5026 | * arrow cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5027 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5028 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5029 | * GLFW_PLATFORM_ERROR. |
| 5030 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5031 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5032 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5033 | * @sa @ref cursor_object |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5034 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5035 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5036 | * |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 5037 | * @ingroup input |
| 5038 | */ |
| 5039 | GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); |
| 5040 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5041 | /*! @brief Sets the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5042 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5043 | * 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] | 5044 | * when a key is pressed, repeated or released. |
| 5045 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 5046 | * The key functions deal with physical keys, with layout independent |
| 5047 | * [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] | 5048 | * layout. If you want to input text, use the |
| 5049 | * [character callback](@ref glfwSetCharCallback) instead. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5050 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5051 | * When a window loses input focus, it will generate synthetic key release |
| 5052 | * events for all pressed keys. You can tell these events from user-generated |
| 5053 | * events by the fact that the synthetic ones are generated after the focus |
| 5054 | * loss event has been processed, i.e. after the |
| 5055 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 5056 | * |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 5057 | * The scancode of a key is specific to that platform or sometimes even to that |
| 5058 | * machine. Scancodes are intended to allow users to bind keys that don't have |
| 5059 | * 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] | 5060 | * 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] | 5061 | * |
| 5062 | * Sometimes GLFW needs to generate synthetic key events, in which case the |
| 5063 | * scancode may be zero. |
| 5064 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5065 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5066 | * @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] | 5067 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5068 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5069 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5070 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5071 | * @callback_signature |
| 5072 | * @code |
| 5073 | * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods) |
| 5074 | * @endcode |
| 5075 | * For more information about the callback parameters, see the |
| 5076 | * [function pointer type](@ref GLFWkeyfun). |
| 5077 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5078 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5079 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5080 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5081 | * |
| 5082 | * @sa @ref input_key |
| 5083 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5084 | * @since Added in version 1.0. |
| 5085 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5086 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5087 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5088 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5089 | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5090 | |
| 5091 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5092 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5093 | * This function sets the character callback of the specified window, which is |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5094 | * called when a Unicode character is input. |
| 5095 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5096 | * The character callback is intended for Unicode text input. As it deals with |
| 5097 | * characters, it is keyboard layout dependent, whereas the |
| 5098 | * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 |
| 5099 | * to physical keys, as a key may produce zero, one or more characters. If you |
| 5100 | * want to know whether a specific physical key was pressed or released, see |
| 5101 | * the key callback instead. |
| 5102 | * |
| 5103 | * The character callback behaves as system text input normally does and will |
| 5104 | * 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] | 5105 | * 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] | 5106 | * on Windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5107 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5108 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5109 | * @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] | 5110 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5111 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5112 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5113 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5114 | * @callback_signature |
| 5115 | * @code |
| 5116 | * void function_name(GLFWwindow* window, unsigned int codepoint) |
| 5117 | * @endcode |
| 5118 | * For more information about the callback parameters, see the |
| 5119 | * [function pointer type](@ref GLFWcharfun). |
| 5120 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5121 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5122 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5123 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5124 | * |
| 5125 | * @sa @ref input_char |
| 5126 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5127 | * @since Added in version 2.4. |
| 5128 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5129 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5130 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5131 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5132 | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5133 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5134 | /*! @brief Sets the Unicode character with modifiers callback. |
| 5135 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5136 | * This function sets the character with modifiers callback of the specified |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5137 | * window, which is called when a Unicode character is input regardless of what |
| 5138 | * modifier keys are used. |
| 5139 | * |
| 5140 | * The character with modifiers callback is intended for implementing custom |
| 5141 | * Unicode character input. For regular Unicode text input, see the |
| 5142 | * [character callback](@ref glfwSetCharCallback). Like the character |
| 5143 | * callback, the character with modifiers callback deals with characters and is |
| 5144 | * keyboard layout dependent. Characters do not map 1:1 to physical keys, as |
| 5145 | * a key may produce zero, one or more characters. If you want to know whether |
| 5146 | * a specific physical key was pressed or released, see the |
| 5147 | * [key callback](@ref glfwSetKeyCallback) instead. |
| 5148 | * |
| 5149 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5150 | * @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] | 5151 | * callback. |
| 5152 | * @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] | 5153 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5154 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5155 | * @callback_signature |
| 5156 | * @code |
| 5157 | * void function_name(GLFWwindow* window, unsigned int codepoint, int mods) |
| 5158 | * @endcode |
| 5159 | * For more information about the callback parameters, see the |
| 5160 | * [function pointer type](@ref GLFWcharmodsfun). |
| 5161 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 5162 | * @deprecated Scheduled for removal in version 4.0. |
| 5163 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5164 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5165 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5166 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5167 | * |
| 5168 | * @sa @ref input_char |
| 5169 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5170 | * @since Added in version 3.1. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5171 | * |
| 5172 | * @ingroup input |
| 5173 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5174 | GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback); |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 5175 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5176 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5177 | * |
| 5178 | * This function sets the mouse button callback of the specified window, which |
| 5179 | * is called when a mouse button is pressed or released. |
| 5180 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5181 | * When a window loses input focus, it will generate synthetic mouse button |
| 5182 | * release events for all pressed mouse buttons. You can tell these events |
| 5183 | * from user-generated events by the fact that the synthetic ones are generated |
| 5184 | * after the focus loss event has been processed, i.e. after the |
| 5185 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 5186 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5187 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5188 | * @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] | 5189 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5190 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5191 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5192 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5193 | * @callback_signature |
| 5194 | * @code |
| 5195 | * void function_name(GLFWwindow* window, int button, int action, int mods) |
| 5196 | * @endcode |
| 5197 | * For more information about the callback parameters, see the |
| 5198 | * [function pointer type](@ref GLFWmousebuttonfun). |
| 5199 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5200 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5201 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5202 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5203 | * |
| 5204 | * @sa @ref input_mouse_button |
| 5205 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5206 | * @since Added in version 1.0. |
| 5207 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5208 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5209 | * @ingroup input |
| 5210 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5211 | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5212 | |
| 5213 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5214 | * |
| 5215 | * This function sets the cursor position callback of the specified window, |
| 5216 | * 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] | 5217 | * 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] | 5218 | * content area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5219 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5220 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5221 | * @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] | 5222 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5223 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5224 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5225 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5226 | * @callback_signature |
| 5227 | * @code |
| 5228 | * void function_name(GLFWwindow* window, double xpos, double ypos); |
| 5229 | * @endcode |
| 5230 | * For more information about the callback parameters, see the |
| 5231 | * [function pointer type](@ref GLFWcursorposfun). |
| 5232 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5233 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5234 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5235 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5236 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5237 | * @sa @ref cursor_pos |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5238 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5239 | * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5240 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5241 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5242 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5243 | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5244 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5245 | /*! @brief Sets the cursor enter/leave callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5246 | * |
| 5247 | * This function sets the cursor boundary crossing callback of the specified |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 5248 | * 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] | 5249 | * the window. |
| 5250 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5251 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5252 | * @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] | 5253 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5254 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5255 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5256 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5257 | * @callback_signature |
| 5258 | * @code |
| 5259 | * void function_name(GLFWwindow* window, int entered) |
| 5260 | * @endcode |
| 5261 | * For more information about the callback parameters, see the |
| 5262 | * [function pointer type](@ref GLFWcursorenterfun). |
| 5263 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5264 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5265 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5266 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5267 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5268 | * @sa @ref cursor_enter |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5269 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5270 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5271 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5272 | * @ingroup input |
| 5273 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5274 | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5275 | |
| 5276 | /*! @brief Sets the scroll callback. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5277 | * |
| 5278 | * This function sets the scroll callback of the specified window, which is |
| 5279 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
| 5280 | * area of a touchpad. |
| 5281 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5282 | * The scroll callback receives all scrolling input, like that from a mouse |
| 5283 | * wheel or a touchpad scrolling area. |
| 5284 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5285 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5286 | * @param[in] callback The new scroll callback, or `NULL` to remove the |
| 5287 | * currently set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5288 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5289 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 5290 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5291 | * @callback_signature |
| 5292 | * @code |
| 5293 | * void function_name(GLFWwindow* window, double xoffset, double yoffset) |
| 5294 | * @endcode |
| 5295 | * For more information about the callback parameters, see the |
| 5296 | * [function pointer type](@ref GLFWscrollfun). |
| 5297 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5298 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5299 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5300 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5301 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5302 | * @sa @ref scrolling |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5303 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5304 | * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5305 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5306 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5307 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5308 | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5309 | |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5310 | /*! @brief Sets the path drop callback. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5311 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5312 | * This function sets the path drop callback of the specified window, which is |
| 5313 | * called when one or more dragged paths are dropped on the window. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5314 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5315 | * Because the path array and its strings may have been generated specifically |
| 5316 | * for that event, they are not guaranteed to be valid after the callback has |
| 5317 | * returned. If you wish to use them after the callback returns, you need to |
| 5318 | * make a deep copy. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5319 | * |
| 5320 | * @param[in] window The window whose callback to set. |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5321 | * @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] | 5322 | * currently set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 5323 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5324 | * library had not been [initialized](@ref intro_init). |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5325 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5326 | * @callback_signature |
| 5327 | * @code |
| 5328 | * void function_name(GLFWwindow* window, int path_count, const char* paths[]) |
| 5329 | * @endcode |
| 5330 | * For more information about the callback parameters, see the |
| 5331 | * [function pointer type](@ref GLFWdropfun). |
| 5332 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5333 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5334 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 5335 | * @remark @wayland File drop is currently unimplemented. |
| 5336 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5337 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5338 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5339 | * @sa @ref path_drop |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5340 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5341 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5342 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5343 | * @ingroup input |
| 5344 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5345 | GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback); |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 5346 | |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 5347 | /*! @brief Returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5348 | * |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 5349 | * This function returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5350 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5351 | * There is no need to call this function before other functions that accept |
| 5352 | * a joystick ID, as they all check for presence before performing any other |
| 5353 | * work. |
| 5354 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5355 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 5356 | * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5357 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5358 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5359 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5360 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5361 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5362 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5363 | * @sa @ref joystick |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5364 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5365 | * @since Added in version 3.0. Replaces `glfwGetJoystickParam`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5366 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5367 | * @ingroup input |
| 5368 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5369 | GLFWAPI int glfwJoystickPresent(int jid); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5370 | |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 5371 | /*! @brief Returns the values of all axes of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5372 | * |
| 5373 | * This function returns the values of all axes of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5374 | * 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] | 5375 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5376 | * 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] | 5377 | * but will not generate an error. This can be used instead of first calling |
| 5378 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 5379 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5380 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5381 | * @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] | 5382 | * array. This is set to zero if the joystick is not present or an error |
| 5383 | * occurred. |
| 5384 | * @return An array of axis values, or `NULL` if the joystick is not present or |
| 5385 | * an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 5386 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5387 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5388 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5389 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5390 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5391 | * 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] | 5392 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5393 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5394 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 5395 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5396 | * @sa @ref joystick_axis |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5397 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5398 | * @since Added in version 3.0. Replaces `glfwGetJoystickPos`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5399 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5400 | * @ingroup input |
| 5401 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5402 | GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5403 | |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 5404 | /*! @brief Returns the state of all buttons of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5405 | * |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 5406 | * This function returns the state of all buttons of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5407 | * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5408 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5409 | * For backward compatibility with earlier versions that did not have @ref |
| 5410 | * glfwGetJoystickHats, the button array also includes all hats, each |
| 5411 | * represented as four buttons. The hats are in the same order as returned by |
| 5412 | * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and |
| 5413 | * _left_. To disable these extra buttons, set the @ref |
| 5414 | * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization. |
| 5415 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5416 | * 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] | 5417 | * but will not generate an error. This can be used instead of first calling |
| 5418 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 5419 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5420 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5421 | * @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] | 5422 | * array. This is set to zero if the joystick is not present or an error |
| 5423 | * occurred. |
| 5424 | * @return An array of button states, or `NULL` if the joystick is not present |
| 5425 | * or an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 5426 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5427 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5428 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5429 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5430 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5431 | * 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] | 5432 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5433 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5434 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 5435 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5436 | * @sa @ref joystick_button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5437 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5438 | * @since Added in version 2.2. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5439 | * @glfw3 Changed to return a dynamic array. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5440 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5441 | * @ingroup input |
| 5442 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5443 | GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5444 | |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5445 | /*! @brief Returns the state of all hats of the specified joystick. |
| 5446 | * |
| 5447 | * 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] | 5448 | * Each element in the array is one of the following values: |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5449 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5450 | * Name | Value |
Camilla Löwy | bb2ca1d | 2018-11-27 21:49:19 +0100 | [diff] [blame] | 5451 | * ---- | ----- |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5452 | * `GLFW_HAT_CENTERED` | 0 |
| 5453 | * `GLFW_HAT_UP` | 1 |
| 5454 | * `GLFW_HAT_RIGHT` | 2 |
| 5455 | * `GLFW_HAT_DOWN` | 4 |
| 5456 | * `GLFW_HAT_LEFT` | 8 |
| 5457 | * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` |
| 5458 | * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` |
| 5459 | * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` |
| 5460 | * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5461 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5462 | * The diagonal directions are bitwise combinations of the primary (up, right, |
| 5463 | * down and left) directions and you can test for these individually by ANDing |
| 5464 | * it with the corresponding direction. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5465 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5466 | * @code |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 5467 | * if (hats[2] & GLFW_HAT_RIGHT) |
| 5468 | * { |
| 5469 | * // State of hat 2 could be right-up, right or right-down |
| 5470 | * } |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 5471 | * @endcode |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5472 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5473 | * 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] | 5474 | * but will not generate an error. This can be used instead of first calling |
| 5475 | * @ref glfwJoystickPresent. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5476 | * |
| 5477 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5478 | * @param[out] count Where to store the number of hat states in the returned |
| 5479 | * array. This is set to zero if the joystick is not present or an error |
| 5480 | * occurred. |
| 5481 | * @return An array of hat states, or `NULL` if the joystick is not present |
| 5482 | * or an [error](@ref error_handling) occurred. |
| 5483 | * |
| 5484 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5485 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5486 | * |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 5487 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5488 | * should not free it yourself. It is valid until the specified joystick is |
| 5489 | * disconnected, this function is called again for that joystick or the library |
| 5490 | * is terminated. |
| 5491 | * |
| 5492 | * @thread_safety This function must only be called from the main thread. |
| 5493 | * |
| 5494 | * @sa @ref joystick_hat |
| 5495 | * |
| 5496 | * @since Added in version 3.3. |
| 5497 | * |
| 5498 | * @ingroup input |
| 5499 | */ |
| 5500 | GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count); |
| 5501 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 5502 | /*! @brief Returns the name of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5503 | * |
| 5504 | * 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] | 5505 | * The returned string is allocated and freed by GLFW. You should not free it |
| 5506 | * yourself. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5507 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5508 | * 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] | 5509 | * but will not generate an error. This can be used instead of first calling |
| 5510 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 5511 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5512 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5513 | * @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] | 5514 | * is not present or an [error](@ref error_handling) occurred. |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 5515 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5516 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5517 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5518 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5519 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5520 | * 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] | 5521 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5522 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5523 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 5524 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5525 | * @sa @ref joystick_name |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5526 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5527 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5528 | * |
| 5529 | * @ingroup input |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 5530 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 5531 | GLFWAPI const char* glfwGetJoystickName(int jid); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5532 | |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 5533 | /*! @brief Returns the SDL compatible GUID of the specified joystick. |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 5534 | * |
| 5535 | * This function returns the SDL compatible GUID, as a UTF-8 encoded |
| 5536 | * hexadecimal string, of the specified joystick. The returned string is |
| 5537 | * allocated and freed by GLFW. You should not free it yourself. |
| 5538 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5539 | * The GUID is what connects a joystick to a gamepad mapping. A connected |
| 5540 | * joystick will always have a GUID even if there is no gamepad mapping |
| 5541 | * assigned to it. |
| 5542 | * |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 5543 | * 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] | 5544 | * but will not generate an error. This can be used instead of first calling |
| 5545 | * @ref glfwJoystickPresent. |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 5546 | * |
| 5547 | * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to |
| 5548 | * uniquely identify the make and model of a joystick but does not identify |
| 5549 | * a specific unit, e.g. all wired Xbox 360 controllers will have the same |
| 5550 | * GUID on that platform. The GUID for a unit may vary between platforms |
| 5551 | * depending on what hardware information the platform specific APIs provide. |
| 5552 | * |
| 5553 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5554 | * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick |
| 5555 | * is not present or an [error](@ref error_handling) occurred. |
| 5556 | * |
| 5557 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5558 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 5559 | * |
| 5560 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5561 | * should not free it yourself. It is valid until the specified joystick is |
| 5562 | * disconnected or the library is terminated. |
| 5563 | * |
| 5564 | * @thread_safety This function must only be called from the main thread. |
| 5565 | * |
| 5566 | * @sa @ref gamepad |
| 5567 | * |
| 5568 | * @since Added in version 3.3. |
| 5569 | * |
| 5570 | * @ingroup input |
| 5571 | */ |
| 5572 | GLFWAPI const char* glfwGetJoystickGUID(int jid); |
| 5573 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 5574 | /*! @brief Sets the user pointer of the specified joystick. |
| 5575 | * |
| 5576 | * This function sets the user-defined pointer of the specified joystick. The |
| 5577 | * current value is retained until the joystick is disconnected. The initial |
| 5578 | * value is `NULL`. |
| 5579 | * |
| 5580 | * This function may be called from the joystick callback, even for a joystick |
| 5581 | * that is being disconnected. |
| 5582 | * |
Camilla Löwy | d222a40 | 2018-02-25 20:37:31 +0100 | [diff] [blame] | 5583 | * @param[in] jid The joystick whose pointer to set. |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 5584 | * @param[in] pointer The new value. |
| 5585 | * |
| 5586 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5587 | * |
| 5588 | * @thread_safety This function may be called from any thread. Access is not |
| 5589 | * synchronized. |
| 5590 | * |
| 5591 | * @sa @ref joystick_userptr |
| 5592 | * @sa @ref glfwGetJoystickUserPointer |
| 5593 | * |
| 5594 | * @since Added in version 3.3. |
| 5595 | * |
| 5596 | * @ingroup input |
| 5597 | */ |
| 5598 | GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer); |
| 5599 | |
| 5600 | /*! @brief Returns the user pointer of the specified joystick. |
| 5601 | * |
| 5602 | * This function returns the current value of the user-defined pointer of the |
| 5603 | * specified joystick. The initial value is `NULL`. |
| 5604 | * |
| 5605 | * This function may be called from the joystick callback, even for a joystick |
| 5606 | * that is being disconnected. |
| 5607 | * |
Camilla Löwy | d222a40 | 2018-02-25 20:37:31 +0100 | [diff] [blame] | 5608 | * @param[in] jid The joystick whose pointer to return. |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 5609 | * |
| 5610 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5611 | * |
| 5612 | * @thread_safety This function may be called from any thread. Access is not |
| 5613 | * synchronized. |
| 5614 | * |
| 5615 | * @sa @ref joystick_userptr |
| 5616 | * @sa @ref glfwSetJoystickUserPointer |
| 5617 | * |
| 5618 | * @since Added in version 3.3. |
| 5619 | * |
| 5620 | * @ingroup input |
| 5621 | */ |
| 5622 | GLFWAPI void* glfwGetJoystickUserPointer(int jid); |
| 5623 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5624 | /*! @brief Returns whether the specified joystick has a gamepad mapping. |
| 5625 | * |
| 5626 | * This function returns whether the specified joystick is both present and has |
| 5627 | * a gamepad mapping. |
| 5628 | * |
| 5629 | * If the specified joystick is present but does not have a gamepad mapping |
| 5630 | * 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] | 5631 | * @ref glfwJoystickPresent to check if a joystick is present regardless of |
| 5632 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5633 | * |
| 5634 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5635 | * @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping, |
| 5636 | * or `GLFW_FALSE` otherwise. |
| 5637 | * |
| 5638 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5639 | * GLFW_INVALID_ENUM. |
| 5640 | * |
| 5641 | * @thread_safety This function must only be called from the main thread. |
| 5642 | * |
| 5643 | * @sa @ref gamepad |
| 5644 | * @sa @ref glfwGetGamepadState |
| 5645 | * |
| 5646 | * @since Added in version 3.3. |
| 5647 | * |
| 5648 | * @ingroup input |
| 5649 | */ |
| 5650 | GLFWAPI int glfwJoystickIsGamepad(int jid); |
| 5651 | |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 5652 | /*! @brief Sets the joystick configuration callback. |
| 5653 | * |
| 5654 | * This function sets the joystick configuration callback, or removes the |
| 5655 | * currently set callback. This is called when a joystick is connected to or |
| 5656 | * disconnected from the system. |
| 5657 | * |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 5658 | * For joystick connection and disconnection events to be delivered on all |
| 5659 | * platforms, you need to call one of the [event processing](@ref events) |
| 5660 | * functions. Joystick disconnection may also be detected and the callback |
| 5661 | * called by joystick functions. The function will then return whatever it |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5662 | * returns if the joystick is not present. |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 5663 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5664 | * @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] | 5665 | * callback. |
| 5666 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 5667 | * library had not been [initialized](@ref intro_init). |
| 5668 | * |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5669 | * @callback_signature |
| 5670 | * @code |
| 5671 | * void function_name(int jid, int event) |
| 5672 | * @endcode |
| 5673 | * For more information about the callback parameters, see the |
| 5674 | * [function pointer type](@ref GLFWjoystickfun). |
| 5675 | * |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 5676 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5677 | * |
| 5678 | * @thread_safety This function must only be called from the main thread. |
| 5679 | * |
| 5680 | * @sa @ref joystick_event |
| 5681 | * |
| 5682 | * @since Added in version 3.2. |
| 5683 | * |
| 5684 | * @ingroup input |
| 5685 | */ |
Camilla Löwy | 51bb76c | 2019-05-24 01:52:49 +0200 | [diff] [blame] | 5686 | GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback); |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 5687 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5688 | /*! @brief Adds the specified SDL_GameControllerDB gamepad mappings. |
| 5689 | * |
| 5690 | * This function parses the specified ASCII encoded string and updates the |
| 5691 | * internal list with any gamepad mappings it finds. This string may |
| 5692 | * contain either a single gamepad mapping or many mappings separated by |
| 5693 | * newlines. The parser supports the full format of the `gamecontrollerdb.txt` |
| 5694 | * source file including empty lines and comments. |
| 5695 | * |
| 5696 | * See @ref gamepad_mapping for a description of the format. |
| 5697 | * |
| 5698 | * If there is already a gamepad mapping for a given GUID in the internal list, |
| 5699 | * it will be replaced by the one passed to this function. If the library is |
| 5700 | * terminated and re-initialized the internal list will revert to the built-in |
| 5701 | * default. |
| 5702 | * |
| 5703 | * @param[in] string The string containing the gamepad mappings. |
| 5704 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
| 5705 | * [error](@ref error_handling) occurred. |
| 5706 | * |
| 5707 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5708 | * GLFW_INVALID_VALUE. |
| 5709 | * |
| 5710 | * @thread_safety This function must only be called from the main thread. |
| 5711 | * |
| 5712 | * @sa @ref gamepad |
| 5713 | * @sa @ref glfwJoystickIsGamepad |
| 5714 | * @sa @ref glfwGetGamepadName |
| 5715 | * |
| 5716 | * @since Added in version 3.3. |
| 5717 | * |
| 5718 | * @ingroup input |
| 5719 | */ |
| 5720 | GLFWAPI int glfwUpdateGamepadMappings(const char* string); |
| 5721 | |
| 5722 | /*! @brief Returns the human-readable gamepad name for the specified joystick. |
| 5723 | * |
| 5724 | * This function returns the human-readable name of the gamepad from the |
| 5725 | * gamepad mapping assigned to the specified joystick. |
| 5726 | * |
| 5727 | * 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] | 5728 | * this function will return `NULL` but will not generate an error. Call |
| 5729 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 5730 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5731 | * |
| 5732 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5733 | * @return The UTF-8 encoded name of the gamepad, or `NULL` if the |
| 5734 | * joystick is not present, does not have a mapping or an |
| 5735 | * [error](@ref error_handling) occurred. |
| 5736 | * |
InKryption | c19f36b | 2021-12-05 17:51:43 +0100 | [diff] [blame] | 5737 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM. |
| 5738 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5739 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5740 | * should not free it yourself. It is valid until the specified joystick is |
| 5741 | * disconnected, the gamepad mappings are updated or the library is terminated. |
| 5742 | * |
| 5743 | * @thread_safety This function must only be called from the main thread. |
| 5744 | * |
| 5745 | * @sa @ref gamepad |
| 5746 | * @sa @ref glfwJoystickIsGamepad |
| 5747 | * |
| 5748 | * @since Added in version 3.3. |
| 5749 | * |
| 5750 | * @ingroup input |
| 5751 | */ |
| 5752 | GLFWAPI const char* glfwGetGamepadName(int jid); |
| 5753 | |
| 5754 | /*! @brief Retrieves the state of the specified joystick remapped as a gamepad. |
| 5755 | * |
luz.paz | 7105ff2 | 2019-08-12 06:52:31 -0400 | [diff] [blame] | 5756 | * This function retrieves the state of the specified joystick remapped to |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5757 | * an Xbox-like gamepad. |
| 5758 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 5759 | * If the specified joystick is not present or does not have a gamepad mapping |
| 5760 | * this function will return `GLFW_FALSE` but will not generate an error. Call |
| 5761 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 5762 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5763 | * |
| 5764 | * The Guide button may not be available for input as it is often hooked by the |
| 5765 | * system or the Steam client. |
| 5766 | * |
| 5767 | * Not all devices have all the buttons or axes provided by @ref |
| 5768 | * GLFWgamepadstate. Unavailable buttons and axes will always report |
Camilla Löwy | 34d20b0 | 2018-03-03 22:24:26 +0100 | [diff] [blame] | 5769 | * `GLFW_RELEASE` and 0.0 respectively. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5770 | * |
| 5771 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 5772 | * @param[out] state The gamepad input state of the joystick. |
| 5773 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is |
| 5774 | * connected, it has no gamepad mapping or an [error](@ref error_handling) |
| 5775 | * occurred. |
| 5776 | * |
| 5777 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5778 | * GLFW_INVALID_ENUM. |
| 5779 | * |
Camilla Löwy | e1495c0 | 2018-08-09 13:57:10 +0200 | [diff] [blame] | 5780 | * @thread_safety This function must only be called from the main thread. |
| 5781 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5782 | * @sa @ref gamepad |
| 5783 | * @sa @ref glfwUpdateGamepadMappings |
| 5784 | * @sa @ref glfwJoystickIsGamepad |
| 5785 | * |
| 5786 | * @since Added in version 3.3. |
| 5787 | * |
| 5788 | * @ingroup input |
| 5789 | */ |
| 5790 | GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); |
| 5791 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5792 | /*! @brief Sets the clipboard to the specified string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5793 | * |
| 5794 | * This function sets the system clipboard to the specified, UTF-8 encoded |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5795 | * string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5796 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 5797 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5798 | * @param[in] string A UTF-8 encoded string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5799 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5800 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5801 | * GLFW_PLATFORM_ERROR. |
| 5802 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5803 | * @pointer_lifetime The specified string is copied before this function |
| 5804 | * returns. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 5805 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5806 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5807 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5808 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5809 | * @sa @ref glfwGetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5810 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5811 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5812 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 5813 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5814 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5815 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5816 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5817 | /*! @brief Returns the contents of the clipboard as a string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5818 | * |
| 5819 | * This function returns the contents of the system clipboard, if it contains |
Camilla Berglund | cf9079c | 2015-09-16 18:51:49 +0200 | [diff] [blame] | 5820 | * 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] | 5821 | * if its contents cannot be converted, `NULL` is returned and a @ref |
| 5822 | * GLFW_FORMAT_UNAVAILABLE error is generated. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5823 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 5824 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5825 | * @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] | 5826 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5827 | * |
InKryption | bb19332 | 2021-11-22 23:32:29 +0000 | [diff] [blame] | 5828 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5829 | * GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5830 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5831 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5832 | * 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] | 5833 | * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library |
| 5834 | * is terminated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5835 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5836 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5837 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5838 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5839 | * @sa @ref glfwSetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5840 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5841 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5842 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 5843 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5844 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5845 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 5846 | |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5847 | /*! @brief Returns the GLFW time. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5848 | * |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5849 | * This function returns the current GLFW time, in seconds. Unless the time |
| 5850 | * has been set using @ref glfwSetTime it measures time elapsed since GLFW was |
| 5851 | * initialized. |
| 5852 | * |
| 5853 | * This function and @ref glfwSetTime are helper functions on top of @ref |
| 5854 | * glfwGetTimerFrequency and @ref glfwGetTimerValue. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5855 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5856 | * The resolution of the timer is system dependent, but is usually on the order |
| 5857 | * 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] | 5858 | * time source on each operating system. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5859 | * |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5860 | * @return The current time, in seconds, or zero if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5861 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5862 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5863 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5864 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 5865 | * @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] | 5866 | * 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] | 5867 | * externally synchronized with calls to @ref glfwSetTime. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5868 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5869 | * @sa @ref time |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5870 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5871 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5872 | * |
| 5873 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5874 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 5875 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5876 | |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5877 | /*! @brief Sets the GLFW time. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5878 | * |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5879 | * This function sets the current GLFW time, in seconds. The value must be |
| 5880 | * a positive finite number less than or equal to 18446744073.0, which is |
| 5881 | * approximately 584.5 years. |
| 5882 | * |
| 5883 | * This function and @ref glfwGetTime are helper functions on top of @ref |
| 5884 | * glfwGetTimerFrequency and @ref glfwGetTimerValue. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5885 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5886 | * @param[in] time The new value, in seconds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5887 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5888 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5889 | * GLFW_INVALID_VALUE. |
| 5890 | * |
Camilla Löwy | bb6945a | 2019-05-20 17:13:09 +0200 | [diff] [blame] | 5891 | * @remark The upper limit of GLFW time is calculated as |
Camilla Berglund | 6e20cda | 2015-03-10 12:01:38 +0100 | [diff] [blame] | 5892 | * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations |
| 5893 | * storing nanoseconds in 64 bits. The limit may be increased in the future. |
| 5894 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 5895 | * @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] | 5896 | * 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] | 5897 | * externally synchronized with calls to @ref glfwGetTime. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5898 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5899 | * @sa @ref time |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5900 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5901 | * @since Added in version 2.2. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5902 | * |
| 5903 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5904 | */ |
| 5905 | GLFWAPI void glfwSetTime(double time); |
| 5906 | |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5907 | /*! @brief Returns the current value of the raw timer. |
| 5908 | * |
Camilla Berglund | 337c77a | 2016-03-06 14:11:14 +0100 | [diff] [blame] | 5909 | * This function returns the current value of the raw timer, measured in |
| 5910 | * 1 / frequency seconds. To get the frequency, call @ref |
| 5911 | * glfwGetTimerFrequency. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5912 | * |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 5913 | * @return The value of the timer, or zero if an |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5914 | * [error](@ref error_handling) occurred. |
| 5915 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 5916 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5917 | * |
| 5918 | * @thread_safety This function may be called from any thread. |
| 5919 | * |
| 5920 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5921 | * @sa @ref glfwGetTimerFrequency |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5922 | * |
| 5923 | * @since Added in version 3.2. |
| 5924 | * |
| 5925 | * @ingroup input |
| 5926 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 5927 | GLFWAPI uint64_t glfwGetTimerValue(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5928 | |
| 5929 | /*! @brief Returns the frequency, in Hz, of the raw timer. |
| 5930 | * |
Camilla Berglund | defaea3 | 2016-03-07 13:36:54 +0100 | [diff] [blame] | 5931 | * This function returns the frequency, in Hz, of the raw timer. |
| 5932 | * |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5933 | * @return The frequency of the timer, in Hz, or zero if an |
| 5934 | * [error](@ref error_handling) occurred. |
| 5935 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 5936 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5937 | * |
| 5938 | * @thread_safety This function may be called from any thread. |
| 5939 | * |
| 5940 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5941 | * @sa @ref glfwGetTimerValue |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5942 | * |
| 5943 | * @since Added in version 3.2. |
| 5944 | * |
| 5945 | * @ingroup input |
| 5946 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 5947 | GLFWAPI uint64_t glfwGetTimerFrequency(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5948 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5949 | /*! @brief Makes the context of the specified window current for the calling |
| 5950 | * thread. |
| 5951 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5952 | * This function makes the OpenGL or OpenGL ES context of the specified window |
Camilla Löwy | f2756d0 | 2017-11-02 19:30:12 +0100 | [diff] [blame] | 5953 | * current on the calling thread. A context must only be made current on |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5954 | * a single thread at a time and each thread can have only a single current |
| 5955 | * context at a time. |
| 5956 | * |
Camilla Löwy | f2756d0 | 2017-11-02 19:30:12 +0100 | [diff] [blame] | 5957 | * When moving a context between threads, you must make it non-current on the |
| 5958 | * old thread before making it current on the new one. |
| 5959 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5960 | * By default, making a context non-current implicitly forces a pipeline flush. |
| 5961 | * On machines that support `GL_KHR_context_flush_control`, you can control |
| 5962 | * whether a context performs this flush by setting the |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 5963 | * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) |
| 5964 | * hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5965 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 5966 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 5967 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 5968 | * error. |
| 5969 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5970 | * @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] | 5971 | * detach the current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5972 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5973 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5974 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5975 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5976 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5977 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5978 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5979 | * @sa @ref glfwGetCurrentContext |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5980 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5981 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5982 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5983 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5984 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5985 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5986 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5987 | /*! @brief Returns the window whose context is current on the calling thread. |
| 5988 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5989 | * This function returns the window whose OpenGL or OpenGL ES context is |
| 5990 | * current on the calling thread. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5991 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5992 | * @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] | 5993 | * context is current. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5994 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5995 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5996 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5997 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5998 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5999 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6000 | * @sa @ref glfwMakeContextCurrent |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6001 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6002 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6003 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6004 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6005 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 6006 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6007 | |
| 6008 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6009 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6010 | * This function swaps the front and back buffers of the specified window when |
| 6011 | * rendering with OpenGL or OpenGL ES. If the swap interval is greater than |
| 6012 | * zero, the GPU driver waits the specified number of screen updates before |
| 6013 | * swapping the buffers. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6014 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 6015 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 6016 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 6017 | * error. |
| 6018 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6019 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 6020 | * see `vkQueuePresentKHR` instead. |
| 6021 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 6022 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6023 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6024 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6025 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 6026 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6027 | * @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] | 6028 | * calling thread. |
| 6029 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6030 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 6031 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 6032 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6033 | * @sa @ref glfwSwapInterval |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6034 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6035 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6036 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6037 | * |
| 6038 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6039 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 6040 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6041 | |
| 6042 | /*! @brief Sets the swap interval for the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6043 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6044 | * This function sets the swap interval for the current OpenGL or OpenGL ES |
| 6045 | * context, i.e. the number of screen updates to wait from the time @ref |
| 6046 | * glfwSwapBuffers was called before swapping the buffers and returning. This |
| 6047 | * is sometimes called _vertical synchronization_, _vertical retrace |
| 6048 | * synchronization_ or just _vsync_. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6049 | * |
Camilla Löwy | 8094a1c | 2017-11-27 15:53:59 +0100 | [diff] [blame] | 6050 | * 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] | 6051 | * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap |
| 6052 | * intervals, which allows the driver to swap immediately even if a frame |
| 6053 | * arrives a little bit late. You can check for these extensions with @ref |
| 6054 | * glfwExtensionSupported. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 6055 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6056 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 6057 | * 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] | 6058 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6059 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 6060 | * see the present mode of your swapchain instead. |
| 6061 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 6062 | * @param[in] interval The minimum number of screen updates to wait for |
| 6063 | * until the buffers are swapped by @ref glfwSwapBuffers. |
| 6064 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6065 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6066 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 6067 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6068 | * @remark This function is not called during context creation, leaving the |
Camilla Löwy | 56a4cb0 | 2021-07-13 21:50:09 +0200 | [diff] [blame] | 6069 | * 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] | 6070 | * because some swap interval extensions used by GLFW do not allow the swap |
| 6071 | * interval to be reset to zero once it has been set to a non-zero value. |
| 6072 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6073 | * @remark Some GPU drivers do not honor the requested swap interval, either |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 6074 | * because of a user setting that overrides the application's request or due to |
| 6075 | * bugs in the driver. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 6076 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6077 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6078 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 6079 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6080 | * @sa @ref glfwSwapBuffers |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6081 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6082 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6083 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6084 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6085 | */ |
| 6086 | GLFWAPI void glfwSwapInterval(int interval); |
| 6087 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6088 | /*! @brief Returns whether the specified extension is available. |
| 6089 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 6090 | * This function returns whether the specified |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6091 | * [API extension](@ref context_glext) is supported by the current OpenGL or |
| 6092 | * OpenGL ES context. It searches both for client API extension and context |
| 6093 | * creation API extensions. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6094 | * |
| 6095 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 6096 | * 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] | 6097 | * |
| 6098 | * As this functions retrieves and searches one or more extension strings each |
| 6099 | * call, it is recommended that you cache its results if it is going to be used |
| 6100 | * frequently. The extension strings will not change during the lifetime of |
| 6101 | * a context, so there is no danger in doing this. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6102 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6103 | * This function does not apply to Vulkan. If you are using Vulkan, see @ref |
| 6104 | * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties` |
| 6105 | * and `vkEnumerateDeviceExtensionProperties` instead. |
| 6106 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6107 | * @param[in] extension The ASCII encoded name of the extension. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 6108 | * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` |
| 6109 | * otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 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_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref |
| 6113 | * GLFW_PLATFORM_ERROR. |
| 6114 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6115 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6116 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6117 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6118 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6119 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6120 | * @since Added in version 1.0. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 6121 | * |
| 6122 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6123 | */ |
| 6124 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 6125 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6126 | /*! @brief Returns the address of the specified function for the current |
| 6127 | * context. |
| 6128 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6129 | * This function returns the address of the specified OpenGL or OpenGL ES |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 6130 | * [core or extension function](@ref context_glext), if it is supported |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 6131 | * by the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6132 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6133 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 6134 | * 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] | 6135 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 6136 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 6137 | * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and |
| 6138 | * `vkGetDeviceProcAddr` instead. |
| 6139 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6140 | * @param[in] procname The ASCII encoded name of the function. |
Camilla Berglund | a36e3a2 | 2015-11-05 17:14:26 +0100 | [diff] [blame] | 6141 | * @return The address of the function, or `NULL` if an |
| 6142 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6143 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 6144 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6145 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 6146 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6147 | * @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] | 6148 | * between contexts. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6149 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6150 | * @remark This function may return a non-`NULL` address despite the |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 6151 | * associated version or extension not being available. Always check the |
Camilla Berglund | c8e0687 | 2015-08-27 21:40:22 +0200 | [diff] [blame] | 6152 | * context version or extension string first. |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 6153 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6154 | * @pointer_lifetime The returned function pointer is valid until the context |
| 6155 | * is destroyed or the library is terminated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6156 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 6157 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6158 | * |
| 6159 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6160 | * @sa @ref glfwExtensionSupported |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 6161 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 6162 | * @since Added in version 1.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 6163 | * |
| 6164 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 6165 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 6166 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6167 | |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6168 | /*! @brief Returns whether the Vulkan loader and an ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6169 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6170 | * This function returns whether the Vulkan loader and any minimally functional |
| 6171 | * ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6172 | * |
Camilla Löwy | 4be0444 | 2021-10-12 12:54:19 +0200 | [diff] [blame] | 6173 | * The availability of a Vulkan loader and even an ICD does not by itself guarantee that |
| 6174 | * surface creation or even instance creation is possible. Call @ref |
| 6175 | * glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan |
| 6176 | * surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to |
| 6177 | * check whether a queue family of a physical device supports image presentation. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6178 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6179 | * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` |
| 6180 | * otherwise. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6181 | * |
| 6182 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 6183 | * |
| 6184 | * @thread_safety This function may be called from any thread. |
| 6185 | * |
| 6186 | * @sa @ref vulkan_support |
| 6187 | * |
| 6188 | * @since Added in version 3.2. |
| 6189 | * |
| 6190 | * @ingroup vulkan |
| 6191 | */ |
| 6192 | GLFWAPI int glfwVulkanSupported(void); |
| 6193 | |
| 6194 | /*! @brief Returns the Vulkan instance extensions required by GLFW. |
| 6195 | * |
| 6196 | * This function returns an array of names of Vulkan instance extensions required |
| 6197 | * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the |
Lukas Zanner | 84b1311 | 2019-06-14 12:53:57 +0200 | [diff] [blame] | 6198 | * 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] | 6199 | * additional extensions you can pass this list directly to the |
| 6200 | * `VkInstanceCreateInfo` struct. |
| 6201 | * |
| 6202 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 6203 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6204 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6205 | * |
| 6206 | * If Vulkan is available but no set of extensions allowing window surface |
| 6207 | * creation was found, this function returns `NULL`. You may still use Vulkan |
| 6208 | * for off-screen rendering and compute work. |
| 6209 | * |
| 6210 | * @param[out] count Where to store the number of extensions in the returned |
| 6211 | * array. This is set to zero if an error occurred. |
| 6212 | * @return An array of ASCII encoded extension names, or `NULL` if an |
| 6213 | * [error](@ref error_handling) occurred. |
| 6214 | * |
| 6215 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 6216 | * GLFW_API_UNAVAILABLE. |
| 6217 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 6218 | * @remark Additional extensions may be required by future versions of GLFW. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6219 | * You should check if any extensions you wish to enable are already in the |
| 6220 | * returned array, as it is an error to specify an extension more than once in |
| 6221 | * the `VkInstanceCreateInfo` struct. |
| 6222 | * |
| 6223 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 6224 | * should not free it yourself. It is guaranteed to be valid only until the |
| 6225 | * library is terminated. |
| 6226 | * |
| 6227 | * @thread_safety This function may be called from any thread. |
| 6228 | * |
| 6229 | * @sa @ref vulkan_ext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6230 | * @sa @ref glfwCreateWindowSurface |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6231 | * |
| 6232 | * @since Added in version 3.2. |
| 6233 | * |
| 6234 | * @ingroup vulkan |
| 6235 | */ |
Camilla Berglund | 7ab7d8b | 2016-03-23 10:24:01 +0100 | [diff] [blame] | 6236 | GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count); |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6237 | |
| 6238 | #if defined(VK_VERSION_1_0) |
| 6239 | |
| 6240 | /*! @brief Returns the address of the specified Vulkan instance function. |
| 6241 | * |
| 6242 | * This function returns the address of the specified Vulkan core or extension |
| 6243 | * function for the specified instance. If instance is set to `NULL` it can |
| 6244 | * return any function exported from the Vulkan loader, including at least the |
| 6245 | * following functions: |
| 6246 | * |
| 6247 | * - `vkEnumerateInstanceExtensionProperties` |
| 6248 | * - `vkEnumerateInstanceLayerProperties` |
| 6249 | * - `vkCreateInstance` |
| 6250 | * - `vkGetInstanceProcAddr` |
| 6251 | * |
| 6252 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 6253 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6254 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6255 | * |
| 6256 | * This function is equivalent to calling `vkGetInstanceProcAddr` with |
| 6257 | * a platform-specific query of the Vulkan loader as a fallback. |
| 6258 | * |
| 6259 | * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve |
| 6260 | * functions related to instance creation. |
| 6261 | * @param[in] procname The ASCII encoded name of the function. |
| 6262 | * @return The address of the function, or `NULL` if an |
| 6263 | * [error](@ref error_handling) occurred. |
| 6264 | * |
| 6265 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 6266 | * GLFW_API_UNAVAILABLE. |
| 6267 | * |
| 6268 | * @pointer_lifetime The returned function pointer is valid until the library |
| 6269 | * is terminated. |
| 6270 | * |
| 6271 | * @thread_safety This function may be called from any thread. |
| 6272 | * |
| 6273 | * @sa @ref vulkan_proc |
| 6274 | * |
| 6275 | * @since Added in version 3.2. |
| 6276 | * |
| 6277 | * @ingroup vulkan |
| 6278 | */ |
| 6279 | GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); |
| 6280 | |
| 6281 | /*! @brief Returns whether the specified queue family can present images. |
| 6282 | * |
| 6283 | * This function returns whether the specified queue family of the specified |
| 6284 | * physical device supports presentation to the platform GLFW was built for. |
| 6285 | * |
| 6286 | * If Vulkan or the required window surface creation instance extensions are |
| 6287 | * not available on the machine, or if the specified instance was not created |
| 6288 | * with the required extensions, this function returns `GLFW_FALSE` and |
| 6289 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6290 | * to check whether Vulkan is at least minimally available and @ref |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6291 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 6292 | * required. |
| 6293 | * |
| 6294 | * @param[in] instance The instance that the physical device belongs to. |
| 6295 | * @param[in] device The physical device that the queue family belongs to. |
| 6296 | * @param[in] queuefamily The index of the queue family to query. |
| 6297 | * @return `GLFW_TRUE` if the queue family supports presentation, or |
| 6298 | * `GLFW_FALSE` otherwise. |
| 6299 | * |
| 6300 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 6301 | * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
| 6302 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 6303 | * @remark @macos This function currently always returns `GLFW_TRUE`, as the |
Camilla Löwy | 4c90e21 | 2020-12-10 00:28:09 +0100 | [diff] [blame] | 6304 | * `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] | 6305 | * a `vkGetPhysicalDevice*PresentationSupport` type function. |
| 6306 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6307 | * @thread_safety This function may be called from any thread. For |
| 6308 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 6309 | * |
| 6310 | * @sa @ref vulkan_present |
| 6311 | * |
| 6312 | * @since Added in version 3.2. |
| 6313 | * |
| 6314 | * @ingroup vulkan |
| 6315 | */ |
| 6316 | GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); |
| 6317 | |
| 6318 | /*! @brief Creates a Vulkan surface for the specified window. |
| 6319 | * |
| 6320 | * This function creates a Vulkan surface for the specified window. |
| 6321 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 6322 | * If the Vulkan loader or at least one minimally functional ICD were not found, |
| 6323 | * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref |
| 6324 | * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether |
| 6325 | * Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6326 | * |
| 6327 | * If the required window surface creation instance extensions are not |
| 6328 | * available or if the specified instance was not created with these extensions |
| 6329 | * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and |
| 6330 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref |
| 6331 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 6332 | * required. |
| 6333 | * |
Corentin Wallez | 8a8eefa | 2018-01-30 13:25:17 -0500 | [diff] [blame] | 6334 | * The window surface cannot be shared with another API so the window must |
| 6335 | * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib) |
| 6336 | * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error |
| 6337 | * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`. |
| 6338 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6339 | * The window surface must be destroyed before the specified Vulkan instance. |
| 6340 | * It is the responsibility of the caller to destroy the window surface. GLFW |
| 6341 | * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the |
| 6342 | * surface. |
| 6343 | * |
| 6344 | * @param[in] instance The Vulkan instance to create the surface in. |
| 6345 | * @param[in] window The window to create the surface for. |
| 6346 | * @param[in] allocator The allocator to use, or `NULL` to use the default |
| 6347 | * allocator. |
| 6348 | * @param[out] surface Where to store the handle of the surface. This is set |
| 6349 | * to `VK_NULL_HANDLE` if an error occurred. |
| 6350 | * @return `VK_SUCCESS` if successful, or a Vulkan error code if an |
| 6351 | * [error](@ref error_handling) occurred. |
| 6352 | * |
| 6353 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Corentin Wallez | 8a8eefa | 2018-01-30 13:25:17 -0500 | [diff] [blame] | 6354 | * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6355 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 6356 | * @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] | 6357 | * the Vulkan error code most appropriate for the error. Appropriate use of |
| 6358 | * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should |
Camilla Berglund | ee33dcd | 2016-03-07 14:42:51 +0100 | [diff] [blame] | 6359 | * eliminate almost all occurrences of these errors. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6360 | * |
Camilla Löwy | 05b0e2f | 2021-12-26 18:02:00 +0100 | [diff] [blame] | 6361 | * @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the |
| 6362 | * `VK_MVK_macos_surface` extension as a fallback. The name of the selected |
| 6363 | * extension, if any, is included in the array returned by @ref |
| 6364 | * glfwGetRequiredInstanceExtensions. |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 6365 | * |
| 6366 | * @remark @macos This function creates and sets a `CAMetalLayer` instance for |
| 6367 | * the window content view, which is required for MoltenVK to function. |
| 6368 | * |
Camilla Löwy | 05b0e2f | 2021-12-26 18:02:00 +0100 | [diff] [blame] | 6369 | * @remark @x11 By default GLFW prefers the `VK_KHR_xcb_surface` extension, |
| 6370 | * with the `VK_KHR_xlib_surface` extension as a fallback. You can make |
| 6371 | * `VK_KHR_xlib_surface` the preferred extension by setting the |
Camilla Löwy | a25e8eb | 2020-12-10 00:11:44 +0100 | [diff] [blame] | 6372 | * [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] | 6373 | * hint. The name of the selected extension, if any, is included in the array |
| 6374 | * returned by @ref glfwGetRequiredInstanceExtensions. |
Camilla Löwy | a25e8eb | 2020-12-10 00:11:44 +0100 | [diff] [blame] | 6375 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6376 | * @thread_safety This function may be called from any thread. For |
| 6377 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 6378 | * |
| 6379 | * @sa @ref vulkan_surface |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 6380 | * @sa @ref glfwGetRequiredInstanceExtensions |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 6381 | * |
| 6382 | * @since Added in version 3.2. |
| 6383 | * |
| 6384 | * @ingroup vulkan |
| 6385 | */ |
| 6386 | GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); |
| 6387 | |
| 6388 | #endif /*VK_VERSION_1_0*/ |
| 6389 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6390 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 6391 | /************************************************************************* |
| 6392 | * Global definition cleanup |
| 6393 | *************************************************************************/ |
| 6394 | |
| 6395 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 6396 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 6397 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 6398 | #undef WINGDIAPI |
| 6399 | #undef GLFW_WINGDIAPI_DEFINED |
| 6400 | #endif |
| 6401 | |
| 6402 | #ifdef GLFW_CALLBACK_DEFINED |
| 6403 | #undef CALLBACK |
| 6404 | #undef GLFW_CALLBACK_DEFINED |
| 6405 | #endif |
| 6406 | |
Camilla Löwy | be51c20 | 2017-07-03 14:25:47 +0200 | [diff] [blame] | 6407 | /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally |
| 6408 | * defined by some gl.h variants (OpenBSD) so define it after if needed. |
| 6409 | */ |
| 6410 | #ifndef GLAPIENTRY |
| 6411 | #define GLAPIENTRY APIENTRY |
Camilla Löwy | ce85c7d | 2022-05-03 19:54:08 +0200 | [diff] [blame] | 6412 | #define GLFW_GLAPIENTRY_DEFINED |
Camilla Löwy | be51c20 | 2017-07-03 14:25:47 +0200 | [diff] [blame] | 6413 | #endif |
| 6414 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 6415 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 6416 | |
| 6417 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6418 | #ifdef __cplusplus |
| 6419 | } |
| 6420 | #endif |
| 6421 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 6422 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 6423 | |