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 Berglund | 80c203f | 2016-02-19 10:29:13 +0100 | [diff] [blame] | 55 | /*! @defgroup vulkan Vulkan 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 Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 99 | /* It is customary to use APIENTRY for OpenGL function pointer declarations on |
| 100 | * all platforms. Additionally, the Windows OpenGL header needs APIENTRY. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 101 | */ |
| 102 | #ifndef APIENTRY |
| 103 | #ifdef _WIN32 |
| 104 | #define APIENTRY __stdcall |
| 105 | #else |
| 106 | #define APIENTRY |
| 107 | #endif |
Camilla Löwy | c23fca6 | 2017-08-21 14:37:38 +0200 | [diff] [blame] | 108 | #define GLFW_APIENTRY_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 109 | #endif /* APIENTRY */ |
| 110 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 111 | /* Some Windows OpenGL headers need this. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 112 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 113 | #if !defined(WINGDIAPI) && defined(_WIN32) |
Camilla Berglund | c535364 | 2015-02-22 18:14:30 +0100 | [diff] [blame] | 114 | #define WINGDIAPI __declspec(dllimport) |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 115 | #define GLFW_WINGDIAPI_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 116 | #endif /* WINGDIAPI */ |
| 117 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 118 | /* Some Windows GLU headers need this. |
| 119 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 120 | #if !defined(CALLBACK) && defined(_WIN32) |
Camilla Berglund | d586fe6 | 2015-02-22 18:17:34 +0100 | [diff] [blame] | 121 | #define CALLBACK __stdcall |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 122 | #define GLFW_CALLBACK_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 123 | #endif /* CALLBACK */ |
| 124 | |
Camilla Berglund | 70423af | 2016-07-21 00:15:07 +0200 | [diff] [blame] | 125 | /* Include because most Windows GLU headers need wchar_t and |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 126 | * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h. |
Camilla Berglund | 8221aad | 2016-03-06 09:40:16 +0100 | [diff] [blame] | 127 | * Include it unconditionally to avoid surprising side-effects. |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 128 | */ |
Camilla Berglund | 8221aad | 2016-03-06 09:40:16 +0100 | [diff] [blame] | 129 | #include <stddef.h> |
Camilla Berglund | 70423af | 2016-07-21 00:15:07 +0200 | [diff] [blame] | 130 | |
| 131 | /* Include because it is needed by Vulkan and related functions. |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 132 | * Include it unconditionally to avoid surprising side-effects. |
Camilla Berglund | 70423af | 2016-07-21 00:15:07 +0200 | [diff] [blame] | 133 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 134 | #include <stdint.h> |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 135 | |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 136 | /* Include the chosen OpenGL or OpenGL ES headers. |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 137 | */ |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 138 | #if defined(GLFW_INCLUDE_ES1) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 139 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 140 | #include <GLES/gl.h> |
| 141 | #if defined(GLFW_INCLUDE_GLEXT) |
| 142 | #include <GLES/glext.h> |
| 143 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 144 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 145 | #elif defined(GLFW_INCLUDE_ES2) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 146 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 147 | #include <GLES2/gl2.h> |
| 148 | #if defined(GLFW_INCLUDE_GLEXT) |
| 149 | #include <GLES2/gl2ext.h> |
| 150 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 151 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 152 | #elif defined(GLFW_INCLUDE_ES3) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 153 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 154 | #include <GLES3/gl3.h> |
| 155 | #if defined(GLFW_INCLUDE_GLEXT) |
| 156 | #include <GLES2/gl2ext.h> |
| 157 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 158 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 159 | #elif defined(GLFW_INCLUDE_ES31) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 160 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 161 | #include <GLES3/gl31.h> |
| 162 | #if defined(GLFW_INCLUDE_GLEXT) |
| 163 | #include <GLES2/gl2ext.h> |
| 164 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 165 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 166 | #elif defined(GLFW_INCLUDE_ES32) |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 167 | |
Konstantin Käfer | 244d6d7 | 2017-05-16 15:42:51 +0200 | [diff] [blame] | 168 | #include <GLES3/gl32.h> |
| 169 | #if defined(GLFW_INCLUDE_GLEXT) |
| 170 | #include <GLES2/gl2ext.h> |
| 171 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 172 | |
| 173 | #elif defined(GLFW_INCLUDE_GLCOREARB) |
| 174 | |
| 175 | #if defined(__APPLE__) |
| 176 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 177 | #include <OpenGL/gl3.h> |
| 178 | #if defined(GLFW_INCLUDE_GLEXT) |
| 179 | #include <OpenGL/gl3ext.h> |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 180 | #endif /*GLFW_INCLUDE_GLEXT*/ |
| 181 | |
| 182 | #else /*__APPLE__*/ |
| 183 | |
| 184 | #include <GL/glcorearb.h> |
| 185 | |
| 186 | #endif /*__APPLE__*/ |
| 187 | |
| 188 | #elif !defined(GLFW_INCLUDE_NONE) |
| 189 | |
| 190 | #if defined(__APPLE__) |
| 191 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 192 | #if !defined(GLFW_INCLUDE_GLEXT) |
| 193 | #define GL_GLEXT_LEGACY |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 194 | #endif |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 195 | #include <OpenGL/gl.h> |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 196 | #if defined(GLFW_INCLUDE_GLU) |
| 197 | #include <OpenGL/glu.h> |
| 198 | #endif |
| 199 | |
| 200 | #else /*__APPLE__*/ |
| 201 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 202 | #include <GL/gl.h> |
| 203 | #if defined(GLFW_INCLUDE_GLEXT) |
| 204 | #include <GL/glext.h> |
| 205 | #endif |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 206 | #if defined(GLFW_INCLUDE_GLU) |
| 207 | #include <GL/glu.h> |
| 208 | #endif |
| 209 | |
| 210 | #endif /*__APPLE__*/ |
| 211 | |
| 212 | #endif /* OpenGL and OpenGL ES headers */ |
| 213 | |
Camilla Berglund | 433db8f | 2016-09-14 21:13:33 +0200 | [diff] [blame] | 214 | #if defined(GLFW_INCLUDE_VULKAN) |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 215 | #include <vulkan/vulkan.h> |
Camilla Löwy | fa0b5e1 | 2017-05-16 14:54:17 +0200 | [diff] [blame] | 216 | #endif /* Vulkan header */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 217 | |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 218 | #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 219 | /* GLFW_DLL must be defined by applications that are linking against the DLL |
| 220 | * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW |
| 221 | * configuration header when compiling the DLL version of the library. |
Camilla Berglund | bd2d571 | 2013-07-23 01:59:27 +0200 | [diff] [blame] | 222 | */ |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 223 | #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] | 224 | #endif |
| 225 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 226 | /* GLFWAPI is used to declare public API functions for export |
| 227 | * from the DLL / shared library / dynamic library. |
| 228 | */ |
Camilla Berglund | 2588c9b | 2012-03-25 17:40:30 +0200 | [diff] [blame] | 229 | #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 230 | /* We are building GLFW as a Win32 DLL */ |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 231 | #define GLFWAPI __declspec(dllexport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 232 | #elif defined(_WIN32) && defined(GLFW_DLL) |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 233 | /* We are calling GLFW as a Win32 DLL */ |
Camilla Berglund | 1247fc0 | 2015-02-22 18:10:20 +0100 | [diff] [blame] | 234 | #define GLFWAPI __declspec(dllimport) |
John Bartholomew | 93f4eff | 2013-05-01 13:08:09 +0100 | [diff] [blame] | 235 | #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 236 | /* We are building GLFW as a shared / dynamic library */ |
John Bartholomew | 93f4eff | 2013-05-01 13:08:09 +0100 | [diff] [blame] | 237 | #define GLFWAPI __attribute__((visibility("default"))) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 238 | #else |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 239 | /* We are building or calling GLFW as a static library */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 240 | #define GLFWAPI |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 241 | #endif |
| 242 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 243 | |
| 244 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 245 | * GLFW API tokens |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 246 | *************************************************************************/ |
| 247 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 248 | /*! @name GLFW version macros |
| 249 | * @{ */ |
| 250 | /*! @brief The major version number of the GLFW library. |
| 251 | * |
| 252 | * This is incremented when the API is changed in non-compatible ways. |
| 253 | * @ingroup init |
| 254 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 255 | #define GLFW_VERSION_MAJOR 3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 256 | /*! @brief The minor version number of the GLFW library. |
| 257 | * |
| 258 | * This is incremented when features are added to the API but it remains |
| 259 | * backward-compatible. |
| 260 | * @ingroup init |
| 261 | */ |
Camilla Löwy | a337c56 | 2019-04-16 14:43:29 +0200 | [diff] [blame] | 262 | #define GLFW_VERSION_MINOR 4 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 263 | /*! @brief The revision number of the GLFW library. |
| 264 | * |
| 265 | * This is incremented when a bug fix release is made that does not contain any |
| 266 | * API changes. |
| 267 | * @ingroup init |
| 268 | */ |
Camilla Berglund | 53fafad | 2016-08-18 23:42:15 +0200 | [diff] [blame] | 269 | #define GLFW_VERSION_REVISION 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 270 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 271 | |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 272 | /*! @brief One. |
| 273 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 274 | * 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] | 275 | * `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal |
| 276 | * to one. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 277 | * |
| 278 | * @ingroup init |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 279 | */ |
| 280 | #define GLFW_TRUE 1 |
| 281 | /*! @brief Zero. |
| 282 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 283 | * 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] | 284 | * `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is |
| 285 | * equal to zero. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 286 | * |
| 287 | * @ingroup init |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 288 | */ |
| 289 | #define GLFW_FALSE 0 |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 290 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 291 | /*! @name Key and button actions |
| 292 | * @{ */ |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 293 | /*! @brief The key or mouse button was released. |
| 294 | * |
| 295 | * The key or mouse button was released. |
| 296 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 297 | * @ingroup input |
| 298 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 299 | #define GLFW_RELEASE 0 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 300 | /*! @brief The key or mouse button was pressed. |
| 301 | * |
| 302 | * The key or mouse button was pressed. |
| 303 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 304 | * @ingroup input |
| 305 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 306 | #define GLFW_PRESS 1 |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 307 | /*! @brief The key was held down until it repeated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 308 | * |
| 309 | * The key was held down until it repeated. |
| 310 | * |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 311 | * @ingroup input |
| 312 | */ |
| 313 | #define GLFW_REPEAT 2 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 314 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 315 | |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 316 | /*! @defgroup hat_state Joystick hat states |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 317 | * @brief Joystick hat states. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 318 | * |
| 319 | * See [joystick hat input](@ref joystick_hat) for how these are used. |
| 320 | * |
| 321 | * @ingroup input |
| 322 | * @{ */ |
| 323 | #define GLFW_HAT_CENTERED 0 |
| 324 | #define GLFW_HAT_UP 1 |
| 325 | #define GLFW_HAT_RIGHT 2 |
| 326 | #define GLFW_HAT_DOWN 4 |
| 327 | #define GLFW_HAT_LEFT 8 |
| 328 | #define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP) |
| 329 | #define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN) |
| 330 | #define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP) |
| 331 | #define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN) |
| 332 | /*! @} */ |
| 333 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 334 | /*! @defgroup keys Keyboard keys |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 335 | * @brief Keyboard key IDs. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 336 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 337 | * See [key input](@ref input_key) for how these are used. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 338 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 339 | * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), |
| 340 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
| 341 | * put in the 256+ range). |
| 342 | * |
| 343 | * The naming of the key codes follow these rules: |
| 344 | * - The US keyboard layout is used |
| 345 | * - Names of printable alpha-numeric characters are used (e.g. "A", "R", |
| 346 | * "3", etc.) |
| 347 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
| 348 | * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not |
| 349 | * correspond to the Unicode standard (usually for brevity) |
| 350 | * - Keys that lack a clear US mapping are named "WORLD_x" |
| 351 | * - For non-printable keys, custom names are used (e.g. "F4", |
| 352 | * "BACKSPACE", etc.) |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 353 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 354 | * @ingroup input |
| 355 | * @{ |
| 356 | */ |
| 357 | |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 358 | /* The unknown key */ |
| 359 | #define GLFW_KEY_UNKNOWN -1 |
| 360 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 361 | /* Printable keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 362 | #define GLFW_KEY_SPACE 32 |
| 363 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
| 364 | #define GLFW_KEY_COMMA 44 /* , */ |
| 365 | #define GLFW_KEY_MINUS 45 /* - */ |
| 366 | #define GLFW_KEY_PERIOD 46 /* . */ |
| 367 | #define GLFW_KEY_SLASH 47 /* / */ |
| 368 | #define GLFW_KEY_0 48 |
| 369 | #define GLFW_KEY_1 49 |
| 370 | #define GLFW_KEY_2 50 |
| 371 | #define GLFW_KEY_3 51 |
| 372 | #define GLFW_KEY_4 52 |
| 373 | #define GLFW_KEY_5 53 |
| 374 | #define GLFW_KEY_6 54 |
| 375 | #define GLFW_KEY_7 55 |
| 376 | #define GLFW_KEY_8 56 |
| 377 | #define GLFW_KEY_9 57 |
| 378 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
| 379 | #define GLFW_KEY_EQUAL 61 /* = */ |
| 380 | #define GLFW_KEY_A 65 |
| 381 | #define GLFW_KEY_B 66 |
| 382 | #define GLFW_KEY_C 67 |
| 383 | #define GLFW_KEY_D 68 |
| 384 | #define GLFW_KEY_E 69 |
| 385 | #define GLFW_KEY_F 70 |
| 386 | #define GLFW_KEY_G 71 |
| 387 | #define GLFW_KEY_H 72 |
| 388 | #define GLFW_KEY_I 73 |
| 389 | #define GLFW_KEY_J 74 |
| 390 | #define GLFW_KEY_K 75 |
| 391 | #define GLFW_KEY_L 76 |
| 392 | #define GLFW_KEY_M 77 |
| 393 | #define GLFW_KEY_N 78 |
| 394 | #define GLFW_KEY_O 79 |
| 395 | #define GLFW_KEY_P 80 |
| 396 | #define GLFW_KEY_Q 81 |
| 397 | #define GLFW_KEY_R 82 |
| 398 | #define GLFW_KEY_S 83 |
| 399 | #define GLFW_KEY_T 84 |
| 400 | #define GLFW_KEY_U 85 |
| 401 | #define GLFW_KEY_V 86 |
| 402 | #define GLFW_KEY_W 87 |
| 403 | #define GLFW_KEY_X 88 |
| 404 | #define GLFW_KEY_Y 89 |
| 405 | #define GLFW_KEY_Z 90 |
| 406 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
| 407 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
| 408 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
| 409 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
| 410 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
| 411 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 412 | |
| 413 | /* Function keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 414 | #define GLFW_KEY_ESCAPE 256 |
| 415 | #define GLFW_KEY_ENTER 257 |
| 416 | #define GLFW_KEY_TAB 258 |
| 417 | #define GLFW_KEY_BACKSPACE 259 |
| 418 | #define GLFW_KEY_INSERT 260 |
| 419 | #define GLFW_KEY_DELETE 261 |
| 420 | #define GLFW_KEY_RIGHT 262 |
| 421 | #define GLFW_KEY_LEFT 263 |
| 422 | #define GLFW_KEY_DOWN 264 |
| 423 | #define GLFW_KEY_UP 265 |
| 424 | #define GLFW_KEY_PAGE_UP 266 |
| 425 | #define GLFW_KEY_PAGE_DOWN 267 |
| 426 | #define GLFW_KEY_HOME 268 |
| 427 | #define GLFW_KEY_END 269 |
| 428 | #define GLFW_KEY_CAPS_LOCK 280 |
| 429 | #define GLFW_KEY_SCROLL_LOCK 281 |
| 430 | #define GLFW_KEY_NUM_LOCK 282 |
| 431 | #define GLFW_KEY_PRINT_SCREEN 283 |
| 432 | #define GLFW_KEY_PAUSE 284 |
| 433 | #define GLFW_KEY_F1 290 |
| 434 | #define GLFW_KEY_F2 291 |
| 435 | #define GLFW_KEY_F3 292 |
| 436 | #define GLFW_KEY_F4 293 |
| 437 | #define GLFW_KEY_F5 294 |
| 438 | #define GLFW_KEY_F6 295 |
| 439 | #define GLFW_KEY_F7 296 |
| 440 | #define GLFW_KEY_F8 297 |
| 441 | #define GLFW_KEY_F9 298 |
| 442 | #define GLFW_KEY_F10 299 |
| 443 | #define GLFW_KEY_F11 300 |
| 444 | #define GLFW_KEY_F12 301 |
| 445 | #define GLFW_KEY_F13 302 |
| 446 | #define GLFW_KEY_F14 303 |
| 447 | #define GLFW_KEY_F15 304 |
| 448 | #define GLFW_KEY_F16 305 |
| 449 | #define GLFW_KEY_F17 306 |
| 450 | #define GLFW_KEY_F18 307 |
| 451 | #define GLFW_KEY_F19 308 |
| 452 | #define GLFW_KEY_F20 309 |
| 453 | #define GLFW_KEY_F21 310 |
| 454 | #define GLFW_KEY_F22 311 |
| 455 | #define GLFW_KEY_F23 312 |
| 456 | #define GLFW_KEY_F24 313 |
| 457 | #define GLFW_KEY_F25 314 |
| 458 | #define GLFW_KEY_KP_0 320 |
| 459 | #define GLFW_KEY_KP_1 321 |
| 460 | #define GLFW_KEY_KP_2 322 |
| 461 | #define GLFW_KEY_KP_3 323 |
| 462 | #define GLFW_KEY_KP_4 324 |
| 463 | #define GLFW_KEY_KP_5 325 |
| 464 | #define GLFW_KEY_KP_6 326 |
| 465 | #define GLFW_KEY_KP_7 327 |
| 466 | #define GLFW_KEY_KP_8 328 |
| 467 | #define GLFW_KEY_KP_9 329 |
| 468 | #define GLFW_KEY_KP_DECIMAL 330 |
| 469 | #define GLFW_KEY_KP_DIVIDE 331 |
| 470 | #define GLFW_KEY_KP_MULTIPLY 332 |
| 471 | #define GLFW_KEY_KP_SUBTRACT 333 |
| 472 | #define GLFW_KEY_KP_ADD 334 |
| 473 | #define GLFW_KEY_KP_ENTER 335 |
| 474 | #define GLFW_KEY_KP_EQUAL 336 |
| 475 | #define GLFW_KEY_LEFT_SHIFT 340 |
| 476 | #define GLFW_KEY_LEFT_CONTROL 341 |
| 477 | #define GLFW_KEY_LEFT_ALT 342 |
| 478 | #define GLFW_KEY_LEFT_SUPER 343 |
| 479 | #define GLFW_KEY_RIGHT_SHIFT 344 |
| 480 | #define GLFW_KEY_RIGHT_CONTROL 345 |
| 481 | #define GLFW_KEY_RIGHT_ALT 346 |
| 482 | #define GLFW_KEY_RIGHT_SUPER 347 |
| 483 | #define GLFW_KEY_MENU 348 |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 484 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 485 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 486 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 487 | /*! @} */ |
| 488 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 489 | /*! @defgroup mods Modifier key flags |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 490 | * @brief Modifier key flags. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 491 | * |
| 492 | * See [key input](@ref input_key) for how these are used. |
| 493 | * |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 494 | * @ingroup input |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 495 | * @{ */ |
| 496 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 497 | /*! @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] | 498 | * |
| 499 | * 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] | 500 | */ |
| 501 | #define GLFW_MOD_SHIFT 0x0001 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 502 | /*! @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] | 503 | * |
| 504 | * 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] | 505 | */ |
Camilla Berglund | 3bcffba | 2013-05-23 14:11:05 +0200 | [diff] [blame] | 506 | #define GLFW_MOD_CONTROL 0x0002 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 507 | /*! @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] | 508 | * |
| 509 | * 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] | 510 | */ |
| 511 | #define GLFW_MOD_ALT 0x0004 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 512 | /*! @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] | 513 | * |
| 514 | * 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] | 515 | */ |
| 516 | #define GLFW_MOD_SUPER 0x0008 |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 517 | /*! @brief If this bit is set the Caps Lock key is enabled. |
| 518 | * |
| 519 | * If this bit is set the Caps Lock key is enabled and the @ref |
| 520 | * GLFW_LOCK_KEY_MODS input mode is set. |
| 521 | */ |
| 522 | #define GLFW_MOD_CAPS_LOCK 0x0010 |
| 523 | /*! @brief If this bit is set the Num Lock key is enabled. |
| 524 | * |
| 525 | * If this bit is set the Num Lock key is enabled and the @ref |
| 526 | * GLFW_LOCK_KEY_MODS input mode is set. |
| 527 | */ |
| 528 | #define GLFW_MOD_NUM_LOCK 0x0020 |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 529 | |
| 530 | /*! @} */ |
| 531 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 532 | /*! @defgroup buttons Mouse buttons |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 533 | * @brief Mouse button IDs. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 534 | * |
| 535 | * See [mouse button input](@ref input_mouse_button) for how these are used. |
| 536 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 537 | * @ingroup input |
| 538 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 539 | #define GLFW_MOUSE_BUTTON_1 0 |
| 540 | #define GLFW_MOUSE_BUTTON_2 1 |
| 541 | #define GLFW_MOUSE_BUTTON_3 2 |
| 542 | #define GLFW_MOUSE_BUTTON_4 3 |
| 543 | #define GLFW_MOUSE_BUTTON_5 4 |
| 544 | #define GLFW_MOUSE_BUTTON_6 5 |
| 545 | #define GLFW_MOUSE_BUTTON_7 6 |
| 546 | #define GLFW_MOUSE_BUTTON_8 7 |
| 547 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
| 548 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
| 549 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
| 550 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 551 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 552 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 553 | /*! @defgroup joysticks Joysticks |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 554 | * @brief Joystick IDs. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 555 | * |
| 556 | * See [joystick input](@ref joystick) for how these are used. |
| 557 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 558 | * @ingroup input |
| 559 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 560 | #define GLFW_JOYSTICK_1 0 |
| 561 | #define GLFW_JOYSTICK_2 1 |
| 562 | #define GLFW_JOYSTICK_3 2 |
| 563 | #define GLFW_JOYSTICK_4 3 |
| 564 | #define GLFW_JOYSTICK_5 4 |
| 565 | #define GLFW_JOYSTICK_6 5 |
| 566 | #define GLFW_JOYSTICK_7 6 |
| 567 | #define GLFW_JOYSTICK_8 7 |
| 568 | #define GLFW_JOYSTICK_9 8 |
| 569 | #define GLFW_JOYSTICK_10 9 |
| 570 | #define GLFW_JOYSTICK_11 10 |
| 571 | #define GLFW_JOYSTICK_12 11 |
| 572 | #define GLFW_JOYSTICK_13 12 |
| 573 | #define GLFW_JOYSTICK_14 13 |
| 574 | #define GLFW_JOYSTICK_15 14 |
| 575 | #define GLFW_JOYSTICK_16 15 |
| 576 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 577 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 578 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 579 | /*! @defgroup gamepad_buttons Gamepad buttons |
| 580 | * @brief Gamepad buttons. |
| 581 | * |
| 582 | * See @ref gamepad for how these are used. |
| 583 | * |
| 584 | * @ingroup input |
| 585 | * @{ */ |
| 586 | #define GLFW_GAMEPAD_BUTTON_A 0 |
| 587 | #define GLFW_GAMEPAD_BUTTON_B 1 |
| 588 | #define GLFW_GAMEPAD_BUTTON_X 2 |
| 589 | #define GLFW_GAMEPAD_BUTTON_Y 3 |
| 590 | #define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4 |
| 591 | #define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5 |
| 592 | #define GLFW_GAMEPAD_BUTTON_BACK 6 |
| 593 | #define GLFW_GAMEPAD_BUTTON_START 7 |
| 594 | #define GLFW_GAMEPAD_BUTTON_GUIDE 8 |
| 595 | #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9 |
| 596 | #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10 |
| 597 | #define GLFW_GAMEPAD_BUTTON_DPAD_UP 11 |
| 598 | #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12 |
| 599 | #define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13 |
| 600 | #define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14 |
| 601 | #define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT |
| 602 | |
| 603 | #define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A |
| 604 | #define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B |
| 605 | #define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X |
| 606 | #define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y |
| 607 | /*! @} */ |
| 608 | |
| 609 | /*! @defgroup gamepad_axes Gamepad axes |
| 610 | * @brief Gamepad axes. |
| 611 | * |
| 612 | * See @ref gamepad for how these are used. |
| 613 | * |
| 614 | * @ingroup input |
| 615 | * @{ */ |
| 616 | #define GLFW_GAMEPAD_AXIS_LEFT_X 0 |
| 617 | #define GLFW_GAMEPAD_AXIS_LEFT_Y 1 |
| 618 | #define GLFW_GAMEPAD_AXIS_RIGHT_X 2 |
| 619 | #define GLFW_GAMEPAD_AXIS_RIGHT_Y 3 |
| 620 | #define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4 |
| 621 | #define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5 |
| 622 | #define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER |
| 623 | /*! @} */ |
| 624 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 625 | /*! @defgroup errors Error codes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 626 | * @brief Error codes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 627 | * |
| 628 | * See [error handling](@ref error_handling) for how these are used. |
| 629 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 630 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 631 | * @{ */ |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 632 | /*! @brief No error has occurred. |
| 633 | * |
| 634 | * No error has occurred. |
| 635 | * |
| 636 | * @analysis Yay. |
| 637 | */ |
| 638 | #define GLFW_NO_ERROR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 639 | /*! @brief GLFW has not been initialized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 640 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 641 | * 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] | 642 | * library is [initialized](@ref intro_init). |
| 643 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 644 | * @analysis Application programmer error. Initialize GLFW before calling any |
| 645 | * function that requires initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 646 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 647 | #define GLFW_NOT_INITIALIZED 0x00010001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 648 | /*! @brief No context is current for this thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 649 | * |
| 650 | * This occurs if a GLFW function was called that needs and operates on the |
| 651 | * current OpenGL or OpenGL ES context but no context is current on the calling |
| 652 | * thread. One such function is @ref glfwSwapInterval. |
| 653 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 654 | * @analysis Application programmer error. Ensure a context is current before |
| 655 | * calling functions that require a current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 656 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 657 | #define GLFW_NO_CURRENT_CONTEXT 0x00010002 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 658 | /*! @brief One of the arguments to the function was an invalid enum value. |
| 659 | * |
| 660 | * 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] | 661 | * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 662 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 663 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 664 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 665 | #define GLFW_INVALID_ENUM 0x00010003 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 666 | /*! @brief One of the arguments to the function was an invalid value. |
| 667 | * |
| 668 | * One of the arguments to the function was an invalid value, for example |
| 669 | * requesting a non-existent OpenGL or OpenGL ES version like 2.7. |
| 670 | * |
| 671 | * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead |
| 672 | * result in a @ref GLFW_VERSION_UNAVAILABLE error. |
| 673 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 674 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 675 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 676 | #define GLFW_INVALID_VALUE 0x00010004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 677 | /*! @brief A memory allocation failed. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 678 | * |
| 679 | * A memory allocation failed. |
| 680 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 681 | * @analysis A bug in GLFW or the underlying operating system. Report the bug |
| 682 | * to our [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 683 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 684 | #define GLFW_OUT_OF_MEMORY 0x00010005 |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 685 | /*! @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] | 686 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 687 | * GLFW could not find support for the requested API on the system. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 688 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 689 | * @analysis The installed graphics driver does not support the requested |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 690 | * API, or does not support it via the chosen context creation backend. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 691 | * Below are a few examples. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 692 | * |
| 693 | * @par |
| 694 | * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only |
Camilla Berglund | d95b79f | 2015-03-30 23:20:49 +0200 | [diff] [blame] | 695 | * 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] | 696 | * 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] | 697 | * 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] | 698 | * driver. Older graphics drivers do not support Vulkan. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 699 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 700 | #define GLFW_API_UNAVAILABLE 0x00010006 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 701 | /*! @brief The requested OpenGL or OpenGL ES version is not available. |
| 702 | * |
Camilla Berglund | d493a82 | 2015-03-10 19:51:14 +0100 | [diff] [blame] | 703 | * The requested OpenGL or OpenGL ES version (including any requested context |
| 704 | * or framebuffer hints) is not available on this machine. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 705 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 706 | * @analysis The machine does not support your requirements. If your |
| 707 | * application is sufficiently flexible, downgrade your requirements and try |
| 708 | * again. Otherwise, inform the user that their machine does not match your |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 709 | * requirements. |
| 710 | * |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 711 | * @par |
| 712 | * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 |
| 713 | * comes out before the 4.x series gets that far, also fail with this error and |
| 714 | * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions |
| 715 | * will exist. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 716 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 717 | #define GLFW_VERSION_UNAVAILABLE 0x00010007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 718 | /*! @brief A platform-specific error occurred that does not match any of the |
| 719 | * more specific categories. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 720 | * |
| 721 | * A platform-specific error occurred that does not match any of the more |
| 722 | * specific categories. |
| 723 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 724 | * @analysis A bug or configuration error in GLFW, the underlying operating |
| 725 | * system or its drivers, or a lack of required resources. Report the issue to |
| 726 | * our [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 727 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 728 | #define GLFW_PLATFORM_ERROR 0x00010008 |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 729 | /*! @brief The requested format is not supported or available. |
| 730 | * |
| 731 | * If emitted during window creation, the requested pixel format is not |
| 732 | * supported. |
| 733 | * |
| 734 | * If emitted when querying the clipboard, the contents of the clipboard could |
| 735 | * not be converted to the requested format. |
| 736 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 737 | * @analysis If emitted during window creation, one or more |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 738 | * [hard constraints](@ref window_hints_hard) did not match any of the |
| 739 | * available pixel formats. If your application is sufficiently flexible, |
| 740 | * downgrade your requirements and try again. Otherwise, inform the user that |
| 741 | * their machine does not match your requirements. |
| 742 | * |
| 743 | * @par |
| 744 | * If emitted when querying the clipboard, ignore the error or report it to |
| 745 | * the user, as appropriate. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 746 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 747 | #define GLFW_FORMAT_UNAVAILABLE 0x00010009 |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 748 | /*! @brief The specified window does not have an OpenGL or OpenGL ES context. |
| 749 | * |
| 750 | * A window that does not have an OpenGL or OpenGL ES context was passed to |
| 751 | * a function that requires it to have one. |
| 752 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 753 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 754 | */ |
| 755 | #define GLFW_NO_WINDOW_CONTEXT 0x0001000A |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 756 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 757 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 758 | /*! @addtogroup window |
| 759 | * @{ */ |
| 760 | /*! @brief Input focus window hint and attribute |
| 761 | * |
| 762 | * Input focus [window hint](@ref GLFW_FOCUSED_hint) or |
| 763 | * [window attribute](@ref GLFW_FOCUSED_attrib). |
| 764 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 765 | #define GLFW_FOCUSED 0x00020001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 766 | /*! @brief Window iconification window attribute |
| 767 | * |
| 768 | * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib). |
| 769 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 770 | #define GLFW_ICONIFIED 0x00020002 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 771 | /*! @brief Window resize-ability window hint and attribute |
| 772 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 773 | * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 774 | * [window attribute](@ref GLFW_RESIZABLE_attrib). |
| 775 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 776 | #define GLFW_RESIZABLE 0x00020003 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 777 | /*! @brief Window visibility window hint and attribute |
| 778 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 779 | * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 780 | * [window attribute](@ref GLFW_VISIBLE_attrib). |
| 781 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 782 | #define GLFW_VISIBLE 0x00020004 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 783 | /*! @brief Window decoration window hint and attribute |
| 784 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 785 | * Window decoration [window hint](@ref GLFW_DECORATED_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 786 | * [window attribute](@ref GLFW_DECORATED_attrib). |
| 787 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 788 | #define GLFW_DECORATED 0x00020005 |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 789 | /*! @brief Window auto-iconification window hint and attribute |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 790 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 791 | * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 792 | * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib). |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 793 | */ |
Camilla Berglund | 25e7ff1 | 2014-04-08 15:32:34 +0200 | [diff] [blame] | 794 | #define GLFW_AUTO_ICONIFY 0x00020006 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 795 | /*! @brief Window decoration window hint and attribute |
| 796 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 797 | * Window decoration [window hint](@ref GLFW_FLOATING_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 798 | * [window attribute](@ref GLFW_FLOATING_attrib). |
| 799 | */ |
Camilla Berglund | 3ce7bfe | 2014-05-23 14:01:02 +0200 | [diff] [blame] | 800 | #define GLFW_FLOATING 0x00020007 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 801 | /*! @brief Window maximization window hint and attribute |
| 802 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 803 | * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 804 | * [window attribute](@ref GLFW_MAXIMIZED_attrib). |
| 805 | */ |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 806 | #define GLFW_MAXIMIZED 0x00020008 |
Camilla Löwy | 5a74b50 | 2017-02-06 15:03:50 +0100 | [diff] [blame] | 807 | /*! @brief Cursor centering window hint |
| 808 | * |
| 809 | * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint). |
| 810 | */ |
Liam Middlebrook | 72ac5ba | 2016-08-18 11:47:54 -0400 | [diff] [blame] | 811 | #define GLFW_CENTER_CURSOR 0x00020009 |
Camilla Löwy | 32e78ae | 2017-09-18 18:10:57 +0200 | [diff] [blame] | 812 | /*! @brief Window framebuffer transparency hint and attribute |
| 813 | * |
Camilla Löwy | 49130ab | 2017-11-07 22:50:01 +0100 | [diff] [blame] | 814 | * Window framebuffer transparency |
| 815 | * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and |
| 816 | * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib). |
Camilla Löwy | 32e78ae | 2017-09-18 18:10:57 +0200 | [diff] [blame] | 817 | */ |
Camilla Löwy | 49130ab | 2017-11-07 22:50:01 +0100 | [diff] [blame] | 818 | #define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A |
Camilla Löwy | d6b3a60 | 2018-01-11 14:13:54 +0100 | [diff] [blame] | 819 | /*! @brief Mouse cursor hover window attribute. |
| 820 | * |
| 821 | * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib). |
| 822 | */ |
Camilla Löwy | ee9dffc | 2018-01-04 13:50:58 +0100 | [diff] [blame] | 823 | #define GLFW_HOVERED 0x0002000B |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 824 | /*! @brief Input focus on calling show window hint and attribute |
| 825 | * |
| 826 | * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or |
| 827 | * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). |
| 828 | */ |
| 829 | #define GLFW_FOCUS_ON_SHOW 0x0002000C |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 830 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 831 | /*! @brief Framebuffer bit depth hint. |
| 832 | * |
| 833 | * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). |
| 834 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 835 | #define GLFW_RED_BITS 0x00021001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 836 | /*! @brief Framebuffer bit depth hint. |
| 837 | * |
| 838 | * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS). |
| 839 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 840 | #define GLFW_GREEN_BITS 0x00021002 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 841 | /*! @brief Framebuffer bit depth hint. |
| 842 | * |
| 843 | * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS). |
| 844 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 845 | #define GLFW_BLUE_BITS 0x00021003 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 846 | /*! @brief Framebuffer bit depth hint. |
| 847 | * |
| 848 | * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS). |
| 849 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 850 | #define GLFW_ALPHA_BITS 0x00021004 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 851 | /*! @brief Framebuffer bit depth hint. |
| 852 | * |
| 853 | * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS). |
| 854 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 855 | #define GLFW_DEPTH_BITS 0x00021005 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 856 | /*! @brief Framebuffer bit depth hint. |
| 857 | * |
| 858 | * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS). |
| 859 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 860 | #define GLFW_STENCIL_BITS 0x00021006 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 861 | /*! @brief Framebuffer bit depth hint. |
| 862 | * |
| 863 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS). |
| 864 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 865 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 866 | /*! @brief Framebuffer bit depth hint. |
| 867 | * |
| 868 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS). |
| 869 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 870 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 871 | /*! @brief Framebuffer bit depth hint. |
| 872 | * |
| 873 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS). |
| 874 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 875 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 876 | /*! @brief Framebuffer bit depth hint. |
| 877 | * |
| 878 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS). |
| 879 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 880 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 881 | /*! @brief Framebuffer auxiliary buffer hint. |
| 882 | * |
| 883 | * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS). |
| 884 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 885 | #define GLFW_AUX_BUFFERS 0x0002100B |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 886 | /*! @brief OpenGL stereoscopic rendering hint. |
| 887 | * |
| 888 | * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO). |
| 889 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 890 | #define GLFW_STEREO 0x0002100C |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 891 | /*! @brief Framebuffer MSAA samples hint. |
| 892 | * |
| 893 | * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES). |
| 894 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 895 | #define GLFW_SAMPLES 0x0002100D |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 896 | /*! @brief Framebuffer sRGB hint. |
| 897 | * |
| 898 | * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE). |
| 899 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 900 | #define GLFW_SRGB_CAPABLE 0x0002100E |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 901 | /*! @brief Monitor refresh rate hint. |
| 902 | * |
| 903 | * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE). |
| 904 | */ |
Camilla Berglund | 2cd3438 | 2013-05-30 20:42:50 +0200 | [diff] [blame] | 905 | #define GLFW_REFRESH_RATE 0x0002100F |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 906 | /*! @brief Framebuffer double buffering hint. |
| 907 | * |
| 908 | * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER). |
| 909 | */ |
Camilla Berglund | c980858 | 2014-04-24 19:21:10 +0200 | [diff] [blame] | 910 | #define GLFW_DOUBLEBUFFER 0x00021010 |
Bailey Cosier | 93e6666 | 2017-09-19 18:27:45 +0200 | [diff] [blame] | 911 | |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 912 | /*! @brief Context client API hint and attribute. |
| 913 | * |
| 914 | * Context client API [hint](@ref GLFW_CLIENT_API_hint) and |
| 915 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 916 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 917 | #define GLFW_CLIENT_API 0x00022001 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 918 | /*! @brief Context client API major version hint and attribute. |
| 919 | * |
| 920 | * Context client API major version [hint](@ref GLFW_CLIENT_API_hint) and |
| 921 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 922 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 923 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 924 | /*! @brief Context client API minor version hint and attribute. |
| 925 | * |
| 926 | * Context client API minor version [hint](@ref GLFW_CLIENT_API_hint) and |
| 927 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 928 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 929 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 930 | /*! @brief Context client API revision number hint and attribute. |
| 931 | * |
| 932 | * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and |
| 933 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 934 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 935 | #define GLFW_CONTEXT_REVISION 0x00022004 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 936 | /*! @brief Context robustness hint and attribute. |
| 937 | * |
| 938 | * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and |
| 939 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 940 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 941 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 942 | /*! @brief OpenGL forward-compatibility hint and attribute. |
| 943 | * |
| 944 | * OpenGL forward-compatibility [hint](@ref GLFW_CLIENT_API_hint) and |
| 945 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 946 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 947 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 948 | /*! @brief OpenGL debug context hint and attribute. |
| 949 | * |
| 950 | * OpenGL debug context [hint](@ref GLFW_CLIENT_API_hint) and |
| 951 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 952 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 953 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 954 | /*! @brief OpenGL profile hint and attribute. |
| 955 | * |
| 956 | * OpenGL profile [hint](@ref GLFW_CLIENT_API_hint) and |
| 957 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 958 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 959 | #define GLFW_OPENGL_PROFILE 0x00022008 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 960 | /*! @brief Context flush-on-release hint and attribute. |
| 961 | * |
| 962 | * Context flush-on-release [hint](@ref GLFW_CLIENT_API_hint) and |
| 963 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 964 | */ |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 965 | #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 966 | /*! @brief Context error suppression hint and attribute. |
| 967 | * |
| 968 | * Context error suppression [hint](@ref GLFW_CLIENT_API_hint) and |
| 969 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 970 | */ |
Camilla Berglund | 7be8209 | 2015-08-10 12:46:14 +0200 | [diff] [blame] | 971 | #define GLFW_CONTEXT_NO_ERROR 0x0002200A |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 972 | /*! @brief Context creation API hint and attribute. |
| 973 | * |
| 974 | * Context creation API [hint](@ref GLFW_CLIENT_API_hint) and |
| 975 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 976 | */ |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 977 | #define GLFW_CONTEXT_CREATION_API 0x0002200B |
Camilla Löwy | 089ea9a | 2018-08-31 13:33:48 +0200 | [diff] [blame] | 978 | /*! @brief Window content area scaling window |
| 979 | * [window hint](@ref GLFW_SCALE_TO_MONITOR). |
| 980 | */ |
| 981 | #define GLFW_SCALE_TO_MONITOR 0x0002200C |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 982 | /*! @brief macOS specific |
| 983 | * [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint). |
| 984 | */ |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 985 | #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 986 | /*! @brief macOS specific |
| 987 | * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint). |
| 988 | */ |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 989 | #define GLFW_COCOA_FRAME_NAME 0x00023002 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 990 | /*! @brief macOS specific |
| 991 | * [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint). |
| 992 | */ |
Camilla Löwy | 77a8f10 | 2017-01-27 12:02:09 +0100 | [diff] [blame] | 993 | #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 994 | /*! @brief X11 specific |
| 995 | * [window hint](@ref GLFW_X11_CLASS_NAME_hint). |
| 996 | */ |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 997 | #define GLFW_X11_CLASS_NAME 0x00024001 |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 998 | /*! @brief X11 specific |
| 999 | * [window hint](@ref GLFW_X11_CLASS_NAME_hint). |
| 1000 | */ |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 1001 | #define GLFW_X11_INSTANCE_NAME 0x00024002 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 1002 | /*! @} */ |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 1003 | |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 1004 | #define GLFW_NO_API 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1005 | #define GLFW_OPENGL_API 0x00030001 |
| 1006 | #define GLFW_OPENGL_ES_API 0x00030002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1007 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1008 | #define GLFW_NO_ROBUSTNESS 0 |
| 1009 | #define GLFW_NO_RESET_NOTIFICATION 0x00031001 |
| 1010 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1011 | |
Camilla Berglund | 44e8401 | 2013-06-05 16:13:30 +0200 | [diff] [blame] | 1012 | #define GLFW_OPENGL_ANY_PROFILE 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1013 | #define GLFW_OPENGL_CORE_PROFILE 0x00032001 |
| 1014 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1015 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1016 | #define GLFW_CURSOR 0x00033001 |
| 1017 | #define GLFW_STICKY_KEYS 0x00033002 |
| 1018 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 1019 | #define GLFW_LOCK_KEY_MODS 0x00033004 |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 1020 | #define GLFW_RAW_MOUSE_MOTION 0x00033005 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1021 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1022 | #define GLFW_CURSOR_NORMAL 0x00034001 |
| 1023 | #define GLFW_CURSOR_HIDDEN 0x00034002 |
| 1024 | #define GLFW_CURSOR_DISABLED 0x00034003 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1025 | |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 1026 | #define GLFW_ANY_RELEASE_BEHAVIOR 0 |
| 1027 | #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 |
| 1028 | #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 |
| 1029 | |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1030 | #define GLFW_NATIVE_CONTEXT_API 0x00036001 |
| 1031 | #define GLFW_EGL_CONTEXT_API 0x00036002 |
Camilla Löwy | e9560ef | 2017-02-28 19:23:25 +0100 | [diff] [blame] | 1032 | #define GLFW_OSMESA_CONTEXT_API 0x00036003 |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1033 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1034 | /*! @defgroup shapes Standard cursor shapes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 1035 | * @brief Standard system cursor shapes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1036 | * |
| 1037 | * See [standard cursor creation](@ref cursor_standard) for how these are used. |
| 1038 | * |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1039 | * @ingroup input |
| 1040 | * @{ */ |
| 1041 | |
| 1042 | /*! @brief The regular arrow cursor shape. |
| 1043 | * |
| 1044 | * The regular arrow cursor. |
| 1045 | */ |
| 1046 | #define GLFW_ARROW_CURSOR 0x00036001 |
| 1047 | /*! @brief The text input I-beam cursor shape. |
| 1048 | * |
| 1049 | * The text input I-beam cursor shape. |
| 1050 | */ |
| 1051 | #define GLFW_IBEAM_CURSOR 0x00036002 |
| 1052 | /*! @brief The crosshair shape. |
| 1053 | * |
| 1054 | * The crosshair shape. |
| 1055 | */ |
| 1056 | #define GLFW_CROSSHAIR_CURSOR 0x00036003 |
| 1057 | /*! @brief The hand shape. |
| 1058 | * |
| 1059 | * The hand shape. |
| 1060 | */ |
| 1061 | #define GLFW_HAND_CURSOR 0x00036004 |
| 1062 | /*! @brief The horizontal resize arrow shape. |
| 1063 | * |
| 1064 | * The horizontal resize arrow shape. |
| 1065 | */ |
| 1066 | #define GLFW_HRESIZE_CURSOR 0x00036005 |
| 1067 | /*! @brief The vertical resize arrow shape. |
| 1068 | * |
| 1069 | * The vertical resize arrow shape. |
| 1070 | */ |
| 1071 | #define GLFW_VRESIZE_CURSOR 0x00036006 |
| 1072 | /*! @} */ |
| 1073 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1074 | #define GLFW_CONNECTED 0x00040001 |
| 1075 | #define GLFW_DISCONNECTED 0x00040002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1076 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1077 | /*! @addtogroup init |
| 1078 | * @{ */ |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1079 | /*! @brief Joystick hat buttons init hint. |
| 1080 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1081 | * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1082 | */ |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 1083 | #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001 |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1084 | /*! @brief macOS specific init hint. |
| 1085 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1086 | * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1087 | */ |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1088 | #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001 |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1089 | /*! @brief macOS specific init hint. |
| 1090 | * |
Camilla Löwy | 422bf79 | 2019-04-01 18:36:30 +0200 | [diff] [blame] | 1091 | * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint). |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1092 | */ |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1093 | #define GLFW_COCOA_MENUBAR 0x00051002 |
| 1094 | /*! @} */ |
| 1095 | |
Camilla Berglund | 2810130 | 2014-04-08 18:57:43 +0200 | [diff] [blame] | 1096 | #define GLFW_DONT_CARE -1 |
| 1097 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 1098 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1099 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1100 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1101 | *************************************************************************/ |
| 1102 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1103 | /*! @brief Client API function pointer type. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1104 | * |
| 1105 | * Generic function pointer used for returning client API function pointers |
| 1106 | * without forcing a cast from a regular pointer. |
| 1107 | * |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1108 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1109 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1110 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1111 | * @since Added in version 3.0. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 1112 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1113 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1114 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 1115 | typedef void (*GLFWglproc)(void); |
| 1116 | |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1117 | /*! @brief Vulkan API function pointer type. |
| 1118 | * |
| 1119 | * Generic function pointer used for returning Vulkan API function pointers |
| 1120 | * without forcing a cast from a regular pointer. |
| 1121 | * |
| 1122 | * @sa @ref vulkan_proc |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1123 | * @sa @ref glfwGetInstanceProcAddress |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1124 | * |
| 1125 | * @since Added in version 3.2. |
| 1126 | * |
| 1127 | * @ingroup vulkan |
| 1128 | */ |
| 1129 | typedef void (*GLFWvkproc)(void); |
| 1130 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1131 | /*! @brief Opaque monitor object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1132 | * |
| 1133 | * Opaque monitor object. |
| 1134 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1135 | * @see @ref monitor_object |
| 1136 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1137 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1138 | * |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1139 | * @ingroup monitor |
| 1140 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1141 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 1142 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1143 | /*! @brief Opaque window object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1144 | * |
| 1145 | * Opaque window object. |
| 1146 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1147 | * @see @ref window_object |
| 1148 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1149 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1150 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1151 | * @ingroup window |
| 1152 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1153 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1154 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1155 | /*! @brief Opaque cursor object. |
| 1156 | * |
| 1157 | * Opaque cursor object. |
| 1158 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1159 | * @see @ref cursor_object |
| 1160 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1161 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1162 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1163 | * @ingroup input |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1164 | */ |
| 1165 | typedef struct GLFWcursor GLFWcursor; |
| 1166 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1167 | /*! @brief The function signature for error callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1168 | * |
| 1169 | * This is the function signature for error callback functions. |
| 1170 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1171 | * @param[in] error An [error code](@ref errors). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1172 | * @param[in] description A UTF-8 encoded string describing the error. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1173 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1174 | * @sa @ref error_handling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1175 | * @sa @ref glfwSetErrorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1176 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1177 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1178 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1179 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1180 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 1181 | typedef void (* GLFWerrorfun)(int,const char*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1182 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1183 | /*! @brief The function signature for window position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1184 | * |
| 1185 | * This is the function signature for window position callback functions. |
| 1186 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1187 | * @param[in] window The window that was moved. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1188 | * @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] | 1189 | * upper-left corner of the content area of the window. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1190 | * @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] | 1191 | * upper-left corner of the content area of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1192 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1193 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1194 | * @sa @ref glfwSetWindowPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1195 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1196 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1197 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1198 | * @ingroup window |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1199 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1200 | typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1201 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1202 | /*! @brief The function signature for window resize callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1203 | * |
| 1204 | * This is the function signature for window size callback functions. |
| 1205 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1206 | * @param[in] window The window that was resized. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1207 | * @param[in] width The new width, in screen coordinates, of the window. |
| 1208 | * @param[in] height The new height, in screen coordinates, of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1209 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1210 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1211 | * @sa @ref glfwSetWindowSizeCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1212 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1213 | * @since Added in version 1.0. |
| 1214 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1215 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1216 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1217 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1218 | typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1219 | |
| 1220 | /*! @brief The function signature for window close callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1221 | * |
| 1222 | * This is the function signature for window close callback functions. |
| 1223 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1224 | * @param[in] window The window that the user attempted to close. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1225 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1226 | * @sa @ref window_close |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1227 | * @sa @ref glfwSetWindowCloseCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1228 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1229 | * @since Added in version 2.5. |
| 1230 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1231 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1232 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1233 | */ |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1234 | typedef void (* GLFWwindowclosefun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1235 | |
| 1236 | /*! @brief The function signature for window content refresh callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1237 | * |
| 1238 | * This is the function signature for window refresh callback functions. |
| 1239 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1240 | * @param[in] window The window whose content needs to be refreshed. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1241 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1242 | * @sa @ref window_refresh |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1243 | * @sa @ref glfwSetWindowRefreshCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1244 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1245 | * @since Added in version 2.5. |
| 1246 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1247 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1248 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1249 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1250 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1251 | |
| 1252 | /*! @brief The function signature for window focus/defocus callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1253 | * |
| 1254 | * This is the function signature for window focus callback functions. |
| 1255 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1256 | * @param[in] window The window that gained or lost input focus. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1257 | * @param[in] focused `GLFW_TRUE` if the window was given input focus, or |
| 1258 | * `GLFW_FALSE` if it lost it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1259 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1260 | * @sa @ref window_focus |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1261 | * @sa @ref glfwSetWindowFocusCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1262 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1263 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1264 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1265 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1266 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1267 | typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1268 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 1269 | /*! @brief The function signature for window iconify/restore callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1270 | * |
| 1271 | * This is the function signature for window iconify/restore callback |
| 1272 | * functions. |
| 1273 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1274 | * @param[in] window The window that was iconified or restored. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1275 | * @param[in] iconified `GLFW_TRUE` if the window was iconified, or |
| 1276 | * `GLFW_FALSE` if it was restored. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1277 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1278 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1279 | * @sa @ref glfwSetWindowIconifyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1280 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1281 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1282 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1283 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1284 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1285 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1286 | |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1287 | /*! @brief The function signature for window maximize/restore callbacks. |
| 1288 | * |
| 1289 | * This is the function signature for window maximize/restore callback |
| 1290 | * functions. |
| 1291 | * |
| 1292 | * @param[in] window The window that was maximized or restored. |
| 1293 | * @param[in] iconified `GLFW_TRUE` if the window was maximized, or |
| 1294 | * `GLFW_FALSE` if it was restored. |
| 1295 | * |
| 1296 | * @sa @ref window_maximize |
| 1297 | * @sa glfwSetWindowMaximizeCallback |
| 1298 | * |
| 1299 | * @since Added in version 3.3. |
| 1300 | * |
| 1301 | * @ingroup window |
| 1302 | */ |
| 1303 | typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int); |
| 1304 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1305 | /*! @brief The function signature for framebuffer resize callbacks. |
| 1306 | * |
| 1307 | * This is the function signature for framebuffer resize callback |
| 1308 | * functions. |
| 1309 | * |
| 1310 | * @param[in] window The window whose framebuffer was resized. |
| 1311 | * @param[in] width The new width, in pixels, of the framebuffer. |
| 1312 | * @param[in] height The new height, in pixels, of the framebuffer. |
| 1313 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1314 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1315 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1316 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1317 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1318 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1319 | * @ingroup window |
| 1320 | */ |
| 1321 | typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); |
| 1322 | |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1323 | /*! @brief The function signature for window content scale callbacks. |
| 1324 | * |
| 1325 | * This is the function signature for window content scale callback |
| 1326 | * functions. |
| 1327 | * |
| 1328 | * @param[in] window The window whose content scale changed. |
| 1329 | * @param[in] xscale The new x-axis content scale of the window. |
| 1330 | * @param[in] yscale The new y-axis content scale of the window. |
| 1331 | * |
| 1332 | * @sa @ref window_scale |
| 1333 | * @sa @ref glfwSetWindowContentScaleCallback |
| 1334 | * |
| 1335 | * @since Added in version 3.3. |
| 1336 | * |
| 1337 | * @ingroup window |
| 1338 | */ |
| 1339 | typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float); |
| 1340 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1341 | /*! @brief The function signature for mouse button callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1342 | * |
| 1343 | * This is the function signature for mouse button callback functions. |
| 1344 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1345 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1346 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
| 1347 | * released. |
| 1348 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1349 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1350 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1351 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1352 | * @sa @ref input_mouse_button |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1353 | * @sa @ref glfwSetMouseButtonCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1354 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1355 | * @since Added in version 1.0. |
| 1356 | * @glfw3 Added window handle and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1357 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1358 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1359 | */ |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 1360 | typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1361 | |
| 1362 | /*! @brief The function signature for cursor position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1363 | * |
| 1364 | * This is the function signature for cursor position callback functions. |
| 1365 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1366 | * @param[in] window The window that received the event. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1367 | * @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] | 1368 | * the content area. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1369 | * @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] | 1370 | * content area. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1371 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1372 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1373 | * @sa @ref glfwSetCursorPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1374 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1375 | * @since Added in version 3.0. Replaces `GLFWmouseposfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1376 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1377 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1378 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 1379 | typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1380 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1381 | /*! @brief The function signature for cursor enter/leave callbacks. |
| 1382 | * |
| 1383 | * This is the function signature for cursor enter/leave callback functions. |
| 1384 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1385 | * @param[in] window The window that received the event. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 1386 | * @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] | 1387 | * area, or `GLFW_FALSE` if it left it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1388 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1389 | * @sa @ref cursor_enter |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1390 | * @sa @ref glfwSetCursorEnterCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1391 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1392 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1393 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1394 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1395 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1396 | typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1397 | |
| 1398 | /*! @brief The function signature for scroll callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1399 | * |
| 1400 | * This is the function signature for scroll callback functions. |
| 1401 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1402 | * @param[in] window The window that received the event. |
mewmew | cf2d260 | 2013-06-06 19:49:23 +0200 | [diff] [blame] | 1403 | * @param[in] xoffset The scroll offset along the x-axis. |
| 1404 | * @param[in] yoffset The scroll offset along the y-axis. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1405 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1406 | * @sa @ref scrolling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1407 | * @sa @ref glfwSetScrollCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1408 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1409 | * @since Added in version 3.0. Replaces `GLFWmousewheelfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1410 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1411 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1412 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1413 | typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1414 | |
| 1415 | /*! @brief The function signature for keyboard key callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1416 | * |
| 1417 | * This is the function signature for keyboard key callback functions. |
| 1418 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1419 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1420 | * @param[in] key The [keyboard key](@ref keys) that was pressed or released. |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 1421 | * @param[in] scancode The system-specific scancode of the key. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1422 | * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1423 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1424 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1425 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1426 | * @sa @ref input_key |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1427 | * @sa @ref glfwSetKeyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1428 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1429 | * @since Added in version 1.0. |
| 1430 | * @glfw3 Added window handle, scancode and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1431 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1432 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1433 | */ |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 1434 | typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1435 | |
| 1436 | /*! @brief The function signature for Unicode character callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1437 | * |
| 1438 | * This is the function signature for Unicode character callback functions. |
| 1439 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1440 | * @param[in] window The window that received the event. |
Camilla Berglund | 2c920fb | 2013-10-10 19:41:56 +0200 | [diff] [blame] | 1441 | * @param[in] codepoint The Unicode code point of the character. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1442 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1443 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1444 | * @sa @ref glfwSetCharCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1445 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1446 | * @since Added in version 2.4. |
| 1447 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1448 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1449 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1450 | */ |
Camilla Berglund | 182e0af | 2013-02-25 17:02:28 +0100 | [diff] [blame] | 1451 | typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1452 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1453 | /*! @brief The function signature for Unicode character with modifiers |
| 1454 | * callbacks. |
| 1455 | * |
| 1456 | * This is the function signature for Unicode character with modifiers callback |
| 1457 | * functions. It is called for each input character, regardless of what |
| 1458 | * modifier keys are held down. |
| 1459 | * |
| 1460 | * @param[in] window The window that received the event. |
| 1461 | * @param[in] codepoint The Unicode code point of the character. |
| 1462 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1463 | * held down. |
| 1464 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1465 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1466 | * @sa @ref glfwSetCharModsCallback |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1467 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 1468 | * @deprecated Scheduled for removal in version 4.0. |
| 1469 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1470 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1471 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1472 | * @ingroup input |
| 1473 | */ |
| 1474 | typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); |
| 1475 | |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1476 | /*! @brief The function signature for file drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1477 | * |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1478 | * This is the function signature for file drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1479 | * |
| 1480 | * @param[in] window The window that received the event. |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1481 | * @param[in] count The number of dropped files. |
Camilla Berglund | 93855ae | 2015-01-27 23:04:22 +0100 | [diff] [blame] | 1482 | * @param[in] paths The UTF-8 encoded file and/or directory path names. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1483 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1484 | * @sa @ref path_drop |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1485 | * @sa @ref glfwSetDropCallback |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1486 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1487 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1488 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1489 | * @ingroup input |
| 1490 | */ |
Camilla Berglund | 8f349e8 | 2013-12-22 19:28:46 +0100 | [diff] [blame] | 1491 | typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**); |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1492 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1493 | /*! @brief The function signature for monitor configuration callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1494 | * |
| 1495 | * This is the function signature for monitor configuration callback functions. |
| 1496 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1497 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Löwy | b020467 | 2018-02-06 13:10:08 +0100 | [diff] [blame] | 1498 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Remaining |
| 1499 | * values reserved for future use. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1500 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1501 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1502 | * @sa @ref glfwSetMonitorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1503 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1504 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1505 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1506 | * @ingroup monitor |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1507 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1508 | typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 1509 | |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1510 | /*! @brief The function signature for joystick configuration callbacks. |
| 1511 | * |
| 1512 | * This is the function signature for joystick configuration callback |
| 1513 | * functions. |
| 1514 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 1515 | * @param[in] jid The joystick that was connected or disconnected. |
Camilla Löwy | b020467 | 2018-02-06 13:10:08 +0100 | [diff] [blame] | 1516 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Remaining |
| 1517 | * values reserved for future use. |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1518 | * |
| 1519 | * @sa @ref joystick_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1520 | * @sa @ref glfwSetJoystickCallback |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1521 | * |
| 1522 | * @since Added in version 3.2. |
| 1523 | * |
| 1524 | * @ingroup input |
| 1525 | */ |
| 1526 | typedef void (* GLFWjoystickfun)(int,int); |
| 1527 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1528 | /*! @brief Video mode type. |
| 1529 | * |
| 1530 | * This describes a single video mode. |
| 1531 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1532 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1533 | * @sa @ref glfwGetVideoMode |
| 1534 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1535 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1536 | * @since Added in version 1.0. |
| 1537 | * @glfw3 Added refresh rate member. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1538 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1539 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1540 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1541 | typedef struct GLFWvidmode |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1542 | { |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1543 | /*! The width, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1544 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1545 | int width; |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1546 | /*! The height, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1547 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1548 | int height; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1549 | /*! The bit depth of the red channel of the video mode. |
| 1550 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1551 | int redBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1552 | /*! The bit depth of the green channel of the video mode. |
| 1553 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1554 | int greenBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1555 | /*! The bit depth of the blue channel of the video mode. |
| 1556 | */ |
Camilla Berglund | 2e8446f | 2013-04-11 01:31:00 +0200 | [diff] [blame] | 1557 | int blueBits; |
Camilla Berglund | 731812c | 2013-05-30 15:52:42 +0200 | [diff] [blame] | 1558 | /*! The refresh rate, in Hz, of the video mode. |
| 1559 | */ |
| 1560 | int refreshRate; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1561 | } GLFWvidmode; |
| 1562 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1563 | /*! @brief Gamma ramp. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1564 | * |
| 1565 | * This describes the gamma ramp for a monitor. |
| 1566 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1567 | * @sa @ref monitor_gamma |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1568 | * @sa @ref glfwGetGammaRamp |
| 1569 | * @sa @ref glfwSetGammaRamp |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1570 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1571 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1572 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1573 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1574 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1575 | typedef struct GLFWgammaramp |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1576 | { |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1577 | /*! An array of value describing the response of the red channel. |
| 1578 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1579 | unsigned short* red; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1580 | /*! An array of value describing the response of the green channel. |
| 1581 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1582 | unsigned short* green; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1583 | /*! An array of value describing the response of the blue channel. |
| 1584 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1585 | unsigned short* blue; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1586 | /*! The number of elements in each array. |
| 1587 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1588 | unsigned int size; |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1589 | } GLFWgammaramp; |
| 1590 | |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 1591 | /*! @brief Image data. |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1592 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 1593 | * This describes a single 2D image. See the documentation for each related |
| 1594 | * function what the expected pixel format is. |
| 1595 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1596 | * @sa @ref cursor_custom |
Camilla Berglund | fe0317a | 2016-08-01 11:51:30 +0200 | [diff] [blame] | 1597 | * @sa @ref window_icon |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1598 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1599 | * @since Added in version 2.1. |
| 1600 | * @glfw3 Removed format and bytes-per-pixel members. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1601 | * |
| 1602 | * @ingroup window |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 1603 | */ |
| 1604 | typedef struct GLFWimage |
| 1605 | { |
| 1606 | /*! The width, in pixels, of this image. |
| 1607 | */ |
| 1608 | int width; |
| 1609 | /*! The height, in pixels, of this image. |
| 1610 | */ |
| 1611 | int height; |
| 1612 | /*! The pixel data of this image, arranged left-to-right, top-to-bottom. |
| 1613 | */ |
| 1614 | unsigned char* pixels; |
| 1615 | } GLFWimage; |
| 1616 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 1617 | /*! @brief Gamepad input state |
| 1618 | * |
| 1619 | * This describes the input state of a gamepad. |
| 1620 | * |
| 1621 | * @sa @ref gamepad |
| 1622 | * @sa @ref glfwGetGamepadState |
| 1623 | * |
| 1624 | * @since Added in version 3.3. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1625 | * |
| 1626 | * @ingroup input |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 1627 | */ |
| 1628 | typedef struct GLFWgamepadstate |
| 1629 | { |
| 1630 | /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS` |
| 1631 | * or `GLFW_RELEASE`. |
| 1632 | */ |
Camilla Löwy | 2d8d8f5 | 2017-07-17 21:18:15 +0200 | [diff] [blame] | 1633 | unsigned char buttons[15]; |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 1634 | /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0 |
| 1635 | * to 1.0 inclusive. |
| 1636 | */ |
| 1637 | float axes[6]; |
| 1638 | } GLFWgamepadstate; |
| 1639 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1640 | |
| 1641 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1642 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1643 | *************************************************************************/ |
| 1644 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1645 | /*! @brief Initializes the GLFW library. |
| 1646 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1647 | * This function initializes the GLFW library. Before most GLFW functions can |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1648 | * be used, GLFW must be initialized, and before an application terminates GLFW |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1649 | * should be terminated in order to free any resources allocated during or |
| 1650 | * after initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1651 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1652 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1653 | * succeeds, you should call @ref glfwTerminate before the application exits. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1654 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1655 | * Additional calls to this function after successful initialization but before |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1656 | * termination will return `GLFW_TRUE` immediately. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1657 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1658 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1659 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1660 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1661 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
| 1662 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 1663 | * @remark @macos This function will change the current directory of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1664 | * application to the `Contents/Resources` subdirectory of the application's |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1665 | * bundle, if present. This can be disabled with the @ref |
| 1666 | * GLFW_COCOA_CHDIR_RESOURCES init hint. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1667 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1668 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1669 | * |
| 1670 | * @sa @ref intro_init |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1671 | * @sa @ref glfwTerminate |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1672 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1673 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1674 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1675 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1676 | */ |
| 1677 | GLFWAPI int glfwInit(void); |
| 1678 | |
| 1679 | /*! @brief Terminates the GLFW library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1680 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1681 | * This function destroys all remaining windows and cursors, restores any |
| 1682 | * modified gamma ramps and frees any other allocated resources. Once this |
| 1683 | * function is called, you must again call @ref glfwInit successfully before |
| 1684 | * you will be able to use most GLFW functions. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1685 | * |
| 1686 | * If GLFW has been successfully initialized, this function should be called |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1687 | * before the application exits. If initialization fails, there is no need to |
| 1688 | * call this function, as it is called by @ref glfwInit before it returns |
| 1689 | * failure. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1690 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1691 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
| 1692 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1693 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1694 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 1695 | * @warning The contexts of any remaining windows must not be current on any |
| 1696 | * other thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1697 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1698 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 1699 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1700 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1701 | * |
| 1702 | * @sa @ref intro_init |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1703 | * @sa @ref glfwInit |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1704 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1705 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1706 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1707 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1708 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1709 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1710 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1711 | /*! @brief Sets the specified init hint to the desired value. |
| 1712 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 1713 | * This function sets hints for the next initialization of GLFW. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1714 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 1715 | * The values you set hints to are never reset by GLFW, but they only take |
| 1716 | * effect during initialization. Once GLFW has been initialized, any values |
| 1717 | * you set will be ignored until the library is terminated and initialized |
| 1718 | * again. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1719 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 1720 | * 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] | 1721 | * will only affect their specific platform. Other platforms will ignore them. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 1722 | * Setting these hints requires no platform specific headers or functions. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1723 | * |
| 1724 | * @param[in] hint The [init hint](@ref init_hints) to set. |
| 1725 | * @param[in] value The new value of the init hint. |
| 1726 | * |
| 1727 | * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref |
| 1728 | * GLFW_INVALID_VALUE. |
| 1729 | * |
| 1730 | * @remarks This function may be called before @ref glfwInit. |
| 1731 | * |
| 1732 | * @thread_safety This function must only be called from the main thread. |
| 1733 | * |
| 1734 | * @sa init_hints |
| 1735 | * @sa glfwInit |
| 1736 | * |
| 1737 | * @since Added in version 3.3. |
| 1738 | * |
| 1739 | * @ingroup init |
| 1740 | */ |
| 1741 | GLFWAPI void glfwInitHint(int hint, int value); |
| 1742 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1743 | /*! @brief Retrieves the version of the GLFW library. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1744 | * |
| 1745 | * This function retrieves the major, minor and revision numbers of the GLFW |
| 1746 | * library. It is intended for when you are using GLFW as a shared library and |
| 1747 | * want to ensure that you are using the minimum required version. |
| 1748 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1749 | * Any or all of the version arguments may be `NULL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1750 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1751 | * @param[out] major Where to store the major version number, or `NULL`. |
| 1752 | * @param[out] minor Where to store the minor version number, or `NULL`. |
| 1753 | * @param[out] rev Where to store the revision number, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1754 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1755 | * @errors None. |
| 1756 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1757 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1758 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1759 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1760 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1761 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1762 | * @sa @ref glfwGetVersionString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1763 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1764 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1765 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1766 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1767 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1768 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1769 | |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 1770 | /*! @brief Returns a string describing the compile-time configuration. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1771 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1772 | * This function returns the compile-time generated |
| 1773 | * [version string](@ref intro_version_string) of the GLFW library binary. It |
| 1774 | * describes the version, platform, compiler and any platform-specific |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 1775 | * compile-time options. It should not be confused with the OpenGL or OpenGL |
| 1776 | * ES version string, queried with `glGetString`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1777 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1778 | * __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] | 1779 | * @ref glfwGetVersion function provides the version of the running library |
| 1780 | * binary in numerical format. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1781 | * |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 1782 | * @return The ASCII encoded GLFW version string. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1783 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1784 | * @errors None. |
| 1785 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1786 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1787 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1788 | * @pointer_lifetime The returned string is static and compile-time generated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1789 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1790 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1791 | * |
| 1792 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1793 | * @sa @ref glfwGetVersion |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1794 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1795 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1796 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1797 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1798 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 1799 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1800 | |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1801 | /*! @brief Returns and clears the last error for the calling thread. |
| 1802 | * |
Camilla Löwy | 2e9aff7 | 2017-07-09 14:46:39 +0200 | [diff] [blame] | 1803 | * 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] | 1804 | * error that occurred on the calling thread, and optionally a UTF-8 encoded |
| 1805 | * 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] | 1806 | * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is |
| 1807 | * set to `NULL`. |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1808 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1809 | * @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] | 1810 | * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR |
| 1811 | * (zero). |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1812 | * |
| 1813 | * @errors None. |
| 1814 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1815 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 1816 | * should not free it yourself. It is guaranteed to be valid only until the |
| 1817 | * next error occurs or the library is terminated. |
| 1818 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1819 | * @remark This function may be called before @ref glfwInit. |
| 1820 | * |
| 1821 | * @thread_safety This function may be called from any thread. |
| 1822 | * |
| 1823 | * @sa @ref error_handling |
| 1824 | * @sa @ref glfwSetErrorCallback |
| 1825 | * |
| 1826 | * @since Added in version 3.3. |
| 1827 | * |
| 1828 | * @ingroup init |
| 1829 | */ |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1830 | GLFWAPI int glfwGetError(const char** description); |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1831 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1832 | /*! @brief Sets the error callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1833 | * |
| 1834 | * This function sets the error callback, which is called with an error code |
| 1835 | * and a human-readable description each time a GLFW error occurs. |
| 1836 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1837 | * The error code is set before the callback is called. Calling @ref |
| 1838 | * glfwGetError from the error callback will return the same value as the error |
| 1839 | * code argument. |
| 1840 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1841 | * The error callback is called on the thread where the error occurred. If you |
| 1842 | * are using GLFW from multiple threads, your error callback needs to be |
| 1843 | * written accordingly. |
| 1844 | * |
| 1845 | * Because the description string may have been generated specifically for that |
| 1846 | * error, it is not guaranteed to be valid after the callback has returned. If |
| 1847 | * you wish to use it after the callback returns, you need to make a copy. |
| 1848 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 1849 | * Once set, the error callback remains set even after the library has been |
| 1850 | * terminated. |
| 1851 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1852 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1853 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1854 | * @return The previously set callback, or `NULL` if no callback was set. |
| 1855 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1856 | * @errors None. |
| 1857 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1858 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1859 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1860 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1861 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1862 | * @sa @ref error_handling |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1863 | * @sa @ref glfwGetError |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1864 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1865 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1866 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1867 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1868 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1869 | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 1870 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1871 | /*! @brief Returns the currently connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1872 | * |
| 1873 | * This function returns an array of handles for all currently connected |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1874 | * monitors. The primary monitor is always first in the returned array. If no |
| 1875 | * monitors were found, this function returns `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1876 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1877 | * @param[out] count Where to store the number of monitors in the returned |
| 1878 | * array. This is set to zero if an error occurred. |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1879 | * @return An array of monitor handles, or `NULL` if no monitors were found or |
| 1880 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1881 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1882 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 1883 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1884 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 1885 | * should not free it yourself. It is guaranteed to be valid only until the |
| 1886 | * monitor configuration changes or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1887 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1888 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1889 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1890 | * @sa @ref monitor_monitors |
| 1891 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1892 | * @sa @ref glfwGetPrimaryMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1893 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1894 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1895 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1896 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1897 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1898 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1899 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1900 | /*! @brief Returns the primary monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1901 | * |
| 1902 | * This function returns the primary monitor. This is usually the monitor |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1903 | * where elements like the task bar or global menu bar are located. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1904 | * |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1905 | * @return The primary monitor, or `NULL` if no monitors were found or if an |
| 1906 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1907 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1908 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 1909 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1910 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1911 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1912 | * @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] | 1913 | * glfwGetMonitors. |
| 1914 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1915 | * @sa @ref monitor_monitors |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1916 | * @sa @ref glfwGetMonitors |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1917 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1918 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1919 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1920 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1921 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1922 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1923 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1924 | /*! @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] | 1925 | * |
| 1926 | * This function returns the position, in screen coordinates, of the upper-left |
| 1927 | * corner of the specified monitor. |
| 1928 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1929 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 1930 | * non-`NULL` position arguments will be set to zero. |
| 1931 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1932 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1933 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 1934 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1935 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1936 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 1937 | * GLFW_PLATFORM_ERROR. |
| 1938 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1939 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1940 | * |
| 1941 | * @sa @ref monitor_properties |
| 1942 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1943 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1944 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1945 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1946 | */ |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1947 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
| 1948 | |
Camilla Löwy | a43d1a4 | 2019-02-25 14:46:48 +0100 | [diff] [blame] | 1949 | /*! @brief Retrives the work area of the monitor. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 1950 | * |
| 1951 | * 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] | 1952 | * corner of the work area of the specified monitor along with the work area |
| 1953 | * size in screen coordinates. The work area is defined as the area of the |
| 1954 | * monitor not occluded by the operating system task bar where present. If no |
| 1955 | * task bar exists then the work area is the monitor resolution in screen |
| 1956 | * coordinates. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 1957 | * |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame] | 1958 | * Any or all of the position and size arguments may be `NULL`. If an error |
| 1959 | * 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] | 1960 | * |
| 1961 | * @param[in] monitor The monitor to query. |
| 1962 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 1963 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Doug Binks | 3fd70cc | 2018-09-08 17:16:07 +0200 | [diff] [blame] | 1964 | * @param[out] width Where to store the monitor width, or `NULL`. |
| 1965 | * @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] | 1966 | * |
| 1967 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 1968 | * GLFW_PLATFORM_ERROR. |
| 1969 | * |
| 1970 | * @thread_safety This function must only be called from the main thread. |
| 1971 | * |
Camilla Löwy | a43d1a4 | 2019-02-25 14:46:48 +0100 | [diff] [blame] | 1972 | * @sa @ref monitor_workarea |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 1973 | * |
Doug Binks | 6907629 | 2018-09-08 17:24:20 +0200 | [diff] [blame] | 1974 | * @since Added in version 3.3. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 1975 | * |
| 1976 | * @ingroup monitor |
| 1977 | */ |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame] | 1978 | 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] | 1979 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1980 | /*! @brief Returns the physical size of the monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1981 | * |
| 1982 | * This function returns the size, in millimetres, of the display area of the |
| 1983 | * specified monitor. |
| 1984 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1985 | * Some systems do not provide accurate monitor size information, either |
| 1986 | * because the monitor |
| 1987 | * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) |
| 1988 | * data is incorrect or because the driver does not report it accurately. |
| 1989 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1990 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 1991 | * non-`NULL` size arguments will be set to zero. |
| 1992 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1993 | * @param[in] monitor The monitor to query. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1994 | * @param[out] widthMM Where to store the width, in millimetres, of the |
| 1995 | * monitor's display area, or `NULL`. |
| 1996 | * @param[out] heightMM Where to store the height, in millimetres, of the |
| 1997 | * monitor's display area, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1998 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1999 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2000 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2001 | * @remark @win32 calculates the returned physical size from the |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2002 | * current resolution and system DPI instead of querying the monitor EDID data. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2003 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2004 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2005 | * |
| 2006 | * @sa @ref monitor_properties |
| 2007 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2008 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2009 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 2010 | * @ingroup monitor |
| 2011 | */ |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2012 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2013 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2014 | /*! @brief Retrieves the content scale for the specified monitor. |
| 2015 | * |
| 2016 | * This function retrieves the content scale for the specified monitor. The |
| 2017 | * 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] | 2018 | * default DPI. This is especially important for text and any UI elements. If |
| 2019 | * the pixel dimensions of your UI scaled by this look appropriate on your |
| 2020 | * machine then it should appear at a reasonable size on other machines |
| 2021 | * regardless of their DPI and scaling settings. This relies on the system DPI |
| 2022 | * and scaling settings being somewhat correct. |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2023 | * |
| 2024 | * The content scale may depend on both the monitor resolution and pixel |
| 2025 | * density and on user settings. It may be very different from the raw DPI |
| 2026 | * calculated from the physical size and current resolution. |
| 2027 | * |
| 2028 | * @param[in] monitor The monitor to query. |
| 2029 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 2030 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 2031 | * |
| 2032 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2033 | * GLFW_PLATFORM_ERROR. |
| 2034 | * |
| 2035 | * @thread_safety This function must only be called from the main thread. |
| 2036 | * |
| 2037 | * @sa @ref monitor_scale |
| 2038 | * @sa @ref glfwGetWindowContentScale |
| 2039 | * |
| 2040 | * @since Added in version 3.3. |
| 2041 | * |
| 2042 | * @ingroup monitor |
| 2043 | */ |
| 2044 | GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); |
| 2045 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2046 | /*! @brief Returns the name of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2047 | * |
| 2048 | * 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] | 2049 | * specified monitor. The name typically reflects the make and model of the |
| 2050 | * monitor and is not guaranteed to be unique among the connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2051 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2052 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2053 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an |
| 2054 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2055 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2056 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2057 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2058 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 2059 | * should not free it yourself. It is valid until the specified monitor is |
| 2060 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2061 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2062 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2063 | * |
| 2064 | * @sa @ref monitor_properties |
| 2065 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2066 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2067 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2068 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2069 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2070 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2071 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 2072 | /*! @brief Sets the user pointer of the specified monitor. |
| 2073 | * |
| 2074 | * This function sets the user-defined pointer of the specified monitor. The |
| 2075 | * current value is retained until the monitor is disconnected. The initial |
| 2076 | * value is `NULL`. |
| 2077 | * |
| 2078 | * This function may be called from the monitor callback, even for a monitor |
| 2079 | * that is being disconnected. |
| 2080 | * |
| 2081 | * @param[in] monitor The monitor whose pointer to set. |
| 2082 | * @param[in] pointer The new value. |
| 2083 | * |
| 2084 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2085 | * |
| 2086 | * @thread_safety This function may be called from any thread. Access is not |
| 2087 | * synchronized. |
| 2088 | * |
| 2089 | * @sa @ref monitor_userptr |
| 2090 | * @sa @ref glfwGetMonitorUserPointer |
| 2091 | * |
| 2092 | * @since Added in version 3.3. |
| 2093 | * |
| 2094 | * @ingroup monitor |
| 2095 | */ |
| 2096 | GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); |
| 2097 | |
| 2098 | /*! @brief Returns the user pointer of the specified monitor. |
| 2099 | * |
| 2100 | * This function returns the current value of the user-defined pointer of the |
| 2101 | * specified monitor. The initial value is `NULL`. |
| 2102 | * |
| 2103 | * This function may be called from the monitor callback, even for a monitor |
| 2104 | * that is being disconnected. |
| 2105 | * |
| 2106 | * @param[in] monitor The monitor whose pointer to return. |
| 2107 | * |
| 2108 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2109 | * |
| 2110 | * @thread_safety This function may be called from any thread. Access is not |
| 2111 | * synchronized. |
| 2112 | * |
| 2113 | * @sa @ref monitor_userptr |
| 2114 | * @sa @ref glfwSetMonitorUserPointer |
| 2115 | * |
| 2116 | * @since Added in version 3.3. |
| 2117 | * |
| 2118 | * @ingroup monitor |
| 2119 | */ |
| 2120 | GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); |
| 2121 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2122 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2123 | * |
| 2124 | * This function sets the monitor configuration callback, or removes the |
| 2125 | * currently set callback. This is called when a monitor is connected to or |
| 2126 | * disconnected from the system. |
| 2127 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2128 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2129 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2130 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2131 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2132 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2133 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2134 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2135 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2136 | * |
| 2137 | * @sa @ref monitor_event |
| 2138 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2139 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2140 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2141 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2142 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2143 | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 2144 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2145 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2146 | * |
| 2147 | * 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] | 2148 | * monitor. The returned array is sorted in ascending order, first by color |
| 2149 | * bit depth (the sum of all channel depths) and then by resolution area (the |
| 2150 | * product of width and height). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2151 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2152 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2153 | * @param[out] count Where to store the number of video modes in the returned |
| 2154 | * array. This is set to zero if an error occurred. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2155 | * @return An array of video modes, or `NULL` if an |
| 2156 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2157 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2158 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2159 | * GLFW_PLATFORM_ERROR. |
| 2160 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2161 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2162 | * should not free it yourself. It is valid until the specified monitor is |
| 2163 | * disconnected, this function is called again for that monitor or the library |
| 2164 | * is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2165 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2166 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2167 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2168 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2169 | * @sa @ref glfwGetVideoMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2170 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2171 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2172 | * @glfw3 Changed to return an array of modes for a specific monitor. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2173 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2174 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2175 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2176 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2177 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2178 | /*! @brief Returns the current mode of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2179 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2180 | * This function returns the current video mode of the specified monitor. If |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2181 | * you have created a full screen window for that monitor, the return value |
| 2182 | * will depend on whether that window is iconified. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2183 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2184 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2185 | * @return The current mode of the monitor, or `NULL` if an |
| 2186 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2187 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2188 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2189 | * GLFW_PLATFORM_ERROR. |
| 2190 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2191 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2192 | * should not free it yourself. It is valid until the specified monitor is |
| 2193 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2194 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2195 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2196 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2197 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2198 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2199 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2200 | * @since Added in version 3.0. Replaces `glfwGetDesktopMode`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2201 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2202 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2203 | */ |
Camilla Berglund | ce1e84d | 2013-05-22 22:16:43 +0200 | [diff] [blame] | 2204 | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2205 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2206 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2207 | * |
Camilla Löwy | 3531c32 | 2018-12-17 17:40:18 +0100 | [diff] [blame] | 2208 | * This function generates an appropriately sized gamma ramp from the specified |
| 2209 | * exponent and then calls @ref glfwSetGammaRamp with it. The value must be |
| 2210 | * a finite number greater than zero. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2211 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2212 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2213 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2214 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2215 | * the default (usually sRGB-like) behavior. |
| 2216 | * |
| 2217 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2218 | * GLFW_SRGB_CAPABLE hint. |
| 2219 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2220 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 2221 | * @param[in] gamma The desired exponent. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2222 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2223 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2224 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 2225 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2226 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2227 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2228 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2229 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2230 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2231 | * @sa @ref monitor_gamma |
| 2232 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2233 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2234 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2235 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2236 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2237 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2238 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2239 | /*! @brief Returns the current gamma ramp for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2240 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2241 | * This function returns the current gamma ramp of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2242 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2243 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2244 | * @return The current gamma ramp, or `NULL` if an |
| 2245 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2246 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2247 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2248 | * GLFW_PLATFORM_ERROR. |
| 2249 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2250 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2251 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while |
| 2252 | * returning `NULL`. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2253 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2254 | * @pointer_lifetime The returned structure and its arrays are allocated and |
| 2255 | * freed by GLFW. You should not free them yourself. They are valid until the |
| 2256 | * specified monitor is disconnected, this function is called again for that |
| 2257 | * monitor or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2258 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2259 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2260 | * |
| 2261 | * @sa @ref monitor_gamma |
| 2262 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2263 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2264 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2265 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2266 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2267 | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2268 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2269 | /*! @brief Sets the current gamma ramp for the specified monitor. |
| 2270 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2271 | * This function sets the current gamma ramp for the specified monitor. The |
| 2272 | * original gamma ramp for that monitor is saved by GLFW the first time this |
| 2273 | * function is called and is restored by @ref glfwTerminate. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2274 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2275 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2276 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2277 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2278 | * the default (usually sRGB-like) behavior. |
| 2279 | * |
| 2280 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2281 | * GLFW_SRGB_CAPABLE hint. |
| 2282 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2283 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2284 | * @param[in] ramp The gamma ramp to use. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 2285 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2286 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2287 | * GLFW_PLATFORM_ERROR. |
| 2288 | * |
Camilla Löwy | 3531c32 | 2018-12-17 17:40:18 +0100 | [diff] [blame] | 2289 | * @remark The size of the specified gamma ramp should match the size of the |
| 2290 | * current ramp for that monitor. |
Camilla Berglund | 76fff4d | 2015-03-10 19:02:28 +0100 | [diff] [blame] | 2291 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2292 | * @remark @win32 The gamma ramp size must be 256. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2293 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2294 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2295 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2296 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2297 | * @pointer_lifetime The specified gamma ramp is copied before this function |
| 2298 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2299 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2300 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2301 | * |
| 2302 | * @sa @ref monitor_gamma |
| 2303 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2304 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2305 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2306 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2307 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2308 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 2309 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2310 | /*! @brief Resets all window hints to their default values. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2311 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2312 | * This function resets all window hints to their |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2313 | * [default values](@ref window_hints_values). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2314 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2315 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2316 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2317 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2318 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2319 | * @sa @ref window_hints |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2320 | * @sa @ref glfwWindowHint |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2321 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2322 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2323 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2324 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2325 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2326 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 2327 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2328 | |
| 2329 | /*! @brief Sets the specified window hint to the desired value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2330 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 2331 | * 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] | 2332 | * hints, once set, retain their values until changed by a call to this |
| 2333 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 2334 | * |
| 2335 | * Only integer value hints can be set with this function. String value hints |
| 2336 | * are set with @ref glfwWindowHintString. |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 2337 | * |
Camilla Berglund | d6e0a43 | 2016-02-09 07:41:48 +0100 | [diff] [blame] | 2338 | * This function does not check whether the specified hint values are valid. |
| 2339 | * If you set hints to invalid values this will instead be reported by the next |
| 2340 | * call to @ref glfwCreateWindow. |
| 2341 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2342 | * Some hints are platform specific. These may be set on any platform but they |
| 2343 | * will only affect their specific platform. Other platforms will ignore them. |
| 2344 | * Setting these hints requires no platform specific headers or functions. |
| 2345 | * |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 2346 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 2347 | * @param[in] value The new value of the window hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2348 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2349 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2350 | * GLFW_INVALID_ENUM. |
| 2351 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2352 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 2353 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2354 | * @sa @ref window_hints |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2355 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2356 | * @sa @ref glfwDefaultWindowHints |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2357 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2358 | * @since Added in version 3.0. Replaces `glfwOpenWindowHint`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2359 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2360 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2361 | */ |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 2362 | GLFWAPI void glfwWindowHint(int hint, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2363 | |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2364 | /*! @brief Sets the specified window hint to the desired value. |
| 2365 | * |
| 2366 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 2367 | * hints, once set, retain their values until changed by a call to this |
| 2368 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 2369 | * |
| 2370 | * Only string type hints can be set with this function. Integer value hints |
| 2371 | * are set with @ref glfwWindowHint. |
| 2372 | * |
| 2373 | * This function does not check whether the specified hint values are valid. |
| 2374 | * If you set hints to invalid values this will instead be reported by the next |
| 2375 | * call to @ref glfwCreateWindow. |
| 2376 | * |
| 2377 | * Some hints are platform specific. These may be set on any platform but they |
| 2378 | * will only affect their specific platform. Other platforms will ignore them. |
| 2379 | * Setting these hints requires no platform specific headers or functions. |
| 2380 | * |
| 2381 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 2382 | * @param[in] value The new value of the window hint. |
| 2383 | * |
| 2384 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2385 | * GLFW_INVALID_ENUM. |
| 2386 | * |
| 2387 | * @pointer_lifetime The specified string is copied before this function |
| 2388 | * returns. |
| 2389 | * |
| 2390 | * @thread_safety This function must only be called from the main thread. |
| 2391 | * |
| 2392 | * @sa @ref window_hints |
| 2393 | * @sa @ref glfwWindowHint |
| 2394 | * @sa @ref glfwDefaultWindowHints |
| 2395 | * |
| 2396 | * @since Added in version 3.3. |
| 2397 | * |
| 2398 | * @ingroup window |
| 2399 | */ |
| 2400 | GLFWAPI void glfwWindowHintString(int hint, const char* value); |
| 2401 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2402 | /*! @brief Creates a window and its associated context. |
| 2403 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2404 | * This function creates a window and its associated OpenGL or OpenGL ES |
| 2405 | * context. Most of the options controlling how the window and its context |
| 2406 | * should be created are specified with [window hints](@ref window_hints). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2407 | * |
| 2408 | * Successful creation does not change which context is current. Before you |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2409 | * can use the newly created context, you need to |
| 2410 | * [make it current](@ref context_current). For information about the `share` |
| 2411 | * parameter, see @ref context_sharing. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2412 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2413 | * The created window, framebuffer and context may differ from what you |
| 2414 | * requested, as not all parameters and hints are |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 2415 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2416 | * window, especially for full screen windows. To query the actual attributes |
Camilla Berglund | e8bceaa | 2015-04-07 14:37:42 +0200 | [diff] [blame] | 2417 | * of the created window, framebuffer and context, see @ref |
| 2418 | * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2419 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2420 | * 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] | 2421 | * will cover. If no monitor is specified, the window will be windowed mode. |
| 2422 | * Unless you have a way for the user to choose a specific monitor, it is |
| 2423 | * recommended that you pick the primary monitor. For more information on how |
| 2424 | * to query connected monitors, see @ref monitor_monitors. |
Camilla Berglund | 4b7ae49 | 2013-07-07 12:06:59 +0200 | [diff] [blame] | 2425 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2426 | * For full screen windows, the specified size becomes the resolution of the |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2427 | * window's _desired video mode_. As long as a full screen window is not |
| 2428 | * iconified, the supported video mode most closely matching the desired video |
| 2429 | * mode is set for the specified monitor. For more information about full |
| 2430 | * screen windows, including the creation of so called _windowed full screen_ |
| 2431 | * or _borderless full screen_ windows, see @ref window_windowed_full_screen. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2432 | * |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 2433 | * 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] | 2434 | * full screen mode with @ref glfwSetWindowMonitor. This will not affect its |
| 2435 | * OpenGL or OpenGL ES context. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 2436 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2437 | * By default, newly created windows use the placement recommended by the |
| 2438 | * window system. To create the window at a specific position, make it |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2439 | * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2440 | * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) |
| 2441 | * it. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2442 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2443 | * As long as at least one full screen window is not iconified, the screensaver |
| 2444 | * is prohibited from starting. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2445 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2446 | * Window systems put limits on window sizes. Very large or very small window |
| 2447 | * dimensions may be overridden by the window system on creation. Check the |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2448 | * actual [size](@ref window_size) after creation. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2449 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2450 | * 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] | 2451 | * the initial value may vary depending on driver settings and defaults. |
| 2452 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2453 | * @param[in] width The desired width, in screen coordinates, of the window. |
| 2454 | * This must be greater than zero. |
| 2455 | * @param[in] height The desired height, in screen coordinates, of the window. |
| 2456 | * This must be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2457 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2458 | * @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] | 2459 | * windowed mode. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2460 | * @param[in] share The window whose context to share resources with, or `NULL` |
| 2461 | * to not share resources. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2462 | * @return The handle of the created window, or `NULL` if an |
| 2463 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2464 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2465 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2466 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref |
| 2467 | * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref |
| 2468 | * GLFW_PLATFORM_ERROR. |
| 2469 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2470 | * @remark @win32 Window creation will fail if the Microsoft GDI software |
| 2471 | * OpenGL implementation is the only one available. |
Camilla Berglund | 07db5da | 2013-09-26 19:15:36 +0200 | [diff] [blame] | 2472 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 2473 | * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it |
| 2474 | * 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] | 2475 | * the `IDI_APPLICATION` icon will be used instead. To set a different icon, |
| 2476 | * see @ref glfwSetWindowIcon. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2477 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2478 | * @remark @win32 The context to share resources with must not be current on |
| 2479 | * any other thread. |
Camilla Berglund | b19fb4c | 2014-12-27 21:14:41 +0100 | [diff] [blame] | 2480 | * |
Camilla Löwy | fd127d5 | 2016-12-03 19:32:00 +0100 | [diff] [blame] | 2481 | * @remark @macos The OS only supports forward-compatible core profile contexts |
| 2482 | * for OpenGL versions 3.2 and later. Before creating an OpenGL context of |
| 2483 | * version 3.2 or later you must set the |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2484 | * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and |
| 2485 | * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly. |
| 2486 | * OpenGL 3.0 and 3.1 contexts are not supported at all on macOS. |
Camilla Löwy | fd127d5 | 2016-12-03 19:32:00 +0100 | [diff] [blame] | 2487 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2488 | * @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] | 2489 | * 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] | 2490 | * For more information on bundles, see the |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2491 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 2492 | * in the Mac Developer Library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2493 | * |
Camilla Löwy | c50aba1 | 2017-03-01 04:09:51 +0100 | [diff] [blame] | 2494 | * @remark @macos The first time a window is created the menu bar is created. |
| 2495 | * If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu |
| 2496 | * bar. Otherwise a minimal menu bar is created manually with common commands |
| 2497 | * like Hide, Quit and About. The About entry opens a minimal about dialog |
| 2498 | * with information from the application's bundle. Menu bar creation can be |
| 2499 | * disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2500 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2501 | * @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] | 2502 | * at full resolution on Retina displays unless the |
| 2503 | * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) |
| 2504 | * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the |
| 2505 | * application bundle's `Info.plist`. For more information, see |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 2506 | * [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] | 2507 | * in the Mac Developer Library. The GLFW test and example programs use |
| 2508 | * a custom `Info.plist` template for this, which can be found as |
| 2509 | * `CMake/MacOSXBundleInfo.plist.in` in the source tree. |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 2510 | * |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 2511 | * @remark @macos When activating frame autosaving with |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 2512 | * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified |
| 2513 | * window size and position may be overriden by previously saved values. |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 2514 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2515 | * @remark @x11 Some window managers will not respect the placement of |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2516 | * initially hidden windows. |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 2517 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2518 | * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for |
| 2519 | * a window to reach its requested state. This means you may not be able to |
| 2520 | * query the final size, position or other attributes directly after window |
| 2521 | * creation. |
Camilla Berglund | 20ed0a1 | 2015-08-12 21:31:54 +0200 | [diff] [blame] | 2522 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2523 | * @remark @x11 The class part of the `WM_CLASS` window property will by |
| 2524 | * default be set to the window title passed to this function. The instance |
| 2525 | * 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] | 2526 | * present and not empty, or fall back to the window title. Set the |
| 2527 | * [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and |
| 2528 | * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to |
| 2529 | * override this. |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 2530 | * |
Emmanuel Gil Peyrot | bcd8f9a | 2019-02-15 19:02:32 +0100 | [diff] [blame] | 2531 | * @remark @wayland Compositors should implement the xdg-decoration protocol |
| 2532 | * for GLFW to decorate the window properly. If this protocol isn't |
| 2533 | * supported, or if the compositor prefers client-side decorations, a very |
| 2534 | * simple fallback frame will be drawn using the wp_viewporter protocol. A |
| 2535 | * compositor can still emit close, maximize or fullscreen events, using for |
| 2536 | * instance a keybind mechanism. If neither of these protocols is supported, |
| 2537 | * the window won't be decorated. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2538 | * |
| 2539 | * @remark @wayland A full screen window will not attempt to change the mode, |
| 2540 | * no matter what the requested size or refresh rate. |
| 2541 | * |
Emmanuel Gil Peyrot | 6516685 | 2017-02-17 15:52:50 +0000 | [diff] [blame] | 2542 | * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol |
| 2543 | * to be implemented in the user's compositor. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2544 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2545 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2546 | * |
| 2547 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2548 | * @sa @ref glfwDestroyWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2549 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2550 | * @since Added in version 3.0. Replaces `glfwOpenWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2551 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2552 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2553 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2554 | 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] | 2555 | |
| 2556 | /*! @brief Destroys the specified window and its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2557 | * |
| 2558 | * This function destroys the specified window and its context. On calling |
| 2559 | * this function, no further callbacks will be called for that window. |
| 2560 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2561 | * If the context of the specified window is current on the main thread, it is |
| 2562 | * detached before being destroyed. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2563 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2564 | * @param[in] window The window to destroy. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2565 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2566 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2567 | * GLFW_PLATFORM_ERROR. |
| 2568 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2569 | * @note The context of the specified window must not be current on any other |
| 2570 | * thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2571 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2572 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 2573 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2574 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2575 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2576 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2577 | * @sa @ref glfwCreateWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2578 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2579 | * @since Added in version 3.0. Replaces `glfwCloseWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2580 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2581 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2582 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2583 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2584 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2585 | /*! @brief Checks the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2586 | * |
| 2587 | * This function returns the value of the close flag of the specified window. |
| 2588 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2589 | * @param[in] window The window to query. |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2590 | * @return The value of the close flag. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2591 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2592 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2593 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2594 | * @thread_safety This function may be called from any thread. Access is not |
| 2595 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2596 | * |
| 2597 | * @sa @ref window_close |
| 2598 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2599 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 2600 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2601 | * @ingroup window |
| 2602 | */ |
| 2603 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
| 2604 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2605 | /*! @brief Sets the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2606 | * |
| 2607 | * This function sets the value of the close flag of the specified window. |
| 2608 | * This can be used to override the user's attempt to close the window, or |
| 2609 | * to signal that it should be closed. |
| 2610 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2611 | * @param[in] window The window whose flag to change. |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2612 | * @param[in] value The new value. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2613 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2614 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2615 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2616 | * @thread_safety This function may be called from any thread. Access is not |
| 2617 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2618 | * |
| 2619 | * @sa @ref window_close |
| 2620 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2621 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 2622 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2623 | * @ingroup window |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2624 | */ |
| 2625 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
| 2626 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2627 | /*! @brief Sets the title of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2628 | * |
| 2629 | * This function sets the window title, encoded as UTF-8, of the specified |
| 2630 | * window. |
| 2631 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2632 | * @param[in] window The window whose title to change. |
| 2633 | * @param[in] title The UTF-8 encoded window title. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2634 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2635 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2636 | * GLFW_PLATFORM_ERROR. |
| 2637 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2638 | * @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] | 2639 | * process events. |
Camilla Berglund | 6412dcb | 2015-04-07 21:52:29 +0200 | [diff] [blame] | 2640 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2641 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2642 | * |
| 2643 | * @sa @ref window_title |
| 2644 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2645 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2646 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2647 | * |
| 2648 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2649 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2650 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2651 | |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2652 | /*! @brief Sets the icon for the specified window. |
| 2653 | * |
| 2654 | * This function sets the icon of the specified window. If passed an array of |
| 2655 | * candidate images, those of or closest to the sizes desired by the system are |
| 2656 | * selected. If no images are specified, the window reverts to its default |
| 2657 | * icon. |
| 2658 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 2659 | * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight |
| 2660 | * bits per channel with the red channel first. They are arranged canonically |
| 2661 | * as packed sequential rows, starting from the top-left corner. |
| 2662 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2663 | * The desired image sizes varies depending on platform and system settings. |
| 2664 | * The selected images will be rescaled as needed. Good sizes include 16x16, |
| 2665 | * 32x32 and 48x48. |
| 2666 | * |
| 2667 | * @param[in] window The window whose icon to set. |
| 2668 | * @param[in] count The number of images in the specified array, or zero to |
| 2669 | * revert to the default window icon. |
| 2670 | * @param[in] images The images to create the icon from. This is ignored if |
| 2671 | * count is zero. |
| 2672 | * |
| 2673 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2674 | * GLFW_PLATFORM_ERROR. |
| 2675 | * |
| 2676 | * @pointer_lifetime The specified image data is copied before this function |
| 2677 | * returns. |
| 2678 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2679 | * @remark @macos The GLFW window has no icon, as it is not a document |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 2680 | * window, so this function does nothing. The dock icon will be the same as |
| 2681 | * the application bundle's icon. For more information on bundles, see the |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2682 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 2683 | * in the Mac Developer Library. |
| 2684 | * |
Emmanuel Gil Peyrot | a162004 | 2017-12-03 04:19:15 +0100 | [diff] [blame] | 2685 | * @remark @wayland There is no existing protocol to change an icon, the |
| 2686 | * window will thus inherit the one defined in the application's desktop file. |
| 2687 | * This function always emits @ref GLFW_PLATFORM_ERROR. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2688 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2689 | * @thread_safety This function must only be called from the main thread. |
| 2690 | * |
| 2691 | * @sa @ref window_icon |
| 2692 | * |
| 2693 | * @since Added in version 3.2. |
| 2694 | * |
| 2695 | * @ingroup window |
| 2696 | */ |
| 2697 | GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images); |
| 2698 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2699 | /*! @brief Retrieves the position of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2700 | * |
| 2701 | * This function retrieves the position, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2702 | * upper-left corner of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2703 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2704 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 2705 | * non-`NULL` position arguments will be set to zero. |
| 2706 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2707 | * @param[in] window The window to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2708 | * @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] | 2709 | * the content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2710 | * @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] | 2711 | * the content area, or `NULL`. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2712 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2713 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2714 | * GLFW_PLATFORM_ERROR. |
| 2715 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2716 | * @remark @wayland There is no way for an application to retrieve the global |
| 2717 | * position of its windows, this function will always emit @ref |
| 2718 | * GLFW_PLATFORM_ERROR. |
| 2719 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2720 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2721 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2722 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2723 | * @sa @ref glfwSetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2724 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2725 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2726 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2727 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2728 | */ |
| 2729 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
| 2730 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2731 | /*! @brief Sets the position of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2732 | * |
| 2733 | * 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] | 2734 | * 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] | 2735 | * window is a full screen window, this function does nothing. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2736 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2737 | * __Do not use this function__ to move an already visible window unless you |
| 2738 | * have very good reasons for doing so, as it will confuse and annoy the user. |
| 2739 | * |
| 2740 | * The window manager may put limits on what positions are allowed. GLFW |
| 2741 | * cannot and should not override these limits. |
| 2742 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2743 | * @param[in] window The window to query. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2744 | * @param[in] xpos The x-coordinate of the upper-left corner of the content area. |
| 2745 | * @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] | 2746 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2747 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2748 | * GLFW_PLATFORM_ERROR. |
| 2749 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2750 | * @remark @wayland There is no way for an application to set the global |
| 2751 | * position of its windows, this function will always emit @ref |
| 2752 | * GLFW_PLATFORM_ERROR. |
| 2753 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2754 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2755 | * |
| 2756 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2757 | * @sa @ref glfwGetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2758 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2759 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2760 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2761 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2762 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2763 | */ |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 2764 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2765 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2766 | /*! @brief Retrieves the size of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2767 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2768 | * This function retrieves the size, in screen coordinates, of the content area |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 2769 | * 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] | 2770 | * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2771 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2772 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2773 | * non-`NULL` size arguments will be set to zero. |
| 2774 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2775 | * @param[in] window The window whose size to retrieve. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2776 | * @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] | 2777 | * content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2778 | * @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] | 2779 | * content area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2780 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2781 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2782 | * GLFW_PLATFORM_ERROR. |
| 2783 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2784 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2785 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2786 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2787 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2788 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2789 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2790 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2791 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2792 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2793 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2794 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2795 | |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2796 | /*! @brief Sets the size limits of the specified window. |
| 2797 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2798 | * 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] | 2799 | * 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] | 2800 | * once it is made windowed. If the window is not resizable, this function |
| 2801 | * does nothing. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2802 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2803 | * The size limits are applied immediately to a windowed mode window and may |
| 2804 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2805 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 2806 | * The maximum dimensions must be greater than or equal to the minimum |
| 2807 | * dimensions and all must be greater than or equal to zero. |
| 2808 | * |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2809 | * @param[in] window The window to set limits for. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2810 | * @param[in] minwidth The minimum width, in screen coordinates, of the content |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2811 | * area, or `GLFW_DONT_CARE`. |
| 2812 | * @param[in] minheight The minimum height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2813 | * content area, or `GLFW_DONT_CARE`. |
| 2814 | * @param[in] maxwidth The maximum width, in screen coordinates, of the content |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2815 | * area, or `GLFW_DONT_CARE`. |
| 2816 | * @param[in] maxheight The maximum height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2817 | * content area, or `GLFW_DONT_CARE`. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2818 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 2819 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2820 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2821 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2822 | * @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] | 2823 | * results are undefined. |
| 2824 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2825 | * @remark @wayland The size limits will not be applied until the window is |
| 2826 | * actually resized, either by the user or by the compositor. |
| 2827 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2828 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2829 | * |
| 2830 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2831 | * @sa @ref glfwSetWindowAspectRatio |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2832 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2833 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2834 | * |
| 2835 | * @ingroup window |
| 2836 | */ |
| 2837 | GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); |
| 2838 | |
| 2839 | /*! @brief Sets the aspect ratio of the specified window. |
| 2840 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2841 | * 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] | 2842 | * specified window. If the window is full screen, the aspect ratio only takes |
| 2843 | * 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] | 2844 | * function does nothing. |
| 2845 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 2846 | * The aspect ratio is specified as a numerator and a denominator and both |
| 2847 | * values must be greater than zero. For example, the common 16:9 aspect ratio |
| 2848 | * is specified as 16 and 9, respectively. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2849 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 2850 | * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect |
| 2851 | * ratio limit is disabled. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2852 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2853 | * The aspect ratio is applied immediately to a windowed mode window and may |
| 2854 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2855 | * |
| 2856 | * @param[in] window The window to set limits for. |
| 2857 | * @param[in] numer The numerator of the desired aspect ratio, or |
| 2858 | * `GLFW_DONT_CARE`. |
| 2859 | * @param[in] denom The denominator of the desired aspect ratio, or |
| 2860 | * `GLFW_DONT_CARE`. |
| 2861 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2862 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2863 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 2864 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2865 | * @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] | 2866 | * results are undefined. |
| 2867 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2868 | * @remark @wayland The aspect ratio will not be applied until the window is |
| 2869 | * actually resized, either by the user or by the compositor. |
| 2870 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2871 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2872 | * |
| 2873 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2874 | * @sa @ref glfwSetWindowSizeLimits |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2875 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2876 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2877 | * |
| 2878 | * @ingroup window |
| 2879 | */ |
| 2880 | GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); |
| 2881 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2882 | /*! @brief Sets the size of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2883 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2884 | * 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] | 2885 | * the specified window. |
| 2886 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2887 | * For full screen windows, this function updates the resolution of its desired |
| 2888 | * video mode and switches to the video mode closest to it, without affecting |
| 2889 | * the window's context. As the context is unaffected, the bit depths of the |
| 2890 | * framebuffer remain unchanged. |
| 2891 | * |
| 2892 | * If you wish to update the refresh rate of the desired video mode in addition |
| 2893 | * to its resolution, see @ref glfwSetWindowMonitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2894 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2895 | * The window manager may put limits on what sizes are allowed. GLFW cannot |
| 2896 | * and should not override these limits. |
| 2897 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2898 | * @param[in] window The window to resize. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2899 | * @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] | 2900 | * content area. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2901 | * @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] | 2902 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2903 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2904 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2905 | * GLFW_PLATFORM_ERROR. |
| 2906 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2907 | * @remark @wayland A full screen window will not attempt to change the mode, |
| 2908 | * no matter what the requested size. |
| 2909 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2910 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2911 | * |
| 2912 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2913 | * @sa @ref glfwGetWindowSize |
| 2914 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2915 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2916 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2917 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2918 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2919 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2920 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2921 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2922 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2923 | /*! @brief Retrieves the size of the framebuffer of the specified window. |
| 2924 | * |
| 2925 | * This function retrieves the size, in pixels, of the framebuffer of the |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 2926 | * specified window. If you wish to retrieve the size of the window in screen |
| 2927 | * coordinates, see @ref glfwGetWindowSize. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2928 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2929 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2930 | * non-`NULL` size arguments will be set to zero. |
| 2931 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2932 | * @param[in] window The window whose framebuffer to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2933 | * @param[out] width Where to store the width, in pixels, of the framebuffer, |
| 2934 | * or `NULL`. |
| 2935 | * @param[out] height Where to store the height, in pixels, of the framebuffer, |
| 2936 | * or `NULL`. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2937 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2938 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2939 | * GLFW_PLATFORM_ERROR. |
| 2940 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2941 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2942 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2943 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2944 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2945 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2946 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2947 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2948 | * @ingroup window |
| 2949 | */ |
| 2950 | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); |
| 2951 | |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2952 | /*! @brief Retrieves the size of the frame of the window. |
| 2953 | * |
| 2954 | * This function retrieves the size, in screen coordinates, of each edge of the |
| 2955 | * frame of the specified window. This size includes the title bar, if the |
| 2956 | * window has one. The size of the frame may vary depending on the |
| 2957 | * [window-related hints](@ref window_hints_wnd) used to create it. |
| 2958 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2959 | * Because this function retrieves the size of each window frame edge and not |
| 2960 | * the offset along a particular coordinate axis, the retrieved values will |
| 2961 | * always be zero or positive. |
| 2962 | * |
| 2963 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2964 | * non-`NULL` size arguments will be set to zero. |
| 2965 | * |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2966 | * @param[in] window The window whose frame size to query. |
| 2967 | * @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] | 2968 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2969 | * @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] | 2970 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2971 | * @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] | 2972 | * right edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2973 | * @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] | 2974 | * bottom edge of the window frame, or `NULL`. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2975 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2976 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2977 | * GLFW_PLATFORM_ERROR. |
| 2978 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2979 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2980 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2981 | * @sa @ref window_size |
| 2982 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2983 | * @since Added in version 3.1. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2984 | * |
| 2985 | * @ingroup window |
| 2986 | */ |
| 2987 | GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); |
| 2988 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2989 | /*! @brief Retrieves the content scale for the specified window. |
| 2990 | * |
| 2991 | * This function retrieves the content scale for the specified window. The |
| 2992 | * 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] | 2993 | * default DPI. This is especially important for text and any UI elements. If |
| 2994 | * the pixel dimensions of your UI scaled by this look appropriate on your |
| 2995 | * machine then it should appear at a reasonable size on other machines |
| 2996 | * regardless of their DPI and scaling settings. This relies on the system DPI |
| 2997 | * and scaling settings being somewhat correct. |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2998 | * |
| 2999 | * On systems where each monitors can have its own content scale, the window |
| 3000 | * content scale will depend on which monitor the system considers the window |
| 3001 | * to be on. |
| 3002 | * |
| 3003 | * @param[in] window The window to query. |
| 3004 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 3005 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 3006 | * |
| 3007 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3008 | * GLFW_PLATFORM_ERROR. |
| 3009 | * |
| 3010 | * @thread_safety This function must only be called from the main thread. |
| 3011 | * |
| 3012 | * @sa @ref window_scale |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 3013 | * @sa @ref glfwSetWindowContentScaleCallback |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 3014 | * @sa @ref glfwGetMonitorContentScale |
| 3015 | * |
| 3016 | * @since Added in version 3.3. |
| 3017 | * |
| 3018 | * @ingroup window |
| 3019 | */ |
| 3020 | GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); |
| 3021 | |
Camilla Löwy | 11e47f0 | 2017-09-25 23:14:45 +0200 | [diff] [blame] | 3022 | /*! @brief Returns the opacity of the whole window. |
| 3023 | * |
| 3024 | * This function returns the opacity of the window, including any decorations. |
| 3025 | * |
| 3026 | * The opacity (or alpha) value is a positive finite number between zero and |
| 3027 | * one, where zero is fully transparent and one is fully opaque. If the system |
| 3028 | * does not support whole window transparency, this function always returns one. |
| 3029 | * |
| 3030 | * The initial opacity value for newly created windows is one. |
| 3031 | * |
| 3032 | * @param[in] window The window to query. |
| 3033 | * @return The opacity value of the specified window. |
| 3034 | * |
| 3035 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3036 | * GLFW_PLATFORM_ERROR. |
| 3037 | * |
| 3038 | * @thread_safety This function must only be called from the main thread. |
| 3039 | * |
| 3040 | * @sa @ref window_transparency |
| 3041 | * @sa @ref glfwSetWindowOpacity |
| 3042 | * |
| 3043 | * @since Added in version 3.3. |
| 3044 | * |
| 3045 | * @ingroup window |
| 3046 | */ |
| 3047 | GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window); |
| 3048 | |
| 3049 | /*! @brief Sets the opacity of the whole window. |
| 3050 | * |
| 3051 | * This function sets the opacity of the window, including any decorations. |
| 3052 | * |
| 3053 | * The opacity (or alpha) value is a positive finite number between zero and |
| 3054 | * one, where zero is fully transparent and one is fully opaque. |
| 3055 | * |
| 3056 | * The initial opacity value for newly created windows is one. |
| 3057 | * |
| 3058 | * A window created with framebuffer transparency may not use whole window |
| 3059 | * transparency. The results of doing this are undefined. |
| 3060 | * |
| 3061 | * @param[in] window The window to set the opacity for. |
| 3062 | * @param[in] opacity The desired opacity of the specified window. |
| 3063 | * |
| 3064 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3065 | * GLFW_PLATFORM_ERROR. |
| 3066 | * |
| 3067 | * @thread_safety This function must only be called from the main thread. |
| 3068 | * |
| 3069 | * @sa @ref window_transparency |
| 3070 | * @sa @ref glfwGetWindowOpacity |
| 3071 | * |
| 3072 | * @since Added in version 3.3. |
| 3073 | * |
| 3074 | * @ingroup window |
| 3075 | */ |
| 3076 | GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); |
| 3077 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3078 | /*! @brief Iconifies the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3079 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3080 | * This function iconifies (minimizes) the specified window if it was |
| 3081 | * previously restored. If the window is already iconified, this function does |
| 3082 | * nothing. |
| 3083 | * |
| 3084 | * If the specified window is a full screen window, the original monitor |
| 3085 | * resolution is restored until the window is restored. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3086 | * |
| 3087 | * @param[in] window The window to iconify. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3088 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3089 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3090 | * GLFW_PLATFORM_ERROR. |
| 3091 | * |
Emmanuel Gil Peyrot | 599fb3d | 2019-03-01 18:46:06 +0100 | [diff] [blame^] | 3092 | * @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t |
| 3093 | * 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] | 3094 | * protocol. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3095 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3096 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3097 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3098 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3099 | * @sa @ref glfwRestoreWindow |
| 3100 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3101 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3102 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3103 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3104 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3105 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3106 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3107 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3108 | |
| 3109 | /*! @brief Restores the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3110 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3111 | * This function restores the specified window if it was previously iconified |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3112 | * (minimized) or maximized. If the window is already restored, this function |
| 3113 | * does nothing. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3114 | * |
| 3115 | * If the specified window is a full screen window, the resolution chosen for |
| 3116 | * the window is restored on the selected monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3117 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3118 | * @param[in] window The window to restore. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3119 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3120 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3121 | * GLFW_PLATFORM_ERROR. |
| 3122 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3123 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3124 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3125 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3126 | * @sa @ref glfwIconifyWindow |
| 3127 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3128 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3129 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3130 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3131 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3132 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3133 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3134 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3135 | |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3136 | /*! @brief Maximizes the specified window. |
| 3137 | * |
| 3138 | * This function maximizes the specified window if it was previously not |
| 3139 | * maximized. If the window is already maximized, this function does nothing. |
| 3140 | * |
| 3141 | * If the specified window is a full screen window, this function does nothing. |
| 3142 | * |
| 3143 | * @param[in] window The window to maximize. |
| 3144 | * |
Camilla Berglund | f5b71f5 | 2016-05-27 14:20:39 +0200 | [diff] [blame] | 3145 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3146 | * GLFW_PLATFORM_ERROR. |
| 3147 | * |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3148 | * @par Thread Safety |
| 3149 | * This function may only be called from the main thread. |
| 3150 | * |
| 3151 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3152 | * @sa @ref glfwIconifyWindow |
| 3153 | * @sa @ref glfwRestoreWindow |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3154 | * |
| 3155 | * @since Added in GLFW 3.2. |
| 3156 | * |
| 3157 | * @ingroup window |
| 3158 | */ |
| 3159 | GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); |
| 3160 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3161 | /*! @brief Makes the specified window visible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3162 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3163 | * This function makes the specified window visible if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3164 | * 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] | 3165 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3166 | * |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3167 | * By default, windowed mode windows are focused when shown |
| 3168 | * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint |
| 3169 | * to change this behavior for all newly created windows, or change the |
| 3170 | * behavior for an existing window with @ref glfwSetWindowAttrib. |
| 3171 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3172 | * @param[in] window The window to make visible. |
| 3173 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3174 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3175 | * GLFW_PLATFORM_ERROR. |
| 3176 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3177 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3178 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3179 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3180 | * @sa @ref glfwHideWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3181 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3182 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3183 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3184 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3185 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3186 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3187 | |
| 3188 | /*! @brief Hides the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3189 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3190 | * This function hides the specified window if it was previously visible. If |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3191 | * 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] | 3192 | * nothing. |
| 3193 | * |
| 3194 | * @param[in] window The window to hide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3195 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3196 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3197 | * GLFW_PLATFORM_ERROR. |
| 3198 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3199 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3200 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3201 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3202 | * @sa @ref glfwShowWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3203 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3204 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3205 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3206 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3207 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3208 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3209 | |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3210 | /*! @brief Brings the specified window to front and sets input focus. |
| 3211 | * |
| 3212 | * This function brings the specified window to front and sets input focus. |
| 3213 | * The window should already be visible and not iconified. |
| 3214 | * |
| 3215 | * 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] | 3216 | * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to |
| 3217 | * disable this behavior. |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3218 | * |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3219 | * Also by default, windowed mode windows are focused when shown |
| 3220 | * with @ref glfwShowWindow. Set the |
| 3221 | * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior. |
| 3222 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3223 | * __Do not use this function__ to steal focus from other applications unless |
| 3224 | * you are certain that is what the user wants. Focus stealing can be |
| 3225 | * extremely disruptive. |
| 3226 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3227 | * For a less disruptive way of getting the user's attention, see |
| 3228 | * [attention requests](@ref window_attention). |
| 3229 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3230 | * @param[in] window The window to give input focus. |
| 3231 | * |
| 3232 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3233 | * GLFW_PLATFORM_ERROR. |
| 3234 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3235 | * @remark @wayland It is not possible for an application to bring its windows |
| 3236 | * to front, this function will always emit @ref GLFW_PLATFORM_ERROR. |
| 3237 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3238 | * @thread_safety This function must only be called from the main thread. |
| 3239 | * |
| 3240 | * @sa @ref window_focus |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3241 | * @sa @ref window_attention |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3242 | * |
| 3243 | * @since Added in version 3.2. |
| 3244 | * |
| 3245 | * @ingroup window |
| 3246 | */ |
| 3247 | GLFWAPI void glfwFocusWindow(GLFWwindow* window); |
| 3248 | |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3249 | /*! @brief Requests user attention to the specified window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3250 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3251 | * This function requests user attention to the specified window. On |
| 3252 | * platforms where this is not supported, attention is requested to the |
| 3253 | * application as a whole. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3254 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3255 | * Once the user has given attention, usually by focusing the window or |
| 3256 | * application, the system will end the request automatically. |
| 3257 | * |
| 3258 | * @param[in] window The window to request attention to. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3259 | * |
| 3260 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3261 | * GLFW_PLATFORM_ERROR. |
| 3262 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3263 | * @remark @macos Attention is requested to the application as a whole, not the |
| 3264 | * specific window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3265 | * |
| 3266 | * @thread_safety This function must only be called from the main thread. |
| 3267 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3268 | * @sa @ref window_attention |
| 3269 | * |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3270 | * @since Added in version 3.3. |
| 3271 | * |
| 3272 | * @ingroup window |
| 3273 | */ |
| 3274 | GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window); |
| 3275 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3276 | /*! @brief Returns the monitor that the window uses for full screen mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3277 | * |
| 3278 | * 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] | 3279 | * in full screen on. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3280 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 3281 | * @param[in] window The window to query. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 3282 | * @return The monitor, or `NULL` if the window is in windowed mode or an |
| 3283 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3284 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3285 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3286 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3287 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3288 | * |
| 3289 | * @sa @ref window_monitor |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3290 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3291 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3292 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3293 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 3294 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3295 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3296 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3297 | |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3298 | /*! @brief Sets the mode, monitor, video mode and placement of a window. |
| 3299 | * |
| 3300 | * This function sets the monitor that the window uses for full screen mode or, |
| 3301 | * if the monitor is `NULL`, makes it windowed mode. |
| 3302 | * |
| 3303 | * When setting a monitor, this function updates the width, height and refresh |
| 3304 | * rate of the desired video mode and switches to the video mode closest to it. |
| 3305 | * The window position is ignored when setting a monitor. |
| 3306 | * |
| 3307 | * 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] | 3308 | * 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] | 3309 | * is specified. |
| 3310 | * |
| 3311 | * If you only wish to update the resolution of a full screen window or the |
| 3312 | * size of a windowed mode window, see @ref glfwSetWindowSize. |
| 3313 | * |
| 3314 | * When a window transitions from full screen to windowed mode, this function |
| 3315 | * restores any previous window settings such as whether it is decorated, |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3316 | * floating, resizable, has size or aspect ratio limits, etc. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3317 | * |
| 3318 | * @param[in] window The window whose monitor, size or video mode to set. |
| 3319 | * @param[in] monitor The desired monitor, or `NULL` to set windowed mode. |
| 3320 | * @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] | 3321 | * content area. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3322 | * @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] | 3323 | * content area. |
| 3324 | * @param[in] width The desired with, in screen coordinates, of the content |
| 3325 | * area or video mode. |
| 3326 | * @param[in] height The desired height, in screen coordinates, of the content |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3327 | * area or video mode. |
Camilla Berglund | 325729d | 2016-05-22 14:25:04 +0200 | [diff] [blame] | 3328 | * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode, |
| 3329 | * or `GLFW_DONT_CARE`. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3330 | * |
| 3331 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3332 | * GLFW_PLATFORM_ERROR. |
| 3333 | * |
Camilla Berglund | ec17161 | 2016-10-28 06:20:20 +0200 | [diff] [blame] | 3334 | * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise |
| 3335 | * affected by any resizing or mode switching, although you may need to update |
| 3336 | * your viewport if the framebuffer size has changed. |
| 3337 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3338 | * @remark @wayland The desired window position is ignored, as there is no way |
| 3339 | * for an application to set this property. |
| 3340 | * |
| 3341 | * @remark @wayland Setting the window to full screen will not attempt to |
| 3342 | * change the mode, no matter what the requested size or refresh rate. |
| 3343 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3344 | * @thread_safety This function must only be called from the main thread. |
| 3345 | * |
| 3346 | * @sa @ref window_monitor |
| 3347 | * @sa @ref window_full_screen |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3348 | * @sa @ref glfwGetWindowMonitor |
| 3349 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3350 | * |
| 3351 | * @since Added in version 3.2. |
| 3352 | * |
| 3353 | * @ingroup window |
| 3354 | */ |
| 3355 | GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); |
| 3356 | |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 3357 | /*! @brief Returns an attribute of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3358 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3359 | * This function returns the value of an attribute of the specified window or |
| 3360 | * its OpenGL or OpenGL ES context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3361 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3362 | * @param[in] window The window to query. |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 3363 | * @param[in] attrib The [window attribute](@ref window_attribs) whose value to |
| 3364 | * return. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3365 | * @return The value of the attribute, or zero if an |
| 3366 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3367 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3368 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3369 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 3370 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3371 | * @remark Framebuffer related hints are not window attributes. See @ref |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 3372 | * window_attribs_fb for more information. |
| 3373 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3374 | * @remark Zero is a valid value for many window and context related |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 3375 | * attributes so you cannot use a return value of zero as an indication of |
| 3376 | * errors. However, this function should not fail as long as it is passed |
| 3377 | * valid arguments and the library has been [initialized](@ref intro_init). |
| 3378 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3379 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3380 | * |
| 3381 | * @sa @ref window_attribs |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3382 | * @sa @ref glfwSetWindowAttrib |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3383 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3384 | * @since Added in version 3.0. Replaces `glfwGetWindowParam` and |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3385 | * `glfwGetGLVersion`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3386 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3387 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3388 | */ |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 3389 | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3390 | |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3391 | /*! @brief Sets an attribute of the specified window. |
| 3392 | * |
| 3393 | * This function sets the value of an attribute of the specified window. |
| 3394 | * |
| 3395 | * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), |
| 3396 | * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3397 | * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), |
| 3398 | * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and |
| 3399 | * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib). |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3400 | * |
| 3401 | * Some of these attributes are ignored for full screen windows. The new |
| 3402 | * value will take effect if the window is later made windowed. |
| 3403 | * |
| 3404 | * Some of these attributes are ignored for windowed mode windows. The new |
| 3405 | * value will take effect if the window is later made full screen. |
| 3406 | * |
| 3407 | * @param[in] window The window to set the attribute for. |
| 3408 | * @param[in] attrib A supported window attribute. |
| 3409 | * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`. |
| 3410 | * |
| 3411 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3412 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 3413 | * |
| 3414 | * @remark Calling @ref glfwGetWindowAttrib will always return the latest |
| 3415 | * value, even if that value is ignored by the current mode of the window. |
| 3416 | * |
| 3417 | * @thread_safety This function must only be called from the main thread. |
| 3418 | * |
| 3419 | * @sa @ref window_attribs |
| 3420 | * @sa @ref glfwGetWindowAttrib |
| 3421 | * |
| 3422 | * @since Added in version 3.3. |
| 3423 | * |
| 3424 | * @ingroup window |
| 3425 | */ |
| 3426 | GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value); |
| 3427 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3428 | /*! @brief Sets the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3429 | * |
| 3430 | * This function sets the user-defined pointer of the specified window. The |
| 3431 | * current value is retained until the window is destroyed. The initial value |
| 3432 | * is `NULL`. |
| 3433 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3434 | * @param[in] window The window whose pointer to set. |
| 3435 | * @param[in] pointer The new value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3436 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3437 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3438 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3439 | * @thread_safety This function may be called from any thread. Access is not |
| 3440 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3441 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3442 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3443 | * @sa @ref glfwGetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3444 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3445 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3446 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3447 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3448 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3449 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3450 | |
| 3451 | /*! @brief Returns the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3452 | * |
| 3453 | * This function returns the current value of the user-defined pointer of the |
| 3454 | * specified window. The initial value is `NULL`. |
| 3455 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3456 | * @param[in] window The window whose pointer to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3457 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3458 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3459 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3460 | * @thread_safety This function may be called from any thread. Access is not |
| 3461 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3462 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3463 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3464 | * @sa @ref glfwSetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3465 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3466 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3467 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3468 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3469 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3470 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3471 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3472 | /*! @brief Sets the position callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3473 | * |
| 3474 | * 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] | 3475 | * 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] | 3476 | * position, in screen coordinates, of the upper-left corner of the content |
| 3477 | * area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3478 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3479 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3480 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3481 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3482 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3483 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3484 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3485 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3486 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3487 | * @remark @wayland This callback will never be called, as there is no way for |
| 3488 | * an application to know its global position. |
| 3489 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3490 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3491 | * |
| 3492 | * @sa @ref window_pos |
| 3493 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3494 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3495 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3496 | * @ingroup window |
| 3497 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3498 | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3499 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3500 | /*! @brief Sets the size callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3501 | * |
| 3502 | * This function sets the size callback of the specified window, which is |
| 3503 | * 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] | 3504 | * in screen coordinates, of the content area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3505 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3506 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3507 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3508 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3509 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3510 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3511 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3512 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3513 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3514 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3515 | * |
| 3516 | * @sa @ref window_size |
| 3517 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3518 | * @since Added in version 1.0. |
| 3519 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3520 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3521 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3522 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3523 | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3524 | |
| 3525 | /*! @brief Sets the close callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3526 | * |
| 3527 | * This function sets the close callback of the specified window, which is |
| 3528 | * called when the user attempts to close the window, for example by clicking |
| 3529 | * the close widget in the title bar. |
| 3530 | * |
| 3531 | * The close flag is set before this callback is called, but you can modify it |
| 3532 | * at any time with @ref glfwSetWindowShouldClose. |
| 3533 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3534 | * The close callback is not triggered by @ref glfwDestroyWindow. |
| 3535 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3536 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3537 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3538 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3539 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3540 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3541 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3542 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3543 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 3544 | * @remark @macos Selecting Quit from the application menu will trigger the |
| 3545 | * close callback for all windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3546 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3547 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3548 | * |
| 3549 | * @sa @ref window_close |
| 3550 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3551 | * @since Added in version 2.5. |
| 3552 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3553 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3554 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3555 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3556 | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3557 | |
| 3558 | /*! @brief Sets the refresh callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3559 | * |
| 3560 | * 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] | 3561 | * 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] | 3562 | * if the window has been exposed after having been covered by another window. |
| 3563 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3564 | * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where |
| 3565 | * the window contents are saved off-screen, this callback may be called only |
| 3566 | * very infrequently or never at all. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3567 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3568 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3569 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3570 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3571 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3572 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3573 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3574 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3575 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3576 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3577 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3578 | * @sa @ref window_refresh |
| 3579 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3580 | * @since Added in version 2.5. |
| 3581 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 3582 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3583 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3584 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3585 | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3586 | |
| 3587 | /*! @brief Sets the focus callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3588 | * |
| 3589 | * This function sets the focus callback of the specified window, which is |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3590 | * called when the window gains or loses input focus. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3591 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3592 | * After the focus callback is called for a window that lost input focus, |
| 3593 | * synthetic key and mouse button release events will be generated for all such |
| 3594 | * that had been pressed. For more information, see @ref glfwSetKeyCallback |
| 3595 | * and @ref glfwSetMouseButtonCallback. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 3596 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3597 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3598 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3599 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3600 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3601 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3602 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3603 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3604 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3605 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3606 | * |
| 3607 | * @sa @ref window_focus |
| 3608 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3609 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3610 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3611 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3612 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3613 | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3614 | |
| 3615 | /*! @brief Sets the iconify callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3616 | * |
| 3617 | * This function sets the iconification callback of the specified window, which |
| 3618 | * is called when the window is iconified or restored. |
| 3619 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3620 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3621 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3622 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3623 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3624 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3625 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3626 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3627 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3628 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3629 | * |
| 3630 | * @sa @ref window_iconify |
| 3631 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3632 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3633 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3634 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3635 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3636 | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 3637 | |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 3638 | /*! @brief Sets the maximize callback for the specified window. |
| 3639 | * |
| 3640 | * This function sets the maximization callback of the specified window, which |
| 3641 | * is called when the window is maximized or restored. |
| 3642 | * |
| 3643 | * @param[in] window The window whose callback to set. |
| 3644 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3645 | * callback. |
| 3646 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3647 | * library had not been [initialized](@ref intro_init). |
| 3648 | * |
| 3649 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3650 | * |
| 3651 | * @thread_safety This function must only be called from the main thread. |
| 3652 | * |
| 3653 | * @sa @ref window_maximize |
| 3654 | * |
| 3655 | * @since Added in version 3.3. |
| 3656 | * |
| 3657 | * @ingroup window |
| 3658 | */ |
| 3659 | GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun); |
| 3660 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3661 | /*! @brief Sets the framebuffer resize callback for the specified window. |
| 3662 | * |
| 3663 | * This function sets the framebuffer resize callback of the specified window, |
| 3664 | * which is called when the framebuffer of the specified window is resized. |
| 3665 | * |
| 3666 | * @param[in] window The window whose callback to set. |
| 3667 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3668 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3669 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3670 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3671 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3672 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3673 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3674 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3675 | * |
| 3676 | * @sa @ref window_fbsize |
| 3677 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3678 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3679 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3680 | * @ingroup window |
| 3681 | */ |
| 3682 | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun); |
| 3683 | |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 3684 | /*! @brief Sets the window content scale callback for the specified window. |
| 3685 | * |
| 3686 | * This function sets the window content scale callback of the specified window, |
| 3687 | * which is called when the content scale of the specified window changes. |
| 3688 | * |
| 3689 | * @param[in] window The window whose callback to set. |
| 3690 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3691 | * callback. |
| 3692 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3693 | * library had not been [initialized](@ref intro_init). |
| 3694 | * |
| 3695 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3696 | * |
| 3697 | * @thread_safety This function must only be called from the main thread. |
| 3698 | * |
| 3699 | * @sa @ref window_scale |
| 3700 | * @sa @ref glfwGetWindowContentScale |
| 3701 | * |
| 3702 | * @since Added in version 3.3. |
| 3703 | * |
| 3704 | * @ingroup window |
| 3705 | */ |
| 3706 | GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun cbfun); |
| 3707 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3708 | /*! @brief Processes all pending events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3709 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3710 | * This function processes only those events that are already in the event |
| 3711 | * queue and then returns immediately. Processing events will cause the window |
| 3712 | * and input callbacks associated with those events to be called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3713 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3714 | * On some platforms, a window move, resize or menu operation will cause event |
| 3715 | * processing to block. This is due to how event processing is designed on |
| 3716 | * those platforms. You can use the |
| 3717 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3718 | * your window when necessary during such operations. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3719 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3720 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3721 | * event processing functions like this one. While it is necessary to poll for |
| 3722 | * events, window systems that require GLFW to register callbacks of its own |
| 3723 | * can pass events to GLFW in response to many window system function calls. |
| 3724 | * GLFW will pass those events on to the application callbacks before |
| 3725 | * returning. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 3726 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3727 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3728 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3729 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3730 | * GLFW_PLATFORM_ERROR. |
| 3731 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3732 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 3733 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3734 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 3735 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3736 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3737 | * @sa @ref glfwWaitEvents |
| 3738 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3739 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3740 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3741 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3742 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3743 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 3744 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3745 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3746 | /*! @brief Waits until events are queued and processes them. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3747 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3748 | * This function puts the calling thread to sleep until at least one event is |
| 3749 | * available in the event queue. Once one or more events are available, |
| 3750 | * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue |
| 3751 | * are processed and the function then returns immediately. Processing events |
| 3752 | * will cause the window and input callbacks associated with those events to be |
| 3753 | * called. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 3754 | * |
| 3755 | * Since not all events are associated with callbacks, this function may return |
| 3756 | * without a callback having been called even if you are monitoring all |
| 3757 | * callbacks. |
| 3758 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3759 | * On some platforms, a window move, resize or menu operation will cause event |
| 3760 | * processing to block. This is due to how event processing is designed on |
| 3761 | * those platforms. You can use the |
| 3762 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3763 | * your window when necessary during such operations. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3764 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3765 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3766 | * event processing functions like this one. While it is necessary to poll for |
| 3767 | * events, window systems that require GLFW to register callbacks of its own |
| 3768 | * can pass events to GLFW in response to many window system function calls. |
| 3769 | * GLFW will pass those events on to the application callbacks before |
| 3770 | * returning. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3771 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3772 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3773 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3774 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3775 | * GLFW_PLATFORM_ERROR. |
| 3776 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3777 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 3778 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3779 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3780 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3781 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3782 | * @sa @ref glfwPollEvents |
| 3783 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3784 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3785 | * @since Added in version 2.5. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3786 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3787 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3788 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 3789 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 3790 | |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3791 | /*! @brief Waits with timeout until events are queued and processes them. |
| 3792 | * |
| 3793 | * This function puts the calling thread to sleep until at least one event is |
| 3794 | * available in the event queue, or until the specified timeout is reached. If |
| 3795 | * one or more events are available, it behaves exactly like @ref |
| 3796 | * glfwPollEvents, i.e. the events in the queue are processed and the function |
| 3797 | * then returns immediately. Processing events will cause the window and input |
| 3798 | * callbacks associated with those events to be called. |
| 3799 | * |
| 3800 | * The timeout value must be a positive finite number. |
| 3801 | * |
| 3802 | * Since not all events are associated with callbacks, this function may return |
| 3803 | * without a callback having been called even if you are monitoring all |
| 3804 | * callbacks. |
| 3805 | * |
| 3806 | * On some platforms, a window move, resize or menu operation will cause event |
| 3807 | * processing to block. This is due to how event processing is designed on |
| 3808 | * those platforms. You can use the |
| 3809 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3810 | * your window when necessary during such operations. |
| 3811 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3812 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3813 | * event processing functions like this one. While it is necessary to poll for |
| 3814 | * events, window systems that require GLFW to register callbacks of its own |
| 3815 | * can pass events to GLFW in response to many window system function calls. |
| 3816 | * GLFW will pass those events on to the application callbacks before |
| 3817 | * returning. |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3818 | * |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3819 | * Event processing is not required for joystick input to work. |
| 3820 | * |
| 3821 | * @param[in] timeout The maximum amount of time, in seconds, to wait. |
| 3822 | * |
Sylvain Boilard | 3b255af | 2018-09-13 16:23:44 +0200 | [diff] [blame] | 3823 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 8e313d9 | 2018-12-13 20:33:17 +0100 | [diff] [blame] | 3824 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Sylvain Boilard | 3b255af | 2018-09-13 16:23:44 +0200 | [diff] [blame] | 3825 | * |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3826 | * @reentrancy This function must not be called from a callback. |
| 3827 | * |
| 3828 | * @thread_safety This function must only be called from the main thread. |
| 3829 | * |
| 3830 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3831 | * @sa @ref glfwPollEvents |
| 3832 | * @sa @ref glfwWaitEvents |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3833 | * |
| 3834 | * @since Added in version 3.2. |
| 3835 | * |
| 3836 | * @ingroup window |
| 3837 | */ |
| 3838 | GLFWAPI void glfwWaitEventsTimeout(double timeout); |
| 3839 | |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3840 | /*! @brief Posts an empty event to the event queue. |
| 3841 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3842 | * 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] | 3843 | * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3844 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3845 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3846 | * GLFW_PLATFORM_ERROR. |
| 3847 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3848 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3849 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3850 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3851 | * @sa @ref glfwWaitEvents |
| 3852 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3853 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3854 | * @since Added in version 3.1. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3855 | * |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3856 | * @ingroup window |
| 3857 | */ |
| 3858 | GLFWAPI void glfwPostEmptyEvent(void); |
| 3859 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3860 | /*! @brief Returns the value of an input option for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3861 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3862 | * 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] | 3863 | * 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] | 3864 | * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3865 | * @ref GLFW_RAW_MOUSE_MOTION. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3866 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3867 | * @param[in] window The window to query. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3868 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3869 | * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or |
| 3870 | * `GLFW_RAW_MOUSE_MOTION`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3871 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3872 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3873 | * GLFW_INVALID_ENUM. |
| 3874 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3875 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3876 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3877 | * @sa @ref glfwSetInputMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3878 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3879 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3880 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3881 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3882 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3883 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3884 | |
| 3885 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3886 | * |
| 3887 | * 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] | 3888 | * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3889 | * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3890 | * @ref GLFW_RAW_MOUSE_MOTION. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3891 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3892 | * 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] | 3893 | * modes: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 3894 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3895 | * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the |
| 3896 | * 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] | 3897 | * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual |
| 3898 | * and unlimited cursor movement. This is useful for implementing for |
| 3899 | * example 3D camera controls. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3900 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 3901 | * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to |
| 3902 | * 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] | 3903 | * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` |
| 3904 | * the next time it is called even if the key had been released before the |
| 3905 | * call. This is useful when you are only interested in whether keys have been |
| 3906 | * pressed but not when or in which order. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3907 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3908 | * 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] | 3909 | * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. |
| 3910 | * If sticky mouse buttons are enabled, a mouse button press will ensure that |
| 3911 | * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even |
| 3912 | * if the mouse button had been released before the call. This is useful when |
| 3913 | * you are only interested in whether mouse buttons have been pressed but not |
| 3914 | * when or in which order. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3915 | * |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3916 | * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to |
| 3917 | * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled, |
| 3918 | * callbacks that receive modifier bits will also have the @ref |
| 3919 | * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on, |
| 3920 | * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on. |
| 3921 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3922 | * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE` |
| 3923 | * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is |
| 3924 | * disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported, |
| 3925 | * attempting to set this will emit @ref GLFW_PLATFORM_ERROR. Call @ref |
| 3926 | * glfwRawMouseMotionSupported to check for support. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3927 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3928 | * @param[in] window The window whose input mode to set. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3929 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3930 | * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or |
| 3931 | * `GLFW_RAW_MOUSE_MOTION`. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3932 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3933 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3934 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3935 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 3936 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3937 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3938 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3939 | * @sa @ref glfwGetInputMode |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3940 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3941 | * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3942 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3943 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3944 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3945 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3946 | |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3947 | /*! @brief Returns whether raw mouse motion is supported. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3948 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3949 | * This function returns whether raw mouse motion is supported on the current |
| 3950 | * system. This status does not change after GLFW has been initialized so you |
| 3951 | * only need to check this once. If you attempt to enable raw motion on |
| 3952 | * 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] | 3953 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3954 | * Raw mouse motion is closer to the actual motion of the mouse across |
| 3955 | * a surface. It is not affected by the scaling and acceleration applied to |
| 3956 | * the motion of the desktop cursor. That processing is suitable for a cursor |
| 3957 | * while raw motion is better for controlling for example a 3D camera. Because |
| 3958 | * 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] | 3959 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3960 | * @return `GLFW_TRUE` if raw mouse motion is supported on the current machine, |
| 3961 | * or `GLFW_FALSE` otherwise. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3962 | * |
| 3963 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3964 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3965 | * @thread_safety This function must only be called from the main thread. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3966 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3967 | * @sa @ref raw_mouse_motion |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3968 | * @sa @ref glfwSetInputMode |
| 3969 | * |
| 3970 | * @since Added in version 3.3. |
| 3971 | * |
| 3972 | * @ingroup input |
| 3973 | */ |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3974 | GLFWAPI int glfwRawMouseMotionSupported(void); |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3975 | |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 3976 | /*! @brief Returns the layout-specific name of the specified printable key. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3977 | * |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 3978 | * This function returns the name of the specified printable key, encoded as |
| 3979 | * UTF-8. This is typically the character that key would produce without any |
| 3980 | * modifier keys, intended for displaying key bindings to the user. For dead |
| 3981 | * keys, it is typically the diacritic it would add to a character. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3982 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 3983 | * __Do not use this function__ for [text input](@ref input_char). You will |
| 3984 | * 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] | 3985 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 3986 | * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key, |
| 3987 | * otherwise the scancode is ignored. If you specify a non-printable key, or |
| 3988 | * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this |
| 3989 | * function returns `NULL` but does not emit an error. |
| 3990 | * |
| 3991 | * This behavior allows you to always pass in the arguments in the |
Camilla Berglund | 70ffae7 | 2016-02-22 11:54:56 +0100 | [diff] [blame] | 3992 | * [key callback](@ref input_key) without modification. |
| 3993 | * |
| 3994 | * The printable keys are: |
| 3995 | * - `GLFW_KEY_APOSTROPHE` |
| 3996 | * - `GLFW_KEY_COMMA` |
| 3997 | * - `GLFW_KEY_MINUS` |
| 3998 | * - `GLFW_KEY_PERIOD` |
| 3999 | * - `GLFW_KEY_SLASH` |
| 4000 | * - `GLFW_KEY_SEMICOLON` |
| 4001 | * - `GLFW_KEY_EQUAL` |
| 4002 | * - `GLFW_KEY_LEFT_BRACKET` |
| 4003 | * - `GLFW_KEY_RIGHT_BRACKET` |
| 4004 | * - `GLFW_KEY_BACKSLASH` |
| 4005 | * - `GLFW_KEY_WORLD_1` |
| 4006 | * - `GLFW_KEY_WORLD_2` |
| 4007 | * - `GLFW_KEY_0` to `GLFW_KEY_9` |
| 4008 | * - `GLFW_KEY_A` to `GLFW_KEY_Z` |
| 4009 | * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9` |
| 4010 | * - `GLFW_KEY_KP_DECIMAL` |
| 4011 | * - `GLFW_KEY_KP_DIVIDE` |
| 4012 | * - `GLFW_KEY_KP_MULTIPLY` |
| 4013 | * - `GLFW_KEY_KP_SUBTRACT` |
| 4014 | * - `GLFW_KEY_KP_ADD` |
| 4015 | * - `GLFW_KEY_KP_EQUAL` |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4016 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 4017 | * Names for printable keys depend on keyboard layout, while names for |
| 4018 | * non-printable keys are the same across layouts but depend on the application |
| 4019 | * language and should be localized along with other user interface text. |
| 4020 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4021 | * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`. |
| 4022 | * @param[in] scancode The scancode of the key to query. |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 4023 | * @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] | 4024 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4025 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4026 | * GLFW_PLATFORM_ERROR. |
| 4027 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4028 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4029 | * should not free it yourself. It is valid until the next call to @ref |
| 4030 | * glfwGetKeyName, or until the library is terminated. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4031 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4032 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4033 | * |
| 4034 | * @sa @ref input_key_name |
| 4035 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4036 | * @since Added in version 3.2. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4037 | * |
| 4038 | * @ingroup input |
| 4039 | */ |
| 4040 | GLFWAPI const char* glfwGetKeyName(int key, int scancode); |
| 4041 | |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4042 | /*! @brief Returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4043 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4044 | * This function returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4045 | * |
| 4046 | * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this |
| 4047 | * method will return `-1`. |
| 4048 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4049 | * @param[in] key Any [named key](@ref keys). |
| 4050 | * @return The platform-specific scancode for the key, or `-1` if an |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4051 | * [error](@ref error_handling) occurred. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4052 | * |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4053 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4054 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4055 | * |
| 4056 | * @thread_safety This function may be called from any thread. |
| 4057 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4058 | * @sa @ref input_key |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4059 | * |
| 4060 | * @since Added in version 3.3. |
| 4061 | * |
| 4062 | * @ingroup input |
| 4063 | */ |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4064 | GLFWAPI int glfwGetKeyScancode(int key); |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4065 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4066 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 4067 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4068 | * |
| 4069 | * This function returns the last state reported for the specified key to the |
| 4070 | * specified window. The returned state is one of `GLFW_PRESS` or |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4071 | * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4072 | * the key callback. |
| 4073 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4074 | * 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] | 4075 | * `GLFW_PRESS` the first time you call it for a key that was pressed, even if |
| 4076 | * that key has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4077 | * |
| 4078 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 4079 | * named after their use on the standard US keyboard layout. If you want to |
| 4080 | * input text, use the Unicode character callback instead. |
| 4081 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4082 | * The [modifier key bit masks](@ref mods) are not key tokens and cannot be |
| 4083 | * used with this function. |
| 4084 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4085 | * __Do not use this function__ to implement [text input](@ref input_char). |
| 4086 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4087 | * @param[in] window The desired window. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4088 | * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is |
| 4089 | * not a valid key for this function. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4090 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4091 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4092 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4093 | * GLFW_INVALID_ENUM. |
| 4094 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4095 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4096 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4097 | * @sa @ref input_key |
| 4098 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4099 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4100 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 4101 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4102 | * @ingroup input |
| 4103 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4104 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4105 | |
| 4106 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 4107 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4108 | * |
| 4109 | * This function returns the last state reported for the specified mouse button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4110 | * 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] | 4111 | * `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4112 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4113 | * 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] | 4114 | * returns `GLFW_PRESS` the first time you call it for a mouse button that was |
| 4115 | * pressed, even if that mouse button has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4116 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4117 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4118 | * @param[in] button The desired [mouse button](@ref buttons). |
| 4119 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4120 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4121 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4122 | * GLFW_INVALID_ENUM. |
| 4123 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4124 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4125 | * |
| 4126 | * @sa @ref input_mouse_button |
| 4127 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4128 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4129 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4130 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4131 | * @ingroup input |
| 4132 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4133 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4134 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4135 | /*! @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] | 4136 | * the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4137 | * |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 4138 | * This function returns the position of the cursor, in screen coordinates, |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4139 | * 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] | 4140 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4141 | * |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4142 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
| 4143 | * position is unbounded and limited only by the minimum and maximum values of |
| 4144 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4145 | * |
Camilla Berglund | 3ec2925 | 2013-04-25 18:03:15 +0200 | [diff] [blame] | 4146 | * The coordinate can be converted to their integer equivalents with the |
| 4147 | * `floor` function. Casting directly to an integer type works for positive |
| 4148 | * coordinates, but fails for negative ones. |
| 4149 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4150 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 4151 | * non-`NULL` position arguments will be set to zero. |
| 4152 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4153 | * @param[in] window The desired window. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4154 | * @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] | 4155 | * left edge of the content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4156 | * @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] | 4157 | * top edge of the content area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4158 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4159 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4160 | * GLFW_PLATFORM_ERROR. |
| 4161 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4162 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4163 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4164 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4165 | * @sa @ref glfwSetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4166 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4167 | * @since Added in version 3.0. Replaces `glfwGetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4168 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4169 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4170 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4171 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4172 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4173 | /*! @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] | 4174 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4175 | * |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 4176 | * This function sets the position, in screen coordinates, of the cursor |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4177 | * 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] | 4178 | * window. The window must have input focus. If the window does not have |
| 4179 | * input focus when this function is called, it fails silently. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4180 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 4181 | * __Do not use this function__ to implement things like camera controls. GLFW |
| 4182 | * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the |
| 4183 | * cursor, transparently re-centers it and provides unconstrained cursor |
| 4184 | * motion. See @ref glfwSetInputMode for more information. |
| 4185 | * |
| 4186 | * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is |
| 4187 | * unconstrained and limited only by the minimum and maximum values of |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4188 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4189 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4190 | * @param[in] window The desired window. |
| 4191 | * @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] | 4192 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4193 | * @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] | 4194 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4195 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4196 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4197 | * GLFW_PLATFORM_ERROR. |
| 4198 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4199 | * @remark @wayland This function will only work when the cursor mode is |
| 4200 | * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing. |
| 4201 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4202 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4203 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4204 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4205 | * @sa @ref glfwGetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4206 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4207 | * @since Added in version 3.0. Replaces `glfwSetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4208 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4209 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4210 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4211 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4212 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4213 | /*! @brief Creates a custom cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4214 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4215 | * Creates a new custom cursor image that can be set for a window with @ref |
| 4216 | * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. |
| 4217 | * Any remaining cursors are destroyed by @ref glfwTerminate. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4218 | * |
Camilla Berglund | 85a01bf | 2015-08-17 21:04:19 +0200 | [diff] [blame] | 4219 | * 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] | 4220 | * bits per channel with the red channel first. They are arranged canonically |
| 4221 | * as packed sequential rows, starting from the top-left corner. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4222 | * |
| 4223 | * The cursor hotspot is specified in pixels, relative to the upper-left corner |
| 4224 | * of the cursor image. Like all other coordinate systems in GLFW, the X-axis |
| 4225 | * points to the right and the Y-axis points down. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4226 | * |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 4227 | * @param[in] image The desired cursor image. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4228 | * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. |
| 4229 | * @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] | 4230 | * @return The handle of the created cursor, or `NULL` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4231 | * [error](@ref error_handling) occurred. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4232 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4233 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4234 | * GLFW_PLATFORM_ERROR. |
| 4235 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4236 | * @pointer_lifetime The specified image data is copied before this function |
| 4237 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4238 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4239 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4240 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4241 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4242 | * @sa @ref glfwDestroyCursor |
| 4243 | * @sa @ref glfwCreateStandardCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4244 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4245 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4246 | * |
| 4247 | * @ingroup input |
| 4248 | */ |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 4249 | GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4250 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4251 | /*! @brief Creates a cursor with a standard shape. |
| 4252 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4253 | * Returns a cursor with a [standard shape](@ref shapes), that can be set for |
| 4254 | * a window with @ref glfwSetCursor. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4255 | * |
| 4256 | * @param[in] shape One of the [standard shapes](@ref shapes). |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4257 | * @return A new cursor ready to use or `NULL` if an |
| 4258 | * [error](@ref error_handling) occurred. |
| 4259 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4260 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4261 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4262 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4263 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4264 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4265 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4266 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4267 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4268 | * @since Added in version 3.1. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4269 | * |
| 4270 | * @ingroup input |
| 4271 | */ |
| 4272 | GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); |
| 4273 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4274 | /*! @brief Destroys a cursor. |
| 4275 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4276 | * This function destroys a cursor previously created with @ref |
| 4277 | * glfwCreateCursor. Any remaining cursors will be destroyed by @ref |
| 4278 | * glfwTerminate. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4279 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4280 | * If the specified cursor is current for any window, that window will be |
| 4281 | * reverted to the default cursor. This does not affect the cursor mode. |
| 4282 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4283 | * @param[in] cursor The cursor object to destroy. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4284 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4285 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4286 | * GLFW_PLATFORM_ERROR. |
| 4287 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4288 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4289 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4290 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4291 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4292 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4293 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4294 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4295 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4296 | * |
| 4297 | * @ingroup input |
| 4298 | */ |
| 4299 | GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); |
| 4300 | |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4301 | /*! @brief Sets the cursor for the window. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4302 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4303 | * 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] | 4304 | * 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] | 4305 | * when the [cursor mode](@ref cursor_mode) of the window is |
| 4306 | * `GLFW_CURSOR_NORMAL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4307 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4308 | * On some platforms, the set cursor may not be visible unless the window also |
| 4309 | * has input focus. |
| 4310 | * |
| 4311 | * @param[in] window The window to set the cursor for. |
| 4312 | * @param[in] cursor The cursor to set, or `NULL` to switch back to the default |
| 4313 | * arrow cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4314 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4315 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4316 | * GLFW_PLATFORM_ERROR. |
| 4317 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4318 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4319 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4320 | * @sa @ref cursor_object |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4321 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4322 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4323 | * |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4324 | * @ingroup input |
| 4325 | */ |
| 4326 | GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); |
| 4327 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4328 | /*! @brief Sets the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4329 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4330 | * 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] | 4331 | * when a key is pressed, repeated or released. |
| 4332 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4333 | * The key functions deal with physical keys, with layout independent |
| 4334 | * [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] | 4335 | * layout. If you want to input text, use the |
| 4336 | * [character callback](@ref glfwSetCharCallback) instead. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4337 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4338 | * When a window loses input focus, it will generate synthetic key release |
| 4339 | * events for all pressed keys. You can tell these events from user-generated |
| 4340 | * events by the fact that the synthetic ones are generated after the focus |
| 4341 | * loss event has been processed, i.e. after the |
| 4342 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 4343 | * |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 4344 | * The scancode of a key is specific to that platform or sometimes even to that |
| 4345 | * machine. Scancodes are intended to allow users to bind keys that don't have |
| 4346 | * 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] | 4347 | * 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] | 4348 | * |
| 4349 | * Sometimes GLFW needs to generate synthetic key events, in which case the |
| 4350 | * scancode may be zero. |
| 4351 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4352 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4353 | * @param[in] cbfun The new key callback, or `NULL` to remove the currently |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4354 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4355 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4356 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4357 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4358 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4359 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4360 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4361 | * |
| 4362 | * @sa @ref input_key |
| 4363 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4364 | * @since Added in version 1.0. |
| 4365 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4366 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4367 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4368 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4369 | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4370 | |
| 4371 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4372 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4373 | * This function sets the character callback of the specified window, which is |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4374 | * called when a Unicode character is input. |
| 4375 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4376 | * The character callback is intended for Unicode text input. As it deals with |
| 4377 | * characters, it is keyboard layout dependent, whereas the |
| 4378 | * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 |
| 4379 | * to physical keys, as a key may produce zero, one or more characters. If you |
| 4380 | * want to know whether a specific physical key was pressed or released, see |
| 4381 | * the key callback instead. |
| 4382 | * |
| 4383 | * The character callback behaves as system text input normally does and will |
| 4384 | * 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] | 4385 | * 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] | 4386 | * on Windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4387 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4388 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4389 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 4390 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4391 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4392 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4393 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4394 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4395 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4396 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4397 | * |
| 4398 | * @sa @ref input_char |
| 4399 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4400 | * @since Added in version 2.4. |
| 4401 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4402 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4403 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4404 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4405 | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4406 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4407 | /*! @brief Sets the Unicode character with modifiers callback. |
| 4408 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4409 | * This function sets the character with modifiers callback of the specified |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4410 | * window, which is called when a Unicode character is input regardless of what |
| 4411 | * modifier keys are used. |
| 4412 | * |
| 4413 | * The character with modifiers callback is intended for implementing custom |
| 4414 | * Unicode character input. For regular Unicode text input, see the |
| 4415 | * [character callback](@ref glfwSetCharCallback). Like the character |
| 4416 | * callback, the character with modifiers callback deals with characters and is |
| 4417 | * keyboard layout dependent. Characters do not map 1:1 to physical keys, as |
| 4418 | * a key may produce zero, one or more characters. If you want to know whether |
| 4419 | * a specific physical key was pressed or released, see the |
| 4420 | * [key callback](@ref glfwSetKeyCallback) instead. |
| 4421 | * |
| 4422 | * @param[in] window The window whose callback to set. |
| 4423 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 4424 | * callback. |
| 4425 | * @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] | 4426 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4427 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 4428 | * @deprecated Scheduled for removal in version 4.0. |
| 4429 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4430 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4431 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4432 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4433 | * |
| 4434 | * @sa @ref input_char |
| 4435 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4436 | * @since Added in version 3.1. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4437 | * |
| 4438 | * @ingroup input |
| 4439 | */ |
| 4440 | GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun); |
| 4441 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4442 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4443 | * |
| 4444 | * This function sets the mouse button callback of the specified window, which |
| 4445 | * is called when a mouse button is pressed or released. |
| 4446 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4447 | * When a window loses input focus, it will generate synthetic mouse button |
| 4448 | * release events for all pressed mouse buttons. You can tell these events |
| 4449 | * from user-generated events by the fact that the synthetic ones are generated |
| 4450 | * after the focus loss event has been processed, i.e. after the |
| 4451 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 4452 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4453 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4454 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 4455 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4456 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4457 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4458 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4459 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4460 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4461 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4462 | * |
| 4463 | * @sa @ref input_mouse_button |
| 4464 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4465 | * @since Added in version 1.0. |
| 4466 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4467 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4468 | * @ingroup input |
| 4469 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4470 | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4471 | |
| 4472 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4473 | * |
| 4474 | * This function sets the cursor position callback of the specified window, |
| 4475 | * 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] | 4476 | * 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] | 4477 | * content area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4478 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4479 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4480 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 4481 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4482 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4483 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4484 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4485 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4486 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4487 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4488 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4489 | * @sa @ref cursor_pos |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4490 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4491 | * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4492 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4493 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4494 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4495 | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4496 | |
| 4497 | /*! @brief Sets the cursor enter/exit callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4498 | * |
| 4499 | * This function sets the cursor boundary crossing callback of the specified |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4500 | * 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] | 4501 | * the window. |
| 4502 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4503 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4504 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 4505 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4506 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4507 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4508 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4509 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4510 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4511 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4512 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4513 | * @sa @ref cursor_enter |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4514 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4515 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4516 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4517 | * @ingroup input |
| 4518 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4519 | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4520 | |
| 4521 | /*! @brief Sets the scroll callback. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4522 | * |
| 4523 | * This function sets the scroll callback of the specified window, which is |
| 4524 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
| 4525 | * area of a touchpad. |
| 4526 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4527 | * The scroll callback receives all scrolling input, like that from a mouse |
| 4528 | * wheel or a touchpad scrolling area. |
| 4529 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4530 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4531 | * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4532 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4533 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4534 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4535 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4536 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4537 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4538 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4539 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4540 | * @sa @ref scrolling |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4541 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4542 | * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4543 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4544 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4545 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4546 | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4547 | |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4548 | /*! @brief Sets the file drop callback. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4549 | * |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4550 | * This function sets the file drop callback of the specified window, which is |
| 4551 | * called when one or more dragged files are dropped on the window. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4552 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4553 | * Because the path array and its strings may have been generated specifically |
| 4554 | * for that event, they are not guaranteed to be valid after the callback has |
| 4555 | * returned. If you wish to use them after the callback returns, you need to |
| 4556 | * make a deep copy. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4557 | * |
| 4558 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4559 | * @param[in] cbfun The new file drop callback, or `NULL` to remove the |
| 4560 | * currently set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4561 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4562 | * library had not been [initialized](@ref intro_init). |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4563 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4564 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4565 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4566 | * @remark @wayland File drop is currently unimplemented. |
| 4567 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4568 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4569 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4570 | * @sa @ref path_drop |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4571 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4572 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4573 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4574 | * @ingroup input |
| 4575 | */ |
| 4576 | GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun); |
| 4577 | |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 4578 | /*! @brief Returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4579 | * |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 4580 | * This function returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4581 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4582 | * There is no need to call this function before other functions that accept |
| 4583 | * a joystick ID, as they all check for presence before performing any other |
| 4584 | * work. |
| 4585 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4586 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 4587 | * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4588 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4589 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4590 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4591 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4592 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4593 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4594 | * @sa @ref joystick |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4595 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4596 | * @since Added in version 3.0. Replaces `glfwGetJoystickParam`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4597 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4598 | * @ingroup input |
| 4599 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4600 | GLFWAPI int glfwJoystickPresent(int jid); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4601 | |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4602 | /*! @brief Returns the values of all axes of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4603 | * |
| 4604 | * This function returns the values of all axes of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4605 | * 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] | 4606 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4607 | * 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] | 4608 | * but will not generate an error. This can be used instead of first calling |
| 4609 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4610 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4611 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4612 | * @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] | 4613 | * array. This is set to zero if the joystick is not present or an error |
| 4614 | * occurred. |
| 4615 | * @return An array of axis values, or `NULL` if the joystick is not present or |
| 4616 | * an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4617 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4618 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4619 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4620 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4621 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 4622 | * 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] | 4623 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4624 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4625 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4626 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4627 | * @sa @ref joystick_axis |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4628 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4629 | * @since Added in version 3.0. Replaces `glfwGetJoystickPos`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4630 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4631 | * @ingroup input |
| 4632 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4633 | GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4634 | |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 4635 | /*! @brief Returns the state of all buttons of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4636 | * |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 4637 | * This function returns the state of all buttons of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4638 | * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4639 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4640 | * For backward compatibility with earlier versions that did not have @ref |
| 4641 | * glfwGetJoystickHats, the button array also includes all hats, each |
| 4642 | * represented as four buttons. The hats are in the same order as returned by |
| 4643 | * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and |
| 4644 | * _left_. To disable these extra buttons, set the @ref |
| 4645 | * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization. |
| 4646 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4647 | * 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] | 4648 | * but will not generate an error. This can be used instead of first calling |
| 4649 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4650 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4651 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4652 | * @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] | 4653 | * array. This is set to zero if the joystick is not present or an error |
| 4654 | * occurred. |
| 4655 | * @return An array of button states, or `NULL` if the joystick is not present |
| 4656 | * or an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4657 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4658 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4659 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4660 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4661 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 4662 | * 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] | 4663 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4664 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4665 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4666 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4667 | * @sa @ref joystick_button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4668 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4669 | * @since Added in version 2.2. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4670 | * @glfw3 Changed to return a dynamic array. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4671 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4672 | * @ingroup input |
| 4673 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4674 | GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4675 | |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4676 | /*! @brief Returns the state of all hats of the specified joystick. |
| 4677 | * |
| 4678 | * 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] | 4679 | * Each element in the array is one of the following values: |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4680 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4681 | * Name | Value |
Camilla Löwy | bb2ca1d | 2018-11-27 21:49:19 +0100 | [diff] [blame] | 4682 | * ---- | ----- |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4683 | * `GLFW_HAT_CENTERED` | 0 |
| 4684 | * `GLFW_HAT_UP` | 1 |
| 4685 | * `GLFW_HAT_RIGHT` | 2 |
| 4686 | * `GLFW_HAT_DOWN` | 4 |
| 4687 | * `GLFW_HAT_LEFT` | 8 |
| 4688 | * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` |
| 4689 | * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` |
| 4690 | * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` |
| 4691 | * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4692 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4693 | * The diagonal directions are bitwise combinations of the primary (up, right, |
| 4694 | * down and left) directions and you can test for these individually by ANDing |
| 4695 | * it with the corresponding direction. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4696 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4697 | * @code |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 4698 | * if (hats[2] & GLFW_HAT_RIGHT) |
| 4699 | * { |
| 4700 | * // State of hat 2 could be right-up, right or right-down |
| 4701 | * } |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4702 | * @endcode |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4703 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4704 | * 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] | 4705 | * but will not generate an error. This can be used instead of first calling |
| 4706 | * @ref glfwJoystickPresent. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4707 | * |
| 4708 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4709 | * @param[out] count Where to store the number of hat states in the returned |
| 4710 | * array. This is set to zero if the joystick is not present or an error |
| 4711 | * occurred. |
| 4712 | * @return An array of hat states, or `NULL` if the joystick is not present |
| 4713 | * or an [error](@ref error_handling) occurred. |
| 4714 | * |
| 4715 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4716 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4717 | * |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4718 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 4719 | * should not free it yourself. It is valid until the specified joystick is |
| 4720 | * disconnected, this function is called again for that joystick or the library |
| 4721 | * is terminated. |
| 4722 | * |
| 4723 | * @thread_safety This function must only be called from the main thread. |
| 4724 | * |
| 4725 | * @sa @ref joystick_hat |
| 4726 | * |
| 4727 | * @since Added in version 3.3. |
| 4728 | * |
| 4729 | * @ingroup input |
| 4730 | */ |
| 4731 | GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count); |
| 4732 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 4733 | /*! @brief Returns the name of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4734 | * |
| 4735 | * 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] | 4736 | * The returned string is allocated and freed by GLFW. You should not free it |
| 4737 | * yourself. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4738 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4739 | * 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] | 4740 | * but will not generate an error. This can be used instead of first calling |
| 4741 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4742 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4743 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4744 | * @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] | 4745 | * is not present or an [error](@ref error_handling) occurred. |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 4746 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4747 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4748 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4749 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4750 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4751 | * 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] | 4752 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4753 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4754 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4755 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4756 | * @sa @ref joystick_name |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4757 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4758 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4759 | * |
| 4760 | * @ingroup input |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 4761 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4762 | GLFWAPI const char* glfwGetJoystickName(int jid); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4763 | |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4764 | /*! @brief Returns the SDL comaptible GUID of the specified joystick. |
| 4765 | * |
| 4766 | * This function returns the SDL compatible GUID, as a UTF-8 encoded |
| 4767 | * hexadecimal string, of the specified joystick. The returned string is |
| 4768 | * allocated and freed by GLFW. You should not free it yourself. |
| 4769 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4770 | * The GUID is what connects a joystick to a gamepad mapping. A connected |
| 4771 | * joystick will always have a GUID even if there is no gamepad mapping |
| 4772 | * assigned to it. |
| 4773 | * |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4774 | * 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] | 4775 | * but will not generate an error. This can be used instead of first calling |
| 4776 | * @ref glfwJoystickPresent. |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4777 | * |
| 4778 | * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to |
| 4779 | * uniquely identify the make and model of a joystick but does not identify |
| 4780 | * a specific unit, e.g. all wired Xbox 360 controllers will have the same |
| 4781 | * GUID on that platform. The GUID for a unit may vary between platforms |
| 4782 | * depending on what hardware information the platform specific APIs provide. |
| 4783 | * |
| 4784 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4785 | * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick |
| 4786 | * is not present or an [error](@ref error_handling) occurred. |
| 4787 | * |
| 4788 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4789 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4790 | * |
| 4791 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4792 | * should not free it yourself. It is valid until the specified joystick is |
| 4793 | * disconnected or the library is terminated. |
| 4794 | * |
| 4795 | * @thread_safety This function must only be called from the main thread. |
| 4796 | * |
| 4797 | * @sa @ref gamepad |
| 4798 | * |
| 4799 | * @since Added in version 3.3. |
| 4800 | * |
| 4801 | * @ingroup input |
| 4802 | */ |
| 4803 | GLFWAPI const char* glfwGetJoystickGUID(int jid); |
| 4804 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 4805 | /*! @brief Sets the user pointer of the specified joystick. |
| 4806 | * |
| 4807 | * This function sets the user-defined pointer of the specified joystick. The |
| 4808 | * current value is retained until the joystick is disconnected. The initial |
| 4809 | * value is `NULL`. |
| 4810 | * |
| 4811 | * This function may be called from the joystick callback, even for a joystick |
| 4812 | * that is being disconnected. |
| 4813 | * |
Camilla Löwy | d222a40 | 2018-02-25 20:37:31 +0100 | [diff] [blame] | 4814 | * @param[in] jid The joystick whose pointer to set. |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 4815 | * @param[in] pointer The new value. |
| 4816 | * |
| 4817 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4818 | * |
| 4819 | * @thread_safety This function may be called from any thread. Access is not |
| 4820 | * synchronized. |
| 4821 | * |
| 4822 | * @sa @ref joystick_userptr |
| 4823 | * @sa @ref glfwGetJoystickUserPointer |
| 4824 | * |
| 4825 | * @since Added in version 3.3. |
| 4826 | * |
| 4827 | * @ingroup input |
| 4828 | */ |
| 4829 | GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer); |
| 4830 | |
| 4831 | /*! @brief Returns the user pointer of the specified joystick. |
| 4832 | * |
| 4833 | * This function returns the current value of the user-defined pointer of the |
| 4834 | * specified joystick. The initial value is `NULL`. |
| 4835 | * |
| 4836 | * This function may be called from the joystick callback, even for a joystick |
| 4837 | * that is being disconnected. |
| 4838 | * |
Camilla Löwy | d222a40 | 2018-02-25 20:37:31 +0100 | [diff] [blame] | 4839 | * @param[in] jid The joystick whose pointer to return. |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 4840 | * |
| 4841 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4842 | * |
| 4843 | * @thread_safety This function may be called from any thread. Access is not |
| 4844 | * synchronized. |
| 4845 | * |
| 4846 | * @sa @ref joystick_userptr |
| 4847 | * @sa @ref glfwSetJoystickUserPointer |
| 4848 | * |
| 4849 | * @since Added in version 3.3. |
| 4850 | * |
| 4851 | * @ingroup input |
| 4852 | */ |
| 4853 | GLFWAPI void* glfwGetJoystickUserPointer(int jid); |
| 4854 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4855 | /*! @brief Returns whether the specified joystick has a gamepad mapping. |
| 4856 | * |
| 4857 | * This function returns whether the specified joystick is both present and has |
| 4858 | * a gamepad mapping. |
| 4859 | * |
| 4860 | * If the specified joystick is present but does not have a gamepad mapping |
| 4861 | * 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] | 4862 | * @ref glfwJoystickPresent to check if a joystick is present regardless of |
| 4863 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4864 | * |
| 4865 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4866 | * @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping, |
| 4867 | * or `GLFW_FALSE` otherwise. |
| 4868 | * |
| 4869 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4870 | * GLFW_INVALID_ENUM. |
| 4871 | * |
| 4872 | * @thread_safety This function must only be called from the main thread. |
| 4873 | * |
| 4874 | * @sa @ref gamepad |
| 4875 | * @sa @ref glfwGetGamepadState |
| 4876 | * |
| 4877 | * @since Added in version 3.3. |
| 4878 | * |
| 4879 | * @ingroup input |
| 4880 | */ |
| 4881 | GLFWAPI int glfwJoystickIsGamepad(int jid); |
| 4882 | |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 4883 | /*! @brief Sets the joystick configuration callback. |
| 4884 | * |
| 4885 | * This function sets the joystick configuration callback, or removes the |
| 4886 | * currently set callback. This is called when a joystick is connected to or |
| 4887 | * disconnected from the system. |
| 4888 | * |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 4889 | * For joystick connection and disconnection events to be delivered on all |
| 4890 | * platforms, you need to call one of the [event processing](@ref events) |
| 4891 | * functions. Joystick disconnection may also be detected and the callback |
| 4892 | * called by joystick functions. The function will then return whatever it |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4893 | * returns if the joystick is not present. |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 4894 | * |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 4895 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 4896 | * callback. |
| 4897 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4898 | * library had not been [initialized](@ref intro_init). |
| 4899 | * |
| 4900 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4901 | * |
| 4902 | * @thread_safety This function must only be called from the main thread. |
| 4903 | * |
| 4904 | * @sa @ref joystick_event |
| 4905 | * |
| 4906 | * @since Added in version 3.2. |
| 4907 | * |
| 4908 | * @ingroup input |
| 4909 | */ |
| 4910 | GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun); |
| 4911 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4912 | /*! @brief Adds the specified SDL_GameControllerDB gamepad mappings. |
| 4913 | * |
| 4914 | * This function parses the specified ASCII encoded string and updates the |
| 4915 | * internal list with any gamepad mappings it finds. This string may |
| 4916 | * contain either a single gamepad mapping or many mappings separated by |
| 4917 | * newlines. The parser supports the full format of the `gamecontrollerdb.txt` |
| 4918 | * source file including empty lines and comments. |
| 4919 | * |
| 4920 | * See @ref gamepad_mapping for a description of the format. |
| 4921 | * |
| 4922 | * If there is already a gamepad mapping for a given GUID in the internal list, |
| 4923 | * it will be replaced by the one passed to this function. If the library is |
| 4924 | * terminated and re-initialized the internal list will revert to the built-in |
| 4925 | * default. |
| 4926 | * |
| 4927 | * @param[in] string The string containing the gamepad mappings. |
| 4928 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
| 4929 | * [error](@ref error_handling) occurred. |
| 4930 | * |
| 4931 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4932 | * GLFW_INVALID_VALUE. |
| 4933 | * |
| 4934 | * @thread_safety This function must only be called from the main thread. |
| 4935 | * |
| 4936 | * @sa @ref gamepad |
| 4937 | * @sa @ref glfwJoystickIsGamepad |
| 4938 | * @sa @ref glfwGetGamepadName |
| 4939 | * |
| 4940 | * @since Added in version 3.3. |
| 4941 | * |
| 4942 | * @ingroup input |
| 4943 | */ |
| 4944 | GLFWAPI int glfwUpdateGamepadMappings(const char* string); |
| 4945 | |
| 4946 | /*! @brief Returns the human-readable gamepad name for the specified joystick. |
| 4947 | * |
| 4948 | * This function returns the human-readable name of the gamepad from the |
| 4949 | * gamepad mapping assigned to the specified joystick. |
| 4950 | * |
| 4951 | * 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] | 4952 | * this function will return `NULL` but will not generate an error. Call |
| 4953 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 4954 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4955 | * |
| 4956 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4957 | * @return The UTF-8 encoded name of the gamepad, or `NULL` if the |
| 4958 | * joystick is not present, does not have a mapping or an |
| 4959 | * [error](@ref error_handling) occurred. |
| 4960 | * |
| 4961 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4962 | * should not free it yourself. It is valid until the specified joystick is |
| 4963 | * disconnected, the gamepad mappings are updated or the library is terminated. |
| 4964 | * |
| 4965 | * @thread_safety This function must only be called from the main thread. |
| 4966 | * |
| 4967 | * @sa @ref gamepad |
| 4968 | * @sa @ref glfwJoystickIsGamepad |
| 4969 | * |
| 4970 | * @since Added in version 3.3. |
| 4971 | * |
| 4972 | * @ingroup input |
| 4973 | */ |
| 4974 | GLFWAPI const char* glfwGetGamepadName(int jid); |
| 4975 | |
| 4976 | /*! @brief Retrieves the state of the specified joystick remapped as a gamepad. |
| 4977 | * |
| 4978 | * This function retrives the state of the specified joystick remapped to |
| 4979 | * an Xbox-like gamepad. |
| 4980 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4981 | * If the specified joystick is not present or does not have a gamepad mapping |
| 4982 | * this function will return `GLFW_FALSE` but will not generate an error. Call |
| 4983 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 4984 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4985 | * |
| 4986 | * The Guide button may not be available for input as it is often hooked by the |
| 4987 | * system or the Steam client. |
| 4988 | * |
| 4989 | * Not all devices have all the buttons or axes provided by @ref |
| 4990 | * GLFWgamepadstate. Unavailable buttons and axes will always report |
Camilla Löwy | 34d20b0 | 2018-03-03 22:24:26 +0100 | [diff] [blame] | 4991 | * `GLFW_RELEASE` and 0.0 respectively. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4992 | * |
| 4993 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4994 | * @param[out] state The gamepad input state of the joystick. |
| 4995 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is |
| 4996 | * connected, it has no gamepad mapping or an [error](@ref error_handling) |
| 4997 | * occurred. |
| 4998 | * |
| 4999 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5000 | * GLFW_INVALID_ENUM. |
| 5001 | * |
Camilla Löwy | e1495c0 | 2018-08-09 13:57:10 +0200 | [diff] [blame] | 5002 | * @thread_safety This function must only be called from the main thread. |
| 5003 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 5004 | * @sa @ref gamepad |
| 5005 | * @sa @ref glfwUpdateGamepadMappings |
| 5006 | * @sa @ref glfwJoystickIsGamepad |
| 5007 | * |
| 5008 | * @since Added in version 3.3. |
| 5009 | * |
| 5010 | * @ingroup input |
| 5011 | */ |
| 5012 | GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); |
| 5013 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5014 | /*! @brief Sets the clipboard to the specified string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5015 | * |
| 5016 | * This function sets the system clipboard to the specified, UTF-8 encoded |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5017 | * string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5018 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 5019 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5020 | * @param[in] string A UTF-8 encoded string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5021 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5022 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5023 | * GLFW_PLATFORM_ERROR. |
| 5024 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5025 | * @pointer_lifetime The specified string is copied before this function |
| 5026 | * returns. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 5027 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5028 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5029 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5030 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5031 | * @sa @ref glfwGetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5032 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5033 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5034 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 5035 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5036 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5037 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5038 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5039 | /*! @brief Returns the contents of the clipboard as a string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5040 | * |
| 5041 | * This function returns the contents of the system clipboard, if it contains |
Camilla Berglund | cf9079c | 2015-09-16 18:51:49 +0200 | [diff] [blame] | 5042 | * 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] | 5043 | * if its contents cannot be converted, `NULL` is returned and a @ref |
| 5044 | * GLFW_FORMAT_UNAVAILABLE error is generated. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5045 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 5046 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5047 | * @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] | 5048 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5049 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5050 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5051 | * GLFW_PLATFORM_ERROR. |
| 5052 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5053 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5054 | * 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] | 5055 | * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library |
| 5056 | * is terminated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5057 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5058 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5059 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5060 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5061 | * @sa @ref glfwSetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5062 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5063 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5064 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 5065 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5066 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5067 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 5068 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5069 | /*! @brief Returns the value of the GLFW timer. |
| 5070 | * |
| 5071 | * This function returns the value of the GLFW timer. Unless the timer has |
| 5072 | * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW |
| 5073 | * was initialized. |
| 5074 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5075 | * The resolution of the timer is system dependent, but is usually on the order |
| 5076 | * of a few micro- or nanoseconds. It uses the highest-resolution monotonic |
| 5077 | * time source on each supported platform. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5078 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5079 | * @return The current value, in seconds, or zero if an |
| 5080 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5081 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5082 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5083 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 5084 | * @thread_safety This function may be called from any thread. Reading and |
| 5085 | * writing of the internal timer offset is not atomic, so it needs to be |
| 5086 | * externally synchronized with calls to @ref glfwSetTime. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5087 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5088 | * @sa @ref time |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5089 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5090 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5091 | * |
| 5092 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5093 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 5094 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5095 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5096 | /*! @brief Sets the GLFW timer. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5097 | * |
| 5098 | * This function sets the value of the GLFW timer. It then continues to count |
Camilla Berglund | 6e20cda | 2015-03-10 12:01:38 +0100 | [diff] [blame] | 5099 | * up from that value. The value must be a positive finite number less than |
| 5100 | * or equal to 18446744073.0, which is approximately 584.5 years. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5101 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5102 | * @param[in] time The new value, in seconds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5103 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5104 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5105 | * GLFW_INVALID_VALUE. |
| 5106 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5107 | * @remark The upper limit of the timer is calculated as |
Camilla Berglund | 6e20cda | 2015-03-10 12:01:38 +0100 | [diff] [blame] | 5108 | * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations |
| 5109 | * storing nanoseconds in 64 bits. The limit may be increased in the future. |
| 5110 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 5111 | * @thread_safety This function may be called from any thread. Reading and |
| 5112 | * writing of the internal timer offset is not atomic, so it needs to be |
| 5113 | * externally synchronized with calls to @ref glfwGetTime. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5114 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5115 | * @sa @ref time |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5116 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5117 | * @since Added in version 2.2. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5118 | * |
| 5119 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5120 | */ |
| 5121 | GLFWAPI void glfwSetTime(double time); |
| 5122 | |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5123 | /*! @brief Returns the current value of the raw timer. |
| 5124 | * |
Camilla Berglund | 337c77a | 2016-03-06 14:11:14 +0100 | [diff] [blame] | 5125 | * This function returns the current value of the raw timer, measured in |
| 5126 | * 1 / frequency seconds. To get the frequency, call @ref |
| 5127 | * glfwGetTimerFrequency. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5128 | * |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 5129 | * @return The value of the timer, or zero if an |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5130 | * [error](@ref error_handling) occurred. |
| 5131 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 5132 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5133 | * |
| 5134 | * @thread_safety This function may be called from any thread. |
| 5135 | * |
| 5136 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5137 | * @sa @ref glfwGetTimerFrequency |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5138 | * |
| 5139 | * @since Added in version 3.2. |
| 5140 | * |
| 5141 | * @ingroup input |
| 5142 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 5143 | GLFWAPI uint64_t glfwGetTimerValue(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5144 | |
| 5145 | /*! @brief Returns the frequency, in Hz, of the raw timer. |
| 5146 | * |
Camilla Berglund | defaea3 | 2016-03-07 13:36:54 +0100 | [diff] [blame] | 5147 | * This function returns the frequency, in Hz, of the raw timer. |
| 5148 | * |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5149 | * @return The frequency of the timer, in Hz, or zero if an |
| 5150 | * [error](@ref error_handling) occurred. |
| 5151 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 5152 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5153 | * |
| 5154 | * @thread_safety This function may be called from any thread. |
| 5155 | * |
| 5156 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5157 | * @sa @ref glfwGetTimerValue |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5158 | * |
| 5159 | * @since Added in version 3.2. |
| 5160 | * |
| 5161 | * @ingroup input |
| 5162 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 5163 | GLFWAPI uint64_t glfwGetTimerFrequency(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5164 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5165 | /*! @brief Makes the context of the specified window current for the calling |
| 5166 | * thread. |
| 5167 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5168 | * 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] | 5169 | * 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] | 5170 | * a single thread at a time and each thread can have only a single current |
| 5171 | * context at a time. |
| 5172 | * |
Camilla Löwy | f2756d0 | 2017-11-02 19:30:12 +0100 | [diff] [blame] | 5173 | * When moving a context between threads, you must make it non-current on the |
| 5174 | * old thread before making it current on the new one. |
| 5175 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5176 | * By default, making a context non-current implicitly forces a pipeline flush. |
| 5177 | * On machines that support `GL_KHR_context_flush_control`, you can control |
| 5178 | * whether a context performs this flush by setting the |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 5179 | * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) |
| 5180 | * hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5181 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 5182 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 5183 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 5184 | * error. |
| 5185 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5186 | * @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] | 5187 | * detach the current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5188 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5189 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5190 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5191 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5192 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5193 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5194 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5195 | * @sa @ref glfwGetCurrentContext |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5196 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5197 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5198 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5199 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5200 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5201 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5202 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5203 | /*! @brief Returns the window whose context is current on the calling thread. |
| 5204 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5205 | * This function returns the window whose OpenGL or OpenGL ES context is |
| 5206 | * current on the calling thread. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5207 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5208 | * @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] | 5209 | * context is current. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5210 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5211 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5212 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5213 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5214 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5215 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5216 | * @sa @ref glfwMakeContextCurrent |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5217 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5218 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5219 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5220 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5221 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5222 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5223 | |
| 5224 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5225 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5226 | * This function swaps the front and back buffers of the specified window when |
| 5227 | * rendering with OpenGL or OpenGL ES. If the swap interval is greater than |
| 5228 | * zero, the GPU driver waits the specified number of screen updates before |
| 5229 | * swapping the buffers. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5230 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 5231 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 5232 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 5233 | * error. |
| 5234 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5235 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5236 | * see `vkQueuePresentKHR` instead. |
| 5237 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5238 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5239 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5240 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5241 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5242 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5243 | * @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] | 5244 | * calling thread. |
| 5245 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5246 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 5247 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5248 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5249 | * @sa @ref glfwSwapInterval |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5250 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5251 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5252 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5253 | * |
| 5254 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5255 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5256 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5257 | |
| 5258 | /*! @brief Sets the swap interval for the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5259 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5260 | * This function sets the swap interval for the current OpenGL or OpenGL ES |
| 5261 | * context, i.e. the number of screen updates to wait from the time @ref |
| 5262 | * glfwSwapBuffers was called before swapping the buffers and returning. This |
| 5263 | * is sometimes called _vertical synchronization_, _vertical retrace |
| 5264 | * synchronization_ or just _vsync_. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5265 | * |
Camilla Löwy | 8094a1c | 2017-11-27 15:53:59 +0100 | [diff] [blame] | 5266 | * 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] | 5267 | * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap |
| 5268 | * intervals, which allows the driver to swap immediately even if a frame |
| 5269 | * arrives a little bit late. You can check for these extensions with @ref |
| 5270 | * glfwExtensionSupported. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 5271 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5272 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5273 | * 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] | 5274 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5275 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5276 | * see the present mode of your swapchain instead. |
| 5277 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5278 | * @param[in] interval The minimum number of screen updates to wait for |
| 5279 | * until the buffers are swapped by @ref glfwSwapBuffers. |
| 5280 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5281 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5282 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5283 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5284 | * @remark This function is not called during context creation, leaving the |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5285 | * swap interval set to whatever is the default on that platform. This is done |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 5286 | * because some swap interval extensions used by GLFW do not allow the swap |
| 5287 | * interval to be reset to zero once it has been set to a non-zero value. |
| 5288 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5289 | * @remark Some GPU drivers do not honor the requested swap interval, either |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5290 | * because of a user setting that overrides the application's request or due to |
| 5291 | * bugs in the driver. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 5292 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5293 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5294 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5295 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5296 | * @sa @ref glfwSwapBuffers |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5297 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5298 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5299 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5300 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5301 | */ |
| 5302 | GLFWAPI void glfwSwapInterval(int interval); |
| 5303 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5304 | /*! @brief Returns whether the specified extension is available. |
| 5305 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 5306 | * This function returns whether the specified |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5307 | * [API extension](@ref context_glext) is supported by the current OpenGL or |
| 5308 | * OpenGL ES context. It searches both for client API extension and context |
| 5309 | * creation API extensions. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5310 | * |
| 5311 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5312 | * 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] | 5313 | * |
| 5314 | * As this functions retrieves and searches one or more extension strings each |
| 5315 | * call, it is recommended that you cache its results if it is going to be used |
| 5316 | * frequently. The extension strings will not change during the lifetime of |
| 5317 | * a context, so there is no danger in doing this. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5318 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5319 | * This function does not apply to Vulkan. If you are using Vulkan, see @ref |
| 5320 | * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties` |
| 5321 | * and `vkEnumerateDeviceExtensionProperties` instead. |
| 5322 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5323 | * @param[in] extension The ASCII encoded name of the extension. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 5324 | * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` |
| 5325 | * otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5326 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5327 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5328 | * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref |
| 5329 | * GLFW_PLATFORM_ERROR. |
| 5330 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5331 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5332 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5333 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5334 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5335 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5336 | * @since Added in version 1.0. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5337 | * |
| 5338 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5339 | */ |
| 5340 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 5341 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5342 | /*! @brief Returns the address of the specified function for the current |
| 5343 | * context. |
| 5344 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5345 | * This function returns the address of the specified OpenGL or OpenGL ES |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5346 | * [core or extension function](@ref context_glext), if it is supported |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 5347 | * by the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5348 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5349 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5350 | * 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] | 5351 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5352 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5353 | * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and |
| 5354 | * `vkGetDeviceProcAddr` instead. |
| 5355 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5356 | * @param[in] procname The ASCII encoded name of the function. |
Camilla Berglund | a36e3a2 | 2015-11-05 17:14:26 +0100 | [diff] [blame] | 5357 | * @return The address of the function, or `NULL` if an |
| 5358 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5359 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5360 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5361 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5362 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5363 | * @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] | 5364 | * between contexts. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5365 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5366 | * @remark This function may return a non-`NULL` address despite the |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5367 | * associated version or extension not being available. Always check the |
Camilla Berglund | c8e0687 | 2015-08-27 21:40:22 +0200 | [diff] [blame] | 5368 | * context version or extension string first. |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5369 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5370 | * @pointer_lifetime The returned function pointer is valid until the context |
| 5371 | * is destroyed or the library is terminated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5372 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5373 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5374 | * |
| 5375 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5376 | * @sa @ref glfwExtensionSupported |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5377 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5378 | * @since Added in version 1.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5379 | * |
| 5380 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5381 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 5382 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5383 | |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5384 | /*! @brief Returns whether the Vulkan loader and an ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5385 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5386 | * This function returns whether the Vulkan loader and any minimally functional |
| 5387 | * ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5388 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5389 | * The availability of a Vulkan loader and even an ICD does not by itself |
| 5390 | * guarantee that surface creation or even instance creation is possible. |
| 5391 | * For example, on Fermi systems Nvidia will install an ICD that provides no |
| 5392 | * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check |
| 5393 | * whether the extensions necessary for Vulkan surface creation are available |
| 5394 | * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue |
| 5395 | * family of a physical device supports image presentation. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5396 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5397 | * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` |
| 5398 | * otherwise. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5399 | * |
| 5400 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5401 | * |
| 5402 | * @thread_safety This function may be called from any thread. |
| 5403 | * |
| 5404 | * @sa @ref vulkan_support |
| 5405 | * |
| 5406 | * @since Added in version 3.2. |
| 5407 | * |
| 5408 | * @ingroup vulkan |
| 5409 | */ |
| 5410 | GLFWAPI int glfwVulkanSupported(void); |
| 5411 | |
| 5412 | /*! @brief Returns the Vulkan instance extensions required by GLFW. |
| 5413 | * |
| 5414 | * This function returns an array of names of Vulkan instance extensions required |
| 5415 | * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the |
| 5416 | * list will always contains `VK_KHR_surface`, so if you don't require any |
| 5417 | * additional extensions you can pass this list directly to the |
| 5418 | * `VkInstanceCreateInfo` struct. |
| 5419 | * |
| 5420 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 5421 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5422 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5423 | * |
| 5424 | * If Vulkan is available but no set of extensions allowing window surface |
| 5425 | * creation was found, this function returns `NULL`. You may still use Vulkan |
| 5426 | * for off-screen rendering and compute work. |
| 5427 | * |
| 5428 | * @param[out] count Where to store the number of extensions in the returned |
| 5429 | * array. This is set to zero if an error occurred. |
| 5430 | * @return An array of ASCII encoded extension names, or `NULL` if an |
| 5431 | * [error](@ref error_handling) occurred. |
| 5432 | * |
| 5433 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5434 | * GLFW_API_UNAVAILABLE. |
| 5435 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 5436 | * @remark Additional extensions may be required by future versions of GLFW. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5437 | * You should check if any extensions you wish to enable are already in the |
| 5438 | * returned array, as it is an error to specify an extension more than once in |
| 5439 | * the `VkInstanceCreateInfo` struct. |
| 5440 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5441 | * @remark @macos This function currently only supports the |
| 5442 | * `VK_MVK_macos_surface` extension from MoltenVK. |
| 5443 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5444 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5445 | * should not free it yourself. It is guaranteed to be valid only until the |
| 5446 | * library is terminated. |
| 5447 | * |
| 5448 | * @thread_safety This function may be called from any thread. |
| 5449 | * |
| 5450 | * @sa @ref vulkan_ext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5451 | * @sa @ref glfwCreateWindowSurface |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5452 | * |
| 5453 | * @since Added in version 3.2. |
| 5454 | * |
| 5455 | * @ingroup vulkan |
| 5456 | */ |
Camilla Berglund | 7ab7d8b | 2016-03-23 10:24:01 +0100 | [diff] [blame] | 5457 | GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count); |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5458 | |
| 5459 | #if defined(VK_VERSION_1_0) |
| 5460 | |
| 5461 | /*! @brief Returns the address of the specified Vulkan instance function. |
| 5462 | * |
| 5463 | * This function returns the address of the specified Vulkan core or extension |
| 5464 | * function for the specified instance. If instance is set to `NULL` it can |
| 5465 | * return any function exported from the Vulkan loader, including at least the |
| 5466 | * following functions: |
| 5467 | * |
| 5468 | * - `vkEnumerateInstanceExtensionProperties` |
| 5469 | * - `vkEnumerateInstanceLayerProperties` |
| 5470 | * - `vkCreateInstance` |
| 5471 | * - `vkGetInstanceProcAddr` |
| 5472 | * |
| 5473 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 5474 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5475 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5476 | * |
| 5477 | * This function is equivalent to calling `vkGetInstanceProcAddr` with |
| 5478 | * a platform-specific query of the Vulkan loader as a fallback. |
| 5479 | * |
| 5480 | * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve |
| 5481 | * functions related to instance creation. |
| 5482 | * @param[in] procname The ASCII encoded name of the function. |
| 5483 | * @return The address of the function, or `NULL` if an |
| 5484 | * [error](@ref error_handling) occurred. |
| 5485 | * |
| 5486 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5487 | * GLFW_API_UNAVAILABLE. |
| 5488 | * |
| 5489 | * @pointer_lifetime The returned function pointer is valid until the library |
| 5490 | * is terminated. |
| 5491 | * |
| 5492 | * @thread_safety This function may be called from any thread. |
| 5493 | * |
| 5494 | * @sa @ref vulkan_proc |
| 5495 | * |
| 5496 | * @since Added in version 3.2. |
| 5497 | * |
| 5498 | * @ingroup vulkan |
| 5499 | */ |
| 5500 | GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); |
| 5501 | |
| 5502 | /*! @brief Returns whether the specified queue family can present images. |
| 5503 | * |
| 5504 | * This function returns whether the specified queue family of the specified |
| 5505 | * physical device supports presentation to the platform GLFW was built for. |
| 5506 | * |
| 5507 | * If Vulkan or the required window surface creation instance extensions are |
| 5508 | * not available on the machine, or if the specified instance was not created |
| 5509 | * with the required extensions, this function returns `GLFW_FALSE` and |
| 5510 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5511 | * to check whether Vulkan is at least minimally available and @ref |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5512 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 5513 | * required. |
| 5514 | * |
| 5515 | * @param[in] instance The instance that the physical device belongs to. |
| 5516 | * @param[in] device The physical device that the queue family belongs to. |
| 5517 | * @param[in] queuefamily The index of the queue family to query. |
| 5518 | * @return `GLFW_TRUE` if the queue family supports presentation, or |
| 5519 | * `GLFW_FALSE` otherwise. |
| 5520 | * |
| 5521 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5522 | * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
| 5523 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5524 | * @remark @macos This function currently always returns `GLFW_TRUE`, as the |
| 5525 | * `VK_MVK_macos_surface` extension does not provide |
| 5526 | * a `vkGetPhysicalDevice*PresentationSupport` type function. |
| 5527 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5528 | * @thread_safety This function may be called from any thread. For |
| 5529 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 5530 | * |
| 5531 | * @sa @ref vulkan_present |
| 5532 | * |
| 5533 | * @since Added in version 3.2. |
| 5534 | * |
| 5535 | * @ingroup vulkan |
| 5536 | */ |
| 5537 | GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); |
| 5538 | |
| 5539 | /*! @brief Creates a Vulkan surface for the specified window. |
| 5540 | * |
| 5541 | * This function creates a Vulkan surface for the specified window. |
| 5542 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5543 | * If the Vulkan loader or at least one minimally functional ICD were not found, |
| 5544 | * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref |
| 5545 | * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether |
| 5546 | * Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5547 | * |
| 5548 | * If the required window surface creation instance extensions are not |
| 5549 | * available or if the specified instance was not created with these extensions |
| 5550 | * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and |
| 5551 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref |
| 5552 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 5553 | * required. |
| 5554 | * |
Corentin Wallez | 8a8eefa | 2018-01-30 13:25:17 -0500 | [diff] [blame] | 5555 | * The window surface cannot be shared with another API so the window must |
| 5556 | * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib) |
| 5557 | * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error |
| 5558 | * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`. |
| 5559 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5560 | * The window surface must be destroyed before the specified Vulkan instance. |
| 5561 | * It is the responsibility of the caller to destroy the window surface. GLFW |
| 5562 | * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the |
| 5563 | * surface. |
| 5564 | * |
| 5565 | * @param[in] instance The Vulkan instance to create the surface in. |
| 5566 | * @param[in] window The window to create the surface for. |
| 5567 | * @param[in] allocator The allocator to use, or `NULL` to use the default |
| 5568 | * allocator. |
| 5569 | * @param[out] surface Where to store the handle of the surface. This is set |
| 5570 | * to `VK_NULL_HANDLE` if an error occurred. |
| 5571 | * @return `VK_SUCCESS` if successful, or a Vulkan error code if an |
| 5572 | * [error](@ref error_handling) occurred. |
| 5573 | * |
| 5574 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Corentin Wallez | 8a8eefa | 2018-01-30 13:25:17 -0500 | [diff] [blame] | 5575 | * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5576 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 5577 | * @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] | 5578 | * the Vulkan error code most appropriate for the error. Appropriate use of |
| 5579 | * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should |
Camilla Berglund | ee33dcd | 2016-03-07 14:42:51 +0100 | [diff] [blame] | 5580 | * eliminate almost all occurrences of these errors. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5581 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5582 | * @remark @macos This function currently only supports the |
| 5583 | * `VK_MVK_macos_surface` extension from MoltenVK. |
| 5584 | * |
| 5585 | * @remark @macos This function creates and sets a `CAMetalLayer` instance for |
| 5586 | * the window content view, which is required for MoltenVK to function. |
| 5587 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5588 | * @thread_safety This function may be called from any thread. For |
| 5589 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 5590 | * |
| 5591 | * @sa @ref vulkan_surface |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5592 | * @sa @ref glfwGetRequiredInstanceExtensions |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5593 | * |
| 5594 | * @since Added in version 3.2. |
| 5595 | * |
| 5596 | * @ingroup vulkan |
| 5597 | */ |
| 5598 | GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); |
| 5599 | |
| 5600 | #endif /*VK_VERSION_1_0*/ |
| 5601 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5602 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5603 | /************************************************************************* |
| 5604 | * Global definition cleanup |
| 5605 | *************************************************************************/ |
| 5606 | |
| 5607 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 5608 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5609 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 5610 | #undef WINGDIAPI |
| 5611 | #undef GLFW_WINGDIAPI_DEFINED |
| 5612 | #endif |
| 5613 | |
| 5614 | #ifdef GLFW_CALLBACK_DEFINED |
| 5615 | #undef CALLBACK |
| 5616 | #undef GLFW_CALLBACK_DEFINED |
| 5617 | #endif |
| 5618 | |
Camilla Löwy | be51c20 | 2017-07-03 14:25:47 +0200 | [diff] [blame] | 5619 | /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally |
| 5620 | * defined by some gl.h variants (OpenBSD) so define it after if needed. |
| 5621 | */ |
| 5622 | #ifndef GLAPIENTRY |
| 5623 | #define GLAPIENTRY APIENTRY |
| 5624 | #endif |
| 5625 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5626 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 5627 | |
| 5628 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5629 | #ifdef __cplusplus |
| 5630 | } |
| 5631 | #endif |
| 5632 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 5633 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5634 | |