Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 1 | /************************************************************************* |
Camilla Berglund | 53fafad | 2016-08-18 23:42:15 +0200 | [diff] [blame] | 2 | * GLFW 3.3 - 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 | f4d0c83 | 2016-11-21 16:23:59 +0100 | [diff] [blame] | 6 | * Copyright (c) 2006-2016 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 Berglund | 53fafad | 2016-08-18 23:42:15 +0200 | [diff] [blame] | 262 | #define GLFW_VERSION_MINOR 3 |
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 |
| 275 | * `true` or `_True` or `GL_TRUE` or anything else that is equal to one. |
| 276 | * |
| 277 | * @ingroup init |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 278 | */ |
| 279 | #define GLFW_TRUE 1 |
| 280 | /*! @brief Zero. |
| 281 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 282 | * This is only semantic sugar for the number 0. You can instead use `0` or |
| 283 | * `false` or `_False` or `GL_FALSE` or anything else that is equal to zero. |
| 284 | * |
| 285 | * @ingroup init |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 286 | */ |
| 287 | #define GLFW_FALSE 0 |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 288 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 289 | /*! @name Key and button actions |
| 290 | * @{ */ |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 291 | /*! @brief The key or mouse button was released. |
| 292 | * |
| 293 | * The key or mouse button was released. |
| 294 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 295 | * @ingroup input |
| 296 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 297 | #define GLFW_RELEASE 0 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 298 | /*! @brief The key or mouse button was pressed. |
| 299 | * |
| 300 | * The key or mouse button was pressed. |
| 301 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 302 | * @ingroup input |
| 303 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 304 | #define GLFW_PRESS 1 |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 305 | /*! @brief The key was held down until it repeated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 306 | * |
| 307 | * The key was held down until it repeated. |
| 308 | * |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 309 | * @ingroup input |
| 310 | */ |
| 311 | #define GLFW_REPEAT 2 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 312 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 313 | |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 314 | /*! @defgroup hat_state Joystick hat states |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 315 | * @brief Joystick hat states. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 316 | * |
| 317 | * See [joystick hat input](@ref joystick_hat) for how these are used. |
| 318 | * |
| 319 | * @ingroup input |
| 320 | * @{ */ |
| 321 | #define GLFW_HAT_CENTERED 0 |
| 322 | #define GLFW_HAT_UP 1 |
| 323 | #define GLFW_HAT_RIGHT 2 |
| 324 | #define GLFW_HAT_DOWN 4 |
| 325 | #define GLFW_HAT_LEFT 8 |
| 326 | #define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP) |
| 327 | #define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN) |
| 328 | #define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP) |
| 329 | #define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN) |
| 330 | /*! @} */ |
| 331 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 332 | /*! @defgroup keys Keyboard keys |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 333 | * @brief Keyboard key IDs. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 334 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 335 | * See [key input](@ref input_key) for how these are used. |
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 | * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), |
| 338 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
| 339 | * put in the 256+ range). |
| 340 | * |
| 341 | * The naming of the key codes follow these rules: |
| 342 | * - The US keyboard layout is used |
| 343 | * - Names of printable alpha-numeric characters are used (e.g. "A", "R", |
| 344 | * "3", etc.) |
| 345 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
| 346 | * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not |
| 347 | * correspond to the Unicode standard (usually for brevity) |
| 348 | * - Keys that lack a clear US mapping are named "WORLD_x" |
| 349 | * - For non-printable keys, custom names are used (e.g. "F4", |
| 350 | * "BACKSPACE", etc.) |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 351 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 352 | * @ingroup input |
| 353 | * @{ |
| 354 | */ |
| 355 | |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 356 | /* The unknown key */ |
| 357 | #define GLFW_KEY_UNKNOWN -1 |
| 358 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 359 | /* Printable keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 360 | #define GLFW_KEY_SPACE 32 |
| 361 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
| 362 | #define GLFW_KEY_COMMA 44 /* , */ |
| 363 | #define GLFW_KEY_MINUS 45 /* - */ |
| 364 | #define GLFW_KEY_PERIOD 46 /* . */ |
| 365 | #define GLFW_KEY_SLASH 47 /* / */ |
| 366 | #define GLFW_KEY_0 48 |
| 367 | #define GLFW_KEY_1 49 |
| 368 | #define GLFW_KEY_2 50 |
| 369 | #define GLFW_KEY_3 51 |
| 370 | #define GLFW_KEY_4 52 |
| 371 | #define GLFW_KEY_5 53 |
| 372 | #define GLFW_KEY_6 54 |
| 373 | #define GLFW_KEY_7 55 |
| 374 | #define GLFW_KEY_8 56 |
| 375 | #define GLFW_KEY_9 57 |
| 376 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
| 377 | #define GLFW_KEY_EQUAL 61 /* = */ |
| 378 | #define GLFW_KEY_A 65 |
| 379 | #define GLFW_KEY_B 66 |
| 380 | #define GLFW_KEY_C 67 |
| 381 | #define GLFW_KEY_D 68 |
| 382 | #define GLFW_KEY_E 69 |
| 383 | #define GLFW_KEY_F 70 |
| 384 | #define GLFW_KEY_G 71 |
| 385 | #define GLFW_KEY_H 72 |
| 386 | #define GLFW_KEY_I 73 |
| 387 | #define GLFW_KEY_J 74 |
| 388 | #define GLFW_KEY_K 75 |
| 389 | #define GLFW_KEY_L 76 |
| 390 | #define GLFW_KEY_M 77 |
| 391 | #define GLFW_KEY_N 78 |
| 392 | #define GLFW_KEY_O 79 |
| 393 | #define GLFW_KEY_P 80 |
| 394 | #define GLFW_KEY_Q 81 |
| 395 | #define GLFW_KEY_R 82 |
| 396 | #define GLFW_KEY_S 83 |
| 397 | #define GLFW_KEY_T 84 |
| 398 | #define GLFW_KEY_U 85 |
| 399 | #define GLFW_KEY_V 86 |
| 400 | #define GLFW_KEY_W 87 |
| 401 | #define GLFW_KEY_X 88 |
| 402 | #define GLFW_KEY_Y 89 |
| 403 | #define GLFW_KEY_Z 90 |
| 404 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
| 405 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
| 406 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
| 407 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
| 408 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
| 409 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 410 | |
| 411 | /* Function keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 412 | #define GLFW_KEY_ESCAPE 256 |
| 413 | #define GLFW_KEY_ENTER 257 |
| 414 | #define GLFW_KEY_TAB 258 |
| 415 | #define GLFW_KEY_BACKSPACE 259 |
| 416 | #define GLFW_KEY_INSERT 260 |
| 417 | #define GLFW_KEY_DELETE 261 |
| 418 | #define GLFW_KEY_RIGHT 262 |
| 419 | #define GLFW_KEY_LEFT 263 |
| 420 | #define GLFW_KEY_DOWN 264 |
| 421 | #define GLFW_KEY_UP 265 |
| 422 | #define GLFW_KEY_PAGE_UP 266 |
| 423 | #define GLFW_KEY_PAGE_DOWN 267 |
| 424 | #define GLFW_KEY_HOME 268 |
| 425 | #define GLFW_KEY_END 269 |
| 426 | #define GLFW_KEY_CAPS_LOCK 280 |
| 427 | #define GLFW_KEY_SCROLL_LOCK 281 |
| 428 | #define GLFW_KEY_NUM_LOCK 282 |
| 429 | #define GLFW_KEY_PRINT_SCREEN 283 |
| 430 | #define GLFW_KEY_PAUSE 284 |
| 431 | #define GLFW_KEY_F1 290 |
| 432 | #define GLFW_KEY_F2 291 |
| 433 | #define GLFW_KEY_F3 292 |
| 434 | #define GLFW_KEY_F4 293 |
| 435 | #define GLFW_KEY_F5 294 |
| 436 | #define GLFW_KEY_F6 295 |
| 437 | #define GLFW_KEY_F7 296 |
| 438 | #define GLFW_KEY_F8 297 |
| 439 | #define GLFW_KEY_F9 298 |
| 440 | #define GLFW_KEY_F10 299 |
| 441 | #define GLFW_KEY_F11 300 |
| 442 | #define GLFW_KEY_F12 301 |
| 443 | #define GLFW_KEY_F13 302 |
| 444 | #define GLFW_KEY_F14 303 |
| 445 | #define GLFW_KEY_F15 304 |
| 446 | #define GLFW_KEY_F16 305 |
| 447 | #define GLFW_KEY_F17 306 |
| 448 | #define GLFW_KEY_F18 307 |
| 449 | #define GLFW_KEY_F19 308 |
| 450 | #define GLFW_KEY_F20 309 |
| 451 | #define GLFW_KEY_F21 310 |
| 452 | #define GLFW_KEY_F22 311 |
| 453 | #define GLFW_KEY_F23 312 |
| 454 | #define GLFW_KEY_F24 313 |
| 455 | #define GLFW_KEY_F25 314 |
| 456 | #define GLFW_KEY_KP_0 320 |
| 457 | #define GLFW_KEY_KP_1 321 |
| 458 | #define GLFW_KEY_KP_2 322 |
| 459 | #define GLFW_KEY_KP_3 323 |
| 460 | #define GLFW_KEY_KP_4 324 |
| 461 | #define GLFW_KEY_KP_5 325 |
| 462 | #define GLFW_KEY_KP_6 326 |
| 463 | #define GLFW_KEY_KP_7 327 |
| 464 | #define GLFW_KEY_KP_8 328 |
| 465 | #define GLFW_KEY_KP_9 329 |
| 466 | #define GLFW_KEY_KP_DECIMAL 330 |
| 467 | #define GLFW_KEY_KP_DIVIDE 331 |
| 468 | #define GLFW_KEY_KP_MULTIPLY 332 |
| 469 | #define GLFW_KEY_KP_SUBTRACT 333 |
| 470 | #define GLFW_KEY_KP_ADD 334 |
| 471 | #define GLFW_KEY_KP_ENTER 335 |
| 472 | #define GLFW_KEY_KP_EQUAL 336 |
| 473 | #define GLFW_KEY_LEFT_SHIFT 340 |
| 474 | #define GLFW_KEY_LEFT_CONTROL 341 |
| 475 | #define GLFW_KEY_LEFT_ALT 342 |
| 476 | #define GLFW_KEY_LEFT_SUPER 343 |
| 477 | #define GLFW_KEY_RIGHT_SHIFT 344 |
| 478 | #define GLFW_KEY_RIGHT_CONTROL 345 |
| 479 | #define GLFW_KEY_RIGHT_ALT 346 |
| 480 | #define GLFW_KEY_RIGHT_SUPER 347 |
| 481 | #define GLFW_KEY_MENU 348 |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 482 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 483 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 484 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 485 | /*! @} */ |
| 486 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 487 | /*! @defgroup mods Modifier key flags |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 488 | * @brief Modifier key flags. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 489 | * |
| 490 | * See [key input](@ref input_key) for how these are used. |
| 491 | * |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 492 | * @ingroup input |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 493 | * @{ */ |
| 494 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 495 | /*! @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] | 496 | * |
| 497 | * 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] | 498 | */ |
| 499 | #define GLFW_MOD_SHIFT 0x0001 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 500 | /*! @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] | 501 | * |
| 502 | * 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] | 503 | */ |
Camilla Berglund | 3bcffba | 2013-05-23 14:11:05 +0200 | [diff] [blame] | 504 | #define GLFW_MOD_CONTROL 0x0002 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 505 | /*! @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] | 506 | * |
| 507 | * 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] | 508 | */ |
| 509 | #define GLFW_MOD_ALT 0x0004 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 510 | /*! @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] | 511 | * |
| 512 | * 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] | 513 | */ |
| 514 | #define GLFW_MOD_SUPER 0x0008 |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 515 | /*! @brief If this bit is set the Caps Lock key is enabled. |
| 516 | * |
| 517 | * If this bit is set the Caps Lock key is enabled and the @ref |
| 518 | * GLFW_LOCK_KEY_MODS input mode is set. |
| 519 | */ |
| 520 | #define GLFW_MOD_CAPS_LOCK 0x0010 |
| 521 | /*! @brief If this bit is set the Num Lock key is enabled. |
| 522 | * |
| 523 | * If this bit is set the Num Lock key is enabled and the @ref |
| 524 | * GLFW_LOCK_KEY_MODS input mode is set. |
| 525 | */ |
| 526 | #define GLFW_MOD_NUM_LOCK 0x0020 |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 527 | |
| 528 | /*! @} */ |
| 529 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 530 | /*! @defgroup buttons Mouse buttons |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 531 | * @brief Mouse button IDs. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 532 | * |
| 533 | * See [mouse button input](@ref input_mouse_button) for how these are used. |
| 534 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 535 | * @ingroup input |
| 536 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 537 | #define GLFW_MOUSE_BUTTON_1 0 |
| 538 | #define GLFW_MOUSE_BUTTON_2 1 |
| 539 | #define GLFW_MOUSE_BUTTON_3 2 |
| 540 | #define GLFW_MOUSE_BUTTON_4 3 |
| 541 | #define GLFW_MOUSE_BUTTON_5 4 |
| 542 | #define GLFW_MOUSE_BUTTON_6 5 |
| 543 | #define GLFW_MOUSE_BUTTON_7 6 |
| 544 | #define GLFW_MOUSE_BUTTON_8 7 |
| 545 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
| 546 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
| 547 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
| 548 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 549 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 550 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 551 | /*! @defgroup joysticks Joysticks |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 552 | * @brief Joystick IDs. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 553 | * |
| 554 | * See [joystick input](@ref joystick) for how these are used. |
| 555 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 556 | * @ingroup input |
| 557 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 558 | #define GLFW_JOYSTICK_1 0 |
| 559 | #define GLFW_JOYSTICK_2 1 |
| 560 | #define GLFW_JOYSTICK_3 2 |
| 561 | #define GLFW_JOYSTICK_4 3 |
| 562 | #define GLFW_JOYSTICK_5 4 |
| 563 | #define GLFW_JOYSTICK_6 5 |
| 564 | #define GLFW_JOYSTICK_7 6 |
| 565 | #define GLFW_JOYSTICK_8 7 |
| 566 | #define GLFW_JOYSTICK_9 8 |
| 567 | #define GLFW_JOYSTICK_10 9 |
| 568 | #define GLFW_JOYSTICK_11 10 |
| 569 | #define GLFW_JOYSTICK_12 11 |
| 570 | #define GLFW_JOYSTICK_13 12 |
| 571 | #define GLFW_JOYSTICK_14 13 |
| 572 | #define GLFW_JOYSTICK_15 14 |
| 573 | #define GLFW_JOYSTICK_16 15 |
| 574 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 575 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 576 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 577 | /*! @defgroup gamepad_buttons Gamepad buttons |
| 578 | * @brief Gamepad buttons. |
| 579 | * |
| 580 | * See @ref gamepad for how these are used. |
| 581 | * |
| 582 | * @ingroup input |
| 583 | * @{ */ |
| 584 | #define GLFW_GAMEPAD_BUTTON_A 0 |
| 585 | #define GLFW_GAMEPAD_BUTTON_B 1 |
| 586 | #define GLFW_GAMEPAD_BUTTON_X 2 |
| 587 | #define GLFW_GAMEPAD_BUTTON_Y 3 |
| 588 | #define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4 |
| 589 | #define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5 |
| 590 | #define GLFW_GAMEPAD_BUTTON_BACK 6 |
| 591 | #define GLFW_GAMEPAD_BUTTON_START 7 |
| 592 | #define GLFW_GAMEPAD_BUTTON_GUIDE 8 |
| 593 | #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9 |
| 594 | #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10 |
| 595 | #define GLFW_GAMEPAD_BUTTON_DPAD_UP 11 |
| 596 | #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12 |
| 597 | #define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13 |
| 598 | #define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14 |
| 599 | #define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT |
| 600 | |
| 601 | #define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A |
| 602 | #define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B |
| 603 | #define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X |
| 604 | #define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y |
| 605 | /*! @} */ |
| 606 | |
| 607 | /*! @defgroup gamepad_axes Gamepad axes |
| 608 | * @brief Gamepad axes. |
| 609 | * |
| 610 | * See @ref gamepad for how these are used. |
| 611 | * |
| 612 | * @ingroup input |
| 613 | * @{ */ |
| 614 | #define GLFW_GAMEPAD_AXIS_LEFT_X 0 |
| 615 | #define GLFW_GAMEPAD_AXIS_LEFT_Y 1 |
| 616 | #define GLFW_GAMEPAD_AXIS_RIGHT_X 2 |
| 617 | #define GLFW_GAMEPAD_AXIS_RIGHT_Y 3 |
| 618 | #define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4 |
| 619 | #define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5 |
| 620 | #define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER |
| 621 | /*! @} */ |
| 622 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 623 | /*! @defgroup errors Error codes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 624 | * @brief Error codes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 625 | * |
| 626 | * See [error handling](@ref error_handling) for how these are used. |
| 627 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 628 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 629 | * @{ */ |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 630 | /*! @brief No error has occurred. |
| 631 | * |
| 632 | * No error has occurred. |
| 633 | * |
| 634 | * @analysis Yay. |
| 635 | */ |
| 636 | #define GLFW_NO_ERROR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 637 | /*! @brief GLFW has not been initialized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 638 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 639 | * 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] | 640 | * library is [initialized](@ref intro_init). |
| 641 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 642 | * @analysis Application programmer error. Initialize GLFW before calling any |
| 643 | * function that requires initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 644 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 645 | #define GLFW_NOT_INITIALIZED 0x00010001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 646 | /*! @brief No context is current for this thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 647 | * |
| 648 | * This occurs if a GLFW function was called that needs and operates on the |
| 649 | * current OpenGL or OpenGL ES context but no context is current on the calling |
| 650 | * thread. One such function is @ref glfwSwapInterval. |
| 651 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 652 | * @analysis Application programmer error. Ensure a context is current before |
| 653 | * calling functions that require a current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 654 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 655 | #define GLFW_NO_CURRENT_CONTEXT 0x00010002 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 656 | /*! @brief One of the arguments to the function was an invalid enum value. |
| 657 | * |
| 658 | * 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] | 659 | * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 660 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 661 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 662 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 663 | #define GLFW_INVALID_ENUM 0x00010003 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 664 | /*! @brief One of the arguments to the function was an invalid value. |
| 665 | * |
| 666 | * One of the arguments to the function was an invalid value, for example |
| 667 | * requesting a non-existent OpenGL or OpenGL ES version like 2.7. |
| 668 | * |
| 669 | * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead |
| 670 | * result in a @ref GLFW_VERSION_UNAVAILABLE error. |
| 671 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 672 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 673 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 674 | #define GLFW_INVALID_VALUE 0x00010004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 675 | /*! @brief A memory allocation failed. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 676 | * |
| 677 | * A memory allocation failed. |
| 678 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 679 | * @analysis A bug in GLFW or the underlying operating system. Report the bug |
| 680 | * to our [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 681 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 682 | #define GLFW_OUT_OF_MEMORY 0x00010005 |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 683 | /*! @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] | 684 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 685 | * 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 | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 687 | * @analysis The installed graphics driver does not support the requested |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 688 | * API, or does not support it via the chosen context creation backend. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 689 | * Below are a few examples. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 690 | * |
| 691 | * @par |
| 692 | * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only |
Camilla Berglund | d95b79f | 2015-03-30 23:20:49 +0200 | [diff] [blame] | 693 | * 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] | 694 | * 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] | 695 | * 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] | 696 | * driver. Older graphics drivers do not support Vulkan. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 697 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 698 | #define GLFW_API_UNAVAILABLE 0x00010006 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 699 | /*! @brief The requested OpenGL or OpenGL ES version is not available. |
| 700 | * |
Camilla Berglund | d493a82 | 2015-03-10 19:51:14 +0100 | [diff] [blame] | 701 | * The requested OpenGL or OpenGL ES version (including any requested context |
| 702 | * or framebuffer hints) is not available on this machine. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 703 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 704 | * @analysis The machine does not support your requirements. If your |
| 705 | * application is sufficiently flexible, downgrade your requirements and try |
| 706 | * again. Otherwise, inform the user that their machine does not match your |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 707 | * requirements. |
| 708 | * |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 709 | * @par |
| 710 | * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 |
| 711 | * comes out before the 4.x series gets that far, also fail with this error and |
| 712 | * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions |
| 713 | * will exist. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 714 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 715 | #define GLFW_VERSION_UNAVAILABLE 0x00010007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 716 | /*! @brief A platform-specific error occurred that does not match any of the |
| 717 | * more specific categories. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 718 | * |
| 719 | * A platform-specific error occurred that does not match any of the more |
| 720 | * specific categories. |
| 721 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 722 | * @analysis A bug or configuration error in GLFW, the underlying operating |
| 723 | * system or its drivers, or a lack of required resources. Report the issue to |
| 724 | * our [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 725 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 726 | #define GLFW_PLATFORM_ERROR 0x00010008 |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 727 | /*! @brief The requested format is not supported or available. |
| 728 | * |
| 729 | * If emitted during window creation, the requested pixel format is not |
| 730 | * supported. |
| 731 | * |
| 732 | * If emitted when querying the clipboard, the contents of the clipboard could |
| 733 | * not be converted to the requested format. |
| 734 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 735 | * @analysis If emitted during window creation, one or more |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 736 | * [hard constraints](@ref window_hints_hard) did not match any of the |
| 737 | * available pixel formats. If your application is sufficiently flexible, |
| 738 | * downgrade your requirements and try again. Otherwise, inform the user that |
| 739 | * their machine does not match your requirements. |
| 740 | * |
| 741 | * @par |
| 742 | * If emitted when querying the clipboard, ignore the error or report it to |
| 743 | * the user, as appropriate. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 744 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 745 | #define GLFW_FORMAT_UNAVAILABLE 0x00010009 |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 746 | /*! @brief The specified window does not have an OpenGL or OpenGL ES context. |
| 747 | * |
| 748 | * A window that does not have an OpenGL or OpenGL ES context was passed to |
| 749 | * a function that requires it to have one. |
| 750 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 751 | * @analysis Application programmer error. Fix the offending call. |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 752 | */ |
| 753 | #define GLFW_NO_WINDOW_CONTEXT 0x0001000A |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 754 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 755 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 756 | /*! @addtogroup window |
| 757 | * @{ */ |
| 758 | /*! @brief Input focus window hint and attribute |
| 759 | * |
| 760 | * Input focus [window hint](@ref GLFW_FOCUSED_hint) or |
| 761 | * [window attribute](@ref GLFW_FOCUSED_attrib). |
| 762 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 763 | #define GLFW_FOCUSED 0x00020001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 764 | /*! @brief Window iconification window attribute |
| 765 | * |
| 766 | * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib). |
| 767 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 768 | #define GLFW_ICONIFIED 0x00020002 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 769 | /*! @brief Window resize-ability window hint and attribute |
| 770 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 771 | * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 772 | * [window attribute](@ref GLFW_RESIZABLE_attrib). |
| 773 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 774 | #define GLFW_RESIZABLE 0x00020003 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 775 | /*! @brief Window visibility window hint and attribute |
| 776 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 777 | * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 778 | * [window attribute](@ref GLFW_VISIBLE_attrib). |
| 779 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 780 | #define GLFW_VISIBLE 0x00020004 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 781 | /*! @brief Window decoration window hint and attribute |
| 782 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 783 | * Window decoration [window hint](@ref GLFW_DECORATED_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 784 | * [window attribute](@ref GLFW_DECORATED_attrib). |
| 785 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 786 | #define GLFW_DECORATED 0x00020005 |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 787 | /*! @brief Window auto-iconification window hint and attribute |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 788 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 789 | * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 790 | * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib). |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 791 | */ |
Camilla Berglund | 25e7ff1 | 2014-04-08 15:32:34 +0200 | [diff] [blame] | 792 | #define GLFW_AUTO_ICONIFY 0x00020006 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 793 | /*! @brief Window decoration window hint and attribute |
| 794 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 795 | * Window decoration [window hint](@ref GLFW_FLOATING_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 796 | * [window attribute](@ref GLFW_FLOATING_attrib). |
| 797 | */ |
Camilla Berglund | 3ce7bfe | 2014-05-23 14:01:02 +0200 | [diff] [blame] | 798 | #define GLFW_FLOATING 0x00020007 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 799 | /*! @brief Window maximization window hint and attribute |
| 800 | * |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 801 | * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 802 | * [window attribute](@ref GLFW_MAXIMIZED_attrib). |
| 803 | */ |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 804 | #define GLFW_MAXIMIZED 0x00020008 |
Camilla Löwy | 5a74b50 | 2017-02-06 15:03:50 +0100 | [diff] [blame] | 805 | /*! @brief Cursor centering window hint |
| 806 | * |
| 807 | * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint). |
| 808 | */ |
Liam Middlebrook | 72ac5ba | 2016-08-18 11:47:54 -0400 | [diff] [blame] | 809 | #define GLFW_CENTER_CURSOR 0x00020009 |
Camilla Löwy | 32e78ae | 2017-09-18 18:10:57 +0200 | [diff] [blame] | 810 | /*! @brief Window framebuffer transparency hint and attribute |
| 811 | * |
Camilla Löwy | 49130ab | 2017-11-07 22:50:01 +0100 | [diff] [blame] | 812 | * Window framebuffer transparency |
| 813 | * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and |
| 814 | * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib). |
Camilla Löwy | 32e78ae | 2017-09-18 18:10:57 +0200 | [diff] [blame] | 815 | */ |
Camilla Löwy | 49130ab | 2017-11-07 22:50:01 +0100 | [diff] [blame] | 816 | #define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A |
Camilla Löwy | d6b3a60 | 2018-01-11 14:13:54 +0100 | [diff] [blame] | 817 | /*! @brief Mouse cursor hover window attribute. |
| 818 | * |
| 819 | * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib). |
| 820 | */ |
Camilla Löwy | ee9dffc | 2018-01-04 13:50:58 +0100 | [diff] [blame] | 821 | #define GLFW_HOVERED 0x0002000B |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 822 | /*! @brief Input focus on calling show window hint and attribute |
| 823 | * |
| 824 | * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or |
| 825 | * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). |
| 826 | */ |
| 827 | #define GLFW_FOCUS_ON_SHOW 0x0002000C |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 828 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 829 | /*! @brief Framebuffer bit depth hint. |
| 830 | * |
| 831 | * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). |
| 832 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 833 | #define GLFW_RED_BITS 0x00021001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 834 | /*! @brief Framebuffer bit depth hint. |
| 835 | * |
| 836 | * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS). |
| 837 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 838 | #define GLFW_GREEN_BITS 0x00021002 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 839 | /*! @brief Framebuffer bit depth hint. |
| 840 | * |
| 841 | * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS). |
| 842 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 843 | #define GLFW_BLUE_BITS 0x00021003 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 844 | /*! @brief Framebuffer bit depth hint. |
| 845 | * |
| 846 | * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS). |
| 847 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 848 | #define GLFW_ALPHA_BITS 0x00021004 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 849 | /*! @brief Framebuffer bit depth hint. |
| 850 | * |
| 851 | * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS). |
| 852 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 853 | #define GLFW_DEPTH_BITS 0x00021005 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 854 | /*! @brief Framebuffer bit depth hint. |
| 855 | * |
| 856 | * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS). |
| 857 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 858 | #define GLFW_STENCIL_BITS 0x00021006 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 859 | /*! @brief Framebuffer bit depth hint. |
| 860 | * |
| 861 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS). |
| 862 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 863 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 864 | /*! @brief Framebuffer bit depth hint. |
| 865 | * |
| 866 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS). |
| 867 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 868 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 869 | /*! @brief Framebuffer bit depth hint. |
| 870 | * |
| 871 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS). |
| 872 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 873 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 874 | /*! @brief Framebuffer bit depth hint. |
| 875 | * |
| 876 | * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS). |
| 877 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 878 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 879 | /*! @brief Framebuffer auxiliary buffer hint. |
| 880 | * |
| 881 | * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS). |
| 882 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 883 | #define GLFW_AUX_BUFFERS 0x0002100B |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 884 | /*! @brief OpenGL stereoscopic rendering hint. |
| 885 | * |
| 886 | * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO). |
| 887 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 888 | #define GLFW_STEREO 0x0002100C |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 889 | /*! @brief Framebuffer MSAA samples hint. |
| 890 | * |
| 891 | * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES). |
| 892 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 893 | #define GLFW_SAMPLES 0x0002100D |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 894 | /*! @brief Framebuffer sRGB hint. |
| 895 | * |
| 896 | * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE). |
| 897 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 898 | #define GLFW_SRGB_CAPABLE 0x0002100E |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 899 | /*! @brief Monitor refresh rate hint. |
| 900 | * |
| 901 | * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE). |
| 902 | */ |
Camilla Berglund | 2cd3438 | 2013-05-30 20:42:50 +0200 | [diff] [blame] | 903 | #define GLFW_REFRESH_RATE 0x0002100F |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 904 | /*! @brief Framebuffer double buffering hint. |
| 905 | * |
| 906 | * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER). |
| 907 | */ |
Camilla Berglund | c980858 | 2014-04-24 19:21:10 +0200 | [diff] [blame] | 908 | #define GLFW_DOUBLEBUFFER 0x00021010 |
Bailey Cosier | 93e6666 | 2017-09-19 18:27:45 +0200 | [diff] [blame] | 909 | |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 910 | /*! @brief Context client API hint and attribute. |
| 911 | * |
| 912 | * Context client API [hint](@ref GLFW_CLIENT_API_hint) and |
| 913 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 914 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 915 | #define GLFW_CLIENT_API 0x00022001 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 916 | /*! @brief Context client API major version hint and attribute. |
| 917 | * |
| 918 | * Context client API major version [hint](@ref GLFW_CLIENT_API_hint) and |
| 919 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 920 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 921 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 922 | /*! @brief Context client API minor version hint and attribute. |
| 923 | * |
| 924 | * Context client API minor version [hint](@ref GLFW_CLIENT_API_hint) and |
| 925 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 926 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 927 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 928 | /*! @brief Context client API revision number hint and attribute. |
| 929 | * |
| 930 | * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and |
| 931 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 932 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 933 | #define GLFW_CONTEXT_REVISION 0x00022004 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 934 | /*! @brief Context robustness hint and attribute. |
| 935 | * |
| 936 | * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and |
| 937 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 938 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 939 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 940 | /*! @brief OpenGL forward-compatibility hint and attribute. |
| 941 | * |
| 942 | * OpenGL forward-compatibility [hint](@ref GLFW_CLIENT_API_hint) and |
| 943 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 944 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 945 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 946 | /*! @brief OpenGL debug context hint and attribute. |
| 947 | * |
| 948 | * OpenGL debug context [hint](@ref GLFW_CLIENT_API_hint) and |
| 949 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 950 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 951 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 952 | /*! @brief OpenGL profile hint and attribute. |
| 953 | * |
| 954 | * OpenGL profile [hint](@ref GLFW_CLIENT_API_hint) and |
| 955 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 956 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 957 | #define GLFW_OPENGL_PROFILE 0x00022008 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 958 | /*! @brief Context flush-on-release hint and attribute. |
| 959 | * |
| 960 | * Context flush-on-release [hint](@ref GLFW_CLIENT_API_hint) and |
| 961 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 962 | */ |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 963 | #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 964 | /*! @brief Context error suppression hint and attribute. |
| 965 | * |
| 966 | * Context error suppression [hint](@ref GLFW_CLIENT_API_hint) and |
| 967 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 968 | */ |
Camilla Berglund | 7be8209 | 2015-08-10 12:46:14 +0200 | [diff] [blame] | 969 | #define GLFW_CONTEXT_NO_ERROR 0x0002200A |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 970 | /*! @brief Context creation API hint and attribute. |
| 971 | * |
| 972 | * Context creation API [hint](@ref GLFW_CLIENT_API_hint) and |
| 973 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 974 | */ |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 975 | #define GLFW_CONTEXT_CREATION_API 0x0002200B |
Camilla Löwy | 089ea9a | 2018-08-31 13:33:48 +0200 | [diff] [blame] | 976 | /*! @brief Window content area scaling window |
| 977 | * [window hint](@ref GLFW_SCALE_TO_MONITOR). |
| 978 | */ |
| 979 | #define GLFW_SCALE_TO_MONITOR 0x0002200C |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 980 | |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 981 | #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001 |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 982 | #define GLFW_COCOA_FRAME_NAME 0x00023002 |
Camilla Löwy | 77a8f10 | 2017-01-27 12:02:09 +0100 | [diff] [blame] | 983 | #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003 |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 984 | |
| 985 | #define GLFW_X11_CLASS_NAME 0x00024001 |
| 986 | #define GLFW_X11_INSTANCE_NAME 0x00024002 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 987 | /*! @} */ |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 988 | |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 989 | #define GLFW_NO_API 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 990 | #define GLFW_OPENGL_API 0x00030001 |
| 991 | #define GLFW_OPENGL_ES_API 0x00030002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 992 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 993 | #define GLFW_NO_ROBUSTNESS 0 |
| 994 | #define GLFW_NO_RESET_NOTIFICATION 0x00031001 |
| 995 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 996 | |
Camilla Berglund | 44e8401 | 2013-06-05 16:13:30 +0200 | [diff] [blame] | 997 | #define GLFW_OPENGL_ANY_PROFILE 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 998 | #define GLFW_OPENGL_CORE_PROFILE 0x00032001 |
| 999 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1000 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1001 | #define GLFW_CURSOR 0x00033001 |
| 1002 | #define GLFW_STICKY_KEYS 0x00033002 |
| 1003 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 1004 | #define GLFW_LOCK_KEY_MODS 0x00033004 |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 1005 | #define GLFW_RAW_MOUSE_MOTION 0x00033005 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1006 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1007 | #define GLFW_CURSOR_NORMAL 0x00034001 |
| 1008 | #define GLFW_CURSOR_HIDDEN 0x00034002 |
| 1009 | #define GLFW_CURSOR_DISABLED 0x00034003 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1010 | |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 1011 | #define GLFW_ANY_RELEASE_BEHAVIOR 0 |
| 1012 | #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 |
| 1013 | #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 |
| 1014 | |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1015 | #define GLFW_NATIVE_CONTEXT_API 0x00036001 |
| 1016 | #define GLFW_EGL_CONTEXT_API 0x00036002 |
Camilla Löwy | e9560ef | 2017-02-28 19:23:25 +0100 | [diff] [blame] | 1017 | #define GLFW_OSMESA_CONTEXT_API 0x00036003 |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1018 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1019 | /*! @defgroup shapes Standard cursor shapes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 1020 | * @brief Standard system cursor shapes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1021 | * |
| 1022 | * See [standard cursor creation](@ref cursor_standard) for how these are used. |
| 1023 | * |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1024 | * @ingroup input |
| 1025 | * @{ */ |
| 1026 | |
| 1027 | /*! @brief The regular arrow cursor shape. |
| 1028 | * |
| 1029 | * The regular arrow cursor. |
| 1030 | */ |
| 1031 | #define GLFW_ARROW_CURSOR 0x00036001 |
| 1032 | /*! @brief The text input I-beam cursor shape. |
| 1033 | * |
| 1034 | * The text input I-beam cursor shape. |
| 1035 | */ |
| 1036 | #define GLFW_IBEAM_CURSOR 0x00036002 |
| 1037 | /*! @brief The crosshair shape. |
| 1038 | * |
| 1039 | * The crosshair shape. |
| 1040 | */ |
| 1041 | #define GLFW_CROSSHAIR_CURSOR 0x00036003 |
| 1042 | /*! @brief The hand shape. |
| 1043 | * |
| 1044 | * The hand shape. |
| 1045 | */ |
| 1046 | #define GLFW_HAND_CURSOR 0x00036004 |
| 1047 | /*! @brief The horizontal resize arrow shape. |
| 1048 | * |
| 1049 | * The horizontal resize arrow shape. |
| 1050 | */ |
| 1051 | #define GLFW_HRESIZE_CURSOR 0x00036005 |
| 1052 | /*! @brief The vertical resize arrow shape. |
| 1053 | * |
| 1054 | * The vertical resize arrow shape. |
| 1055 | */ |
| 1056 | #define GLFW_VRESIZE_CURSOR 0x00036006 |
| 1057 | /*! @} */ |
| 1058 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1059 | #define GLFW_CONNECTED 0x00040001 |
| 1060 | #define GLFW_DISCONNECTED 0x00040002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1061 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1062 | /*! @addtogroup init |
| 1063 | * @{ */ |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1064 | /*! @brief Joystick hat buttons init hint. |
| 1065 | * |
| 1066 | * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS) |
| 1067 | */ |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 1068 | #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001 |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1069 | /*! @brief macOS specific init hint. |
| 1070 | * |
| 1071 | * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES) |
| 1072 | */ |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1073 | #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001 |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1074 | /*! @brief macOS specific init hint. |
| 1075 | * |
| 1076 | * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR) |
| 1077 | */ |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1078 | #define GLFW_COCOA_MENUBAR 0x00051002 |
| 1079 | /*! @} */ |
| 1080 | |
Camilla Berglund | 2810130 | 2014-04-08 18:57:43 +0200 | [diff] [blame] | 1081 | #define GLFW_DONT_CARE -1 |
| 1082 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 1083 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1084 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1085 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1086 | *************************************************************************/ |
| 1087 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1088 | /*! @brief Client API function pointer type. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1089 | * |
| 1090 | * Generic function pointer used for returning client API function pointers |
| 1091 | * without forcing a cast from a regular pointer. |
| 1092 | * |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1093 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1094 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1095 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1096 | * @since Added in version 3.0. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 1097 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1098 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1099 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 1100 | typedef void (*GLFWglproc)(void); |
| 1101 | |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1102 | /*! @brief Vulkan API function pointer type. |
| 1103 | * |
| 1104 | * Generic function pointer used for returning Vulkan API function pointers |
| 1105 | * without forcing a cast from a regular pointer. |
| 1106 | * |
| 1107 | * @sa @ref vulkan_proc |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1108 | * @sa @ref glfwGetInstanceProcAddress |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1109 | * |
| 1110 | * @since Added in version 3.2. |
| 1111 | * |
| 1112 | * @ingroup vulkan |
| 1113 | */ |
| 1114 | typedef void (*GLFWvkproc)(void); |
| 1115 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1116 | /*! @brief Opaque monitor object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1117 | * |
| 1118 | * Opaque monitor object. |
| 1119 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1120 | * @see @ref monitor_object |
| 1121 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1122 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1123 | * |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1124 | * @ingroup monitor |
| 1125 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1126 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 1127 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1128 | /*! @brief Opaque window object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1129 | * |
| 1130 | * Opaque window object. |
| 1131 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1132 | * @see @ref window_object |
| 1133 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1134 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1135 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1136 | * @ingroup window |
| 1137 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1138 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1139 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1140 | /*! @brief Opaque cursor object. |
| 1141 | * |
| 1142 | * Opaque cursor object. |
| 1143 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1144 | * @see @ref cursor_object |
| 1145 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1146 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1147 | * |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1148 | * @ingroup input |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1149 | */ |
| 1150 | typedef struct GLFWcursor GLFWcursor; |
| 1151 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1152 | /*! @brief The function signature for error callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1153 | * |
| 1154 | * This is the function signature for error callback functions. |
| 1155 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1156 | * @param[in] error An [error code](@ref errors). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1157 | * @param[in] description A UTF-8 encoded string describing the error. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1158 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1159 | * @sa @ref error_handling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1160 | * @sa @ref glfwSetErrorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1161 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1162 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1163 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1164 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1165 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 1166 | typedef void (* GLFWerrorfun)(int,const char*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1167 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1168 | /*! @brief The function signature for window position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1169 | * |
| 1170 | * This is the function signature for window position callback functions. |
| 1171 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1172 | * @param[in] window The window that was moved. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1173 | * @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] | 1174 | * upper-left corner of the content area of the window. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1175 | * @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] | 1176 | * upper-left corner of the content area of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1177 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1178 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1179 | * @sa @ref glfwSetWindowPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1180 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1181 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1182 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1183 | * @ingroup window |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1184 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1185 | typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1186 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1187 | /*! @brief The function signature for window resize callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1188 | * |
| 1189 | * This is the function signature for window size callback functions. |
| 1190 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1191 | * @param[in] window The window that was resized. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1192 | * @param[in] width The new width, in screen coordinates, of the window. |
| 1193 | * @param[in] height The new height, in screen coordinates, of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1194 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1195 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1196 | * @sa @ref glfwSetWindowSizeCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1197 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1198 | * @since Added in version 1.0. |
| 1199 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1200 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1201 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1202 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1203 | typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1204 | |
| 1205 | /*! @brief The function signature for window close callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1206 | * |
| 1207 | * This is the function signature for window close callback functions. |
| 1208 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1209 | * @param[in] window The window that the user attempted to close. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1210 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1211 | * @sa @ref window_close |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1212 | * @sa @ref glfwSetWindowCloseCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1213 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1214 | * @since Added in version 2.5. |
| 1215 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1216 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1217 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1218 | */ |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1219 | typedef void (* GLFWwindowclosefun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1220 | |
| 1221 | /*! @brief The function signature for window content refresh callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1222 | * |
| 1223 | * This is the function signature for window refresh callback functions. |
| 1224 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1225 | * @param[in] window The window whose content needs to be refreshed. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1226 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1227 | * @sa @ref window_refresh |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1228 | * @sa @ref glfwSetWindowRefreshCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1229 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1230 | * @since Added in version 2.5. |
| 1231 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1232 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1233 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1234 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1235 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1236 | |
| 1237 | /*! @brief The function signature for window focus/defocus callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1238 | * |
| 1239 | * This is the function signature for window focus callback functions. |
| 1240 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1241 | * @param[in] window The window that gained or lost input focus. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1242 | * @param[in] focused `GLFW_TRUE` if the window was given input focus, or |
| 1243 | * `GLFW_FALSE` if it lost it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1244 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1245 | * @sa @ref window_focus |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1246 | * @sa @ref glfwSetWindowFocusCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1247 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1248 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1249 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1250 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1251 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1252 | typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1253 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 1254 | /*! @brief The function signature for window iconify/restore callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1255 | * |
| 1256 | * This is the function signature for window iconify/restore callback |
| 1257 | * functions. |
| 1258 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1259 | * @param[in] window The window that was iconified or restored. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1260 | * @param[in] iconified `GLFW_TRUE` if the window was iconified, or |
| 1261 | * `GLFW_FALSE` if it was restored. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1262 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1263 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1264 | * @sa @ref glfwSetWindowIconifyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1265 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1266 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1267 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1268 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1269 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1270 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1271 | |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1272 | /*! @brief The function signature for window maximize/restore callbacks. |
| 1273 | * |
| 1274 | * This is the function signature for window maximize/restore callback |
| 1275 | * functions. |
| 1276 | * |
| 1277 | * @param[in] window The window that was maximized or restored. |
| 1278 | * @param[in] iconified `GLFW_TRUE` if the window was maximized, or |
| 1279 | * `GLFW_FALSE` if it was restored. |
| 1280 | * |
| 1281 | * @sa @ref window_maximize |
| 1282 | * @sa glfwSetWindowMaximizeCallback |
| 1283 | * |
| 1284 | * @since Added in version 3.3. |
| 1285 | * |
| 1286 | * @ingroup window |
| 1287 | */ |
| 1288 | typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int); |
| 1289 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1290 | /*! @brief The function signature for framebuffer resize callbacks. |
| 1291 | * |
| 1292 | * This is the function signature for framebuffer resize callback |
| 1293 | * functions. |
| 1294 | * |
| 1295 | * @param[in] window The window whose framebuffer was resized. |
| 1296 | * @param[in] width The new width, in pixels, of the framebuffer. |
| 1297 | * @param[in] height The new height, in pixels, of the framebuffer. |
| 1298 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1299 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1300 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1301 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1302 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1303 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1304 | * @ingroup window |
| 1305 | */ |
| 1306 | typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); |
| 1307 | |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1308 | /*! @brief The function signature for window content scale callbacks. |
| 1309 | * |
| 1310 | * This is the function signature for window content scale callback |
| 1311 | * functions. |
| 1312 | * |
| 1313 | * @param[in] window The window whose content scale changed. |
| 1314 | * @param[in] xscale The new x-axis content scale of the window. |
| 1315 | * @param[in] yscale The new y-axis content scale of the window. |
| 1316 | * |
| 1317 | * @sa @ref window_scale |
| 1318 | * @sa @ref glfwSetWindowContentScaleCallback |
| 1319 | * |
| 1320 | * @since Added in version 3.3. |
| 1321 | * |
| 1322 | * @ingroup window |
| 1323 | */ |
| 1324 | typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float); |
| 1325 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1326 | /*! @brief The function signature for mouse button callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1327 | * |
| 1328 | * This is the function signature for mouse button callback functions. |
| 1329 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1330 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1331 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
| 1332 | * released. |
| 1333 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1334 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1335 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1336 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1337 | * @sa @ref input_mouse_button |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1338 | * @sa @ref glfwSetMouseButtonCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1339 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1340 | * @since Added in version 1.0. |
| 1341 | * @glfw3 Added window handle and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1342 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1343 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1344 | */ |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 1345 | typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1346 | |
| 1347 | /*! @brief The function signature for cursor position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1348 | * |
| 1349 | * This is the function signature for cursor position callback functions. |
| 1350 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1351 | * @param[in] window The window that received the event. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1352 | * @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] | 1353 | * the content area. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1354 | * @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] | 1355 | * content area. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1356 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1357 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1358 | * @sa @ref glfwSetCursorPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1359 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1360 | * @since Added in version 3.0. Replaces `GLFWmouseposfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1361 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1362 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1363 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 1364 | typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1365 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1366 | /*! @brief The function signature for cursor enter/leave callbacks. |
| 1367 | * |
| 1368 | * This is the function signature for cursor enter/leave callback functions. |
| 1369 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1370 | * @param[in] window The window that received the event. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 1371 | * @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] | 1372 | * area, or `GLFW_FALSE` if it left it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1373 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1374 | * @sa @ref cursor_enter |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1375 | * @sa @ref glfwSetCursorEnterCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1376 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1377 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1378 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1379 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1380 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1381 | typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1382 | |
| 1383 | /*! @brief The function signature for scroll callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1384 | * |
| 1385 | * This is the function signature for scroll callback functions. |
| 1386 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1387 | * @param[in] window The window that received the event. |
mewmew | cf2d260 | 2013-06-06 19:49:23 +0200 | [diff] [blame] | 1388 | * @param[in] xoffset The scroll offset along the x-axis. |
| 1389 | * @param[in] yoffset The scroll offset along the y-axis. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1390 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1391 | * @sa @ref scrolling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1392 | * @sa @ref glfwSetScrollCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1393 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1394 | * @since Added in version 3.0. Replaces `GLFWmousewheelfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1395 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1396 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1397 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1398 | typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1399 | |
| 1400 | /*! @brief The function signature for keyboard key callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1401 | * |
| 1402 | * This is the function signature for keyboard key callback functions. |
| 1403 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1404 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1405 | * @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] | 1406 | * @param[in] scancode The system-specific scancode of the key. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1407 | * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1408 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1409 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1410 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1411 | * @sa @ref input_key |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1412 | * @sa @ref glfwSetKeyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1413 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1414 | * @since Added in version 1.0. |
| 1415 | * @glfw3 Added window handle, scancode and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1416 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1417 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1418 | */ |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 1419 | typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1420 | |
| 1421 | /*! @brief The function signature for Unicode character callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1422 | * |
| 1423 | * This is the function signature for Unicode character callback functions. |
| 1424 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1425 | * @param[in] window The window that received the event. |
Camilla Berglund | 2c920fb | 2013-10-10 19:41:56 +0200 | [diff] [blame] | 1426 | * @param[in] codepoint The Unicode code point of the character. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1427 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1428 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1429 | * @sa @ref glfwSetCharCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1430 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1431 | * @since Added in version 2.4. |
| 1432 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1433 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1434 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1435 | */ |
Camilla Berglund | 182e0af | 2013-02-25 17:02:28 +0100 | [diff] [blame] | 1436 | typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1437 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1438 | /*! @brief The function signature for Unicode character with modifiers |
| 1439 | * callbacks. |
| 1440 | * |
| 1441 | * This is the function signature for Unicode character with modifiers callback |
| 1442 | * functions. It is called for each input character, regardless of what |
| 1443 | * modifier keys are held down. |
| 1444 | * |
| 1445 | * @param[in] window The window that received the event. |
| 1446 | * @param[in] codepoint The Unicode code point of the character. |
| 1447 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1448 | * held down. |
| 1449 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1450 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1451 | * @sa @ref glfwSetCharModsCallback |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1452 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 1453 | * @deprecated Scheduled for removal in version 4.0. |
| 1454 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1455 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1456 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1457 | * @ingroup input |
| 1458 | */ |
| 1459 | typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); |
| 1460 | |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1461 | /*! @brief The function signature for file drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1462 | * |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1463 | * This is the function signature for file drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1464 | * |
| 1465 | * @param[in] window The window that received the event. |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1466 | * @param[in] count The number of dropped files. |
Camilla Berglund | 93855ae | 2015-01-27 23:04:22 +0100 | [diff] [blame] | 1467 | * @param[in] paths The UTF-8 encoded file and/or directory path names. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1468 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1469 | * @sa @ref path_drop |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1470 | * @sa @ref glfwSetDropCallback |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1471 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1472 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1473 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1474 | * @ingroup input |
| 1475 | */ |
Camilla Berglund | 8f349e8 | 2013-12-22 19:28:46 +0100 | [diff] [blame] | 1476 | typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**); |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1477 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1478 | /*! @brief The function signature for monitor configuration callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1479 | * |
| 1480 | * This is the function signature for monitor configuration callback functions. |
| 1481 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1482 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Löwy | b020467 | 2018-02-06 13:10:08 +0100 | [diff] [blame] | 1483 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Remaining |
| 1484 | * values reserved for future use. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1485 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1486 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1487 | * @sa @ref glfwSetMonitorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1488 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1489 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1490 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1491 | * @ingroup monitor |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1492 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1493 | typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 1494 | |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1495 | /*! @brief The function signature for joystick configuration callbacks. |
| 1496 | * |
| 1497 | * This is the function signature for joystick configuration callback |
| 1498 | * functions. |
| 1499 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 1500 | * @param[in] jid The joystick that was connected or disconnected. |
Camilla Löwy | b020467 | 2018-02-06 13:10:08 +0100 | [diff] [blame] | 1501 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Remaining |
| 1502 | * values reserved for future use. |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1503 | * |
| 1504 | * @sa @ref joystick_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1505 | * @sa @ref glfwSetJoystickCallback |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1506 | * |
| 1507 | * @since Added in version 3.2. |
| 1508 | * |
| 1509 | * @ingroup input |
| 1510 | */ |
| 1511 | typedef void (* GLFWjoystickfun)(int,int); |
| 1512 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1513 | /*! @brief Video mode type. |
| 1514 | * |
| 1515 | * This describes a single video mode. |
| 1516 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1517 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1518 | * @sa @ref glfwGetVideoMode |
| 1519 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1520 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1521 | * @since Added in version 1.0. |
| 1522 | * @glfw3 Added refresh rate member. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1523 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1524 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1525 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1526 | typedef struct GLFWvidmode |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1527 | { |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1528 | /*! The width, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1529 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1530 | int width; |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1531 | /*! The height, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1532 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1533 | int height; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1534 | /*! The bit depth of the red channel of the video mode. |
| 1535 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1536 | int redBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1537 | /*! The bit depth of the green channel of the video mode. |
| 1538 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1539 | int greenBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1540 | /*! The bit depth of the blue channel of the video mode. |
| 1541 | */ |
Camilla Berglund | 2e8446f | 2013-04-11 01:31:00 +0200 | [diff] [blame] | 1542 | int blueBits; |
Camilla Berglund | 731812c | 2013-05-30 15:52:42 +0200 | [diff] [blame] | 1543 | /*! The refresh rate, in Hz, of the video mode. |
| 1544 | */ |
| 1545 | int refreshRate; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1546 | } GLFWvidmode; |
| 1547 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1548 | /*! @brief Gamma ramp. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1549 | * |
| 1550 | * This describes the gamma ramp for a monitor. |
| 1551 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1552 | * @sa @ref monitor_gamma |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1553 | * @sa @ref glfwGetGammaRamp |
| 1554 | * @sa @ref glfwSetGammaRamp |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1555 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1556 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1557 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1558 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1559 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1560 | typedef struct GLFWgammaramp |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1561 | { |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1562 | /*! An array of value describing the response of the red channel. |
| 1563 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1564 | unsigned short* red; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1565 | /*! An array of value describing the response of the green channel. |
| 1566 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1567 | unsigned short* green; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1568 | /*! An array of value describing the response of the blue channel. |
| 1569 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1570 | unsigned short* blue; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1571 | /*! The number of elements in each array. |
| 1572 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1573 | unsigned int size; |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1574 | } GLFWgammaramp; |
| 1575 | |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 1576 | /*! @brief Image data. |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1577 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 1578 | * This describes a single 2D image. See the documentation for each related |
| 1579 | * function what the expected pixel format is. |
| 1580 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1581 | * @sa @ref cursor_custom |
Camilla Berglund | fe0317a | 2016-08-01 11:51:30 +0200 | [diff] [blame] | 1582 | * @sa @ref window_icon |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1583 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1584 | * @since Added in version 2.1. |
| 1585 | * @glfw3 Removed format and bytes-per-pixel members. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1586 | * |
| 1587 | * @ingroup window |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 1588 | */ |
| 1589 | typedef struct GLFWimage |
| 1590 | { |
| 1591 | /*! The width, in pixels, of this image. |
| 1592 | */ |
| 1593 | int width; |
| 1594 | /*! The height, in pixels, of this image. |
| 1595 | */ |
| 1596 | int height; |
| 1597 | /*! The pixel data of this image, arranged left-to-right, top-to-bottom. |
| 1598 | */ |
| 1599 | unsigned char* pixels; |
| 1600 | } GLFWimage; |
| 1601 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 1602 | /*! @brief Gamepad input state |
| 1603 | * |
| 1604 | * This describes the input state of a gamepad. |
| 1605 | * |
| 1606 | * @sa @ref gamepad |
| 1607 | * @sa @ref glfwGetGamepadState |
| 1608 | * |
| 1609 | * @since Added in version 3.3. |
Camilla Löwy | 0411678 | 2018-11-05 17:37:49 +0100 | [diff] [blame] | 1610 | * |
| 1611 | * @ingroup input |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 1612 | */ |
| 1613 | typedef struct GLFWgamepadstate |
| 1614 | { |
| 1615 | /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS` |
| 1616 | * or `GLFW_RELEASE`. |
| 1617 | */ |
Camilla Löwy | 2d8d8f5 | 2017-07-17 21:18:15 +0200 | [diff] [blame] | 1618 | unsigned char buttons[15]; |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 1619 | /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0 |
| 1620 | * to 1.0 inclusive. |
| 1621 | */ |
| 1622 | float axes[6]; |
| 1623 | } GLFWgamepadstate; |
| 1624 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1625 | |
| 1626 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1627 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1628 | *************************************************************************/ |
| 1629 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1630 | /*! @brief Initializes the GLFW library. |
| 1631 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1632 | * This function initializes the GLFW library. Before most GLFW functions can |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1633 | * be used, GLFW must be initialized, and before an application terminates GLFW |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1634 | * should be terminated in order to free any resources allocated during or |
| 1635 | * after initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1636 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1637 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1638 | * succeeds, you should call @ref glfwTerminate before the application exits. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1639 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1640 | * Additional calls to this function after successful initialization but before |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1641 | * termination will return `GLFW_TRUE` immediately. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1642 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1643 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1644 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1645 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1646 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
| 1647 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 1648 | * @remark @macos This function will change the current directory of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1649 | * application to the `Contents/Resources` subdirectory of the application's |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1650 | * bundle, if present. This can be disabled with the @ref |
| 1651 | * GLFW_COCOA_CHDIR_RESOURCES init hint. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1652 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1653 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1654 | * |
| 1655 | * @sa @ref intro_init |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1656 | * @sa @ref glfwTerminate |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1657 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1658 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1659 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1660 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1661 | */ |
| 1662 | GLFWAPI int glfwInit(void); |
| 1663 | |
| 1664 | /*! @brief Terminates the GLFW library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1665 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1666 | * This function destroys all remaining windows and cursors, restores any |
| 1667 | * modified gamma ramps and frees any other allocated resources. Once this |
| 1668 | * function is called, you must again call @ref glfwInit successfully before |
| 1669 | * you will be able to use most GLFW functions. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1670 | * |
| 1671 | * If GLFW has been successfully initialized, this function should be called |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1672 | * before the application exits. If initialization fails, there is no need to |
| 1673 | * call this function, as it is called by @ref glfwInit before it returns |
| 1674 | * failure. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1675 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1676 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
| 1677 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1678 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1679 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 1680 | * @warning The contexts of any remaining windows must not be current on any |
| 1681 | * other thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1682 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1683 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 1684 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1685 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1686 | * |
| 1687 | * @sa @ref intro_init |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1688 | * @sa @ref glfwInit |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1689 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1690 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1691 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1692 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1693 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1694 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1695 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1696 | /*! @brief Sets the specified init hint to the desired value. |
| 1697 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 1698 | * This function sets hints for the next initialization of GLFW. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1699 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 1700 | * The values you set hints to are never reset by GLFW, but they only take |
| 1701 | * effect during initialization. Once GLFW has been initialized, any values |
| 1702 | * you set will be ignored until the library is terminated and initialized |
| 1703 | * again. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1704 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 1705 | * 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] | 1706 | * will only affect their specific platform. Other platforms will ignore them. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 1707 | * Setting these hints requires no platform specific headers or functions. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1708 | * |
| 1709 | * @param[in] hint The [init hint](@ref init_hints) to set. |
| 1710 | * @param[in] value The new value of the init hint. |
| 1711 | * |
| 1712 | * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref |
| 1713 | * GLFW_INVALID_VALUE. |
| 1714 | * |
| 1715 | * @remarks This function may be called before @ref glfwInit. |
| 1716 | * |
| 1717 | * @thread_safety This function must only be called from the main thread. |
| 1718 | * |
| 1719 | * @sa init_hints |
| 1720 | * @sa glfwInit |
| 1721 | * |
| 1722 | * @since Added in version 3.3. |
| 1723 | * |
| 1724 | * @ingroup init |
| 1725 | */ |
| 1726 | GLFWAPI void glfwInitHint(int hint, int value); |
| 1727 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1728 | /*! @brief Retrieves the version of the GLFW library. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1729 | * |
| 1730 | * This function retrieves the major, minor and revision numbers of the GLFW |
| 1731 | * library. It is intended for when you are using GLFW as a shared library and |
| 1732 | * want to ensure that you are using the minimum required version. |
| 1733 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1734 | * Any or all of the version arguments may be `NULL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1735 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1736 | * @param[out] major Where to store the major version number, or `NULL`. |
| 1737 | * @param[out] minor Where to store the minor version number, or `NULL`. |
| 1738 | * @param[out] rev Where to store the revision number, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1739 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1740 | * @errors None. |
| 1741 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1742 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1743 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1744 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1745 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1746 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1747 | * @sa @ref glfwGetVersionString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1748 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1749 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1750 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1751 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1752 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1753 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1754 | |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 1755 | /*! @brief Returns a string describing the compile-time configuration. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1756 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1757 | * This function returns the compile-time generated |
| 1758 | * [version string](@ref intro_version_string) of the GLFW library binary. It |
| 1759 | * describes the version, platform, compiler and any platform-specific |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 1760 | * compile-time options. It should not be confused with the OpenGL or OpenGL |
| 1761 | * ES version string, queried with `glGetString`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1762 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1763 | * __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] | 1764 | * @ref glfwGetVersion function provides the version of the running library |
| 1765 | * binary in numerical format. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1766 | * |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 1767 | * @return The ASCII encoded GLFW version string. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1768 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1769 | * @errors None. |
| 1770 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1771 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1772 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1773 | * @pointer_lifetime The returned string is static and compile-time generated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1774 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1775 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1776 | * |
| 1777 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1778 | * @sa @ref glfwGetVersion |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1779 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1780 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1781 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1782 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1783 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 1784 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1785 | |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1786 | /*! @brief Returns and clears the last error for the calling thread. |
| 1787 | * |
Camilla Löwy | 2e9aff7 | 2017-07-09 14:46:39 +0200 | [diff] [blame] | 1788 | * 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] | 1789 | * error that occurred on the calling thread, and optionally a UTF-8 encoded |
| 1790 | * 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] | 1791 | * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is |
| 1792 | * set to `NULL`. |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1793 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1794 | * @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] | 1795 | * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR |
| 1796 | * (zero). |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1797 | * |
| 1798 | * @errors None. |
| 1799 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1800 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 1801 | * should not free it yourself. It is guaranteed to be valid only until the |
| 1802 | * next error occurs or the library is terminated. |
| 1803 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1804 | * @remark This function may be called before @ref glfwInit. |
| 1805 | * |
| 1806 | * @thread_safety This function may be called from any thread. |
| 1807 | * |
| 1808 | * @sa @ref error_handling |
| 1809 | * @sa @ref glfwSetErrorCallback |
| 1810 | * |
| 1811 | * @since Added in version 3.3. |
| 1812 | * |
| 1813 | * @ingroup init |
| 1814 | */ |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1815 | GLFWAPI int glfwGetError(const char** description); |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1816 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1817 | /*! @brief Sets the error callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1818 | * |
| 1819 | * This function sets the error callback, which is called with an error code |
| 1820 | * and a human-readable description each time a GLFW error occurs. |
| 1821 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1822 | * The error code is set before the callback is called. Calling @ref |
| 1823 | * glfwGetError from the error callback will return the same value as the error |
| 1824 | * code argument. |
| 1825 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1826 | * The error callback is called on the thread where the error occurred. If you |
| 1827 | * are using GLFW from multiple threads, your error callback needs to be |
| 1828 | * written accordingly. |
| 1829 | * |
| 1830 | * Because the description string may have been generated specifically for that |
| 1831 | * error, it is not guaranteed to be valid after the callback has returned. If |
| 1832 | * you wish to use it after the callback returns, you need to make a copy. |
| 1833 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 1834 | * Once set, the error callback remains set even after the library has been |
| 1835 | * terminated. |
| 1836 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1837 | * @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] | 1838 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1839 | * @return The previously set callback, or `NULL` if no callback was set. |
| 1840 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1841 | * @errors None. |
| 1842 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1843 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1844 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1845 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1846 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1847 | * @sa @ref error_handling |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1848 | * @sa @ref glfwGetError |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1849 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1850 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1851 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1852 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1853 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1854 | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 1855 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1856 | /*! @brief Returns the currently connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1857 | * |
| 1858 | * This function returns an array of handles for all currently connected |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1859 | * monitors. The primary monitor is always first in the returned array. If no |
| 1860 | * monitors were found, this function returns `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1861 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1862 | * @param[out] count Where to store the number of monitors in the returned |
| 1863 | * array. This is set to zero if an error occurred. |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1864 | * @return An array of monitor handles, or `NULL` if no monitors were found or |
| 1865 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1866 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1867 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 1868 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1869 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 1870 | * should not free it yourself. It is guaranteed to be valid only until the |
| 1871 | * monitor configuration changes or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1872 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1873 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1874 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1875 | * @sa @ref monitor_monitors |
| 1876 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1877 | * @sa @ref glfwGetPrimaryMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1878 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1879 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1880 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1881 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1882 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1883 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1884 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1885 | /*! @brief Returns the primary monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1886 | * |
| 1887 | * This function returns the primary monitor. This is usually the monitor |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1888 | * where elements like the task bar or global menu bar are located. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1889 | * |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1890 | * @return The primary monitor, or `NULL` if no monitors were found or if an |
| 1891 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1892 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1893 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 1894 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1895 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1896 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1897 | * @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] | 1898 | * glfwGetMonitors. |
| 1899 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1900 | * @sa @ref monitor_monitors |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1901 | * @sa @ref glfwGetMonitors |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1902 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1903 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1904 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1905 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1906 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1907 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1908 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1909 | /*! @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] | 1910 | * |
| 1911 | * This function returns the position, in screen coordinates, of the upper-left |
| 1912 | * corner of the specified monitor. |
| 1913 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1914 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 1915 | * non-`NULL` position arguments will be set to zero. |
| 1916 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1917 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1918 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 1919 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1920 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1921 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 1922 | * GLFW_PLATFORM_ERROR. |
| 1923 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1924 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1925 | * |
| 1926 | * @sa @ref monitor_properties |
| 1927 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1928 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1929 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1930 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1931 | */ |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1932 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
| 1933 | |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 1934 | /*! @brief Returns the work area of the monitor. |
| 1935 | * |
| 1936 | * 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^] | 1937 | * corner of the work area of the specified monitor along with the work area |
| 1938 | * size in screen coordinates. The work area is defined as the area of the |
| 1939 | * monitor not occluded by the operating system task bar where present. If no |
| 1940 | * task bar exists then the work area is the monitor resolution in screen |
| 1941 | * coordinates. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 1942 | * |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame^] | 1943 | * Any or all of the position and size arguments may be `NULL`. If an error |
| 1944 | * 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] | 1945 | * |
| 1946 | * @param[in] monitor The monitor to query. |
| 1947 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 1948 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Doug Binks | 3fd70cc | 2018-09-08 17:16:07 +0200 | [diff] [blame] | 1949 | * @param[out] width Where to store the monitor width, or `NULL`. |
| 1950 | * @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] | 1951 | * |
| 1952 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 1953 | * GLFW_PLATFORM_ERROR. |
| 1954 | * |
| 1955 | * @thread_safety This function must only be called from the main thread. |
| 1956 | * |
| 1957 | * @sa @ref monitor_properties |
| 1958 | * |
Doug Binks | 6907629 | 2018-09-08 17:24:20 +0200 | [diff] [blame] | 1959 | * @since Added in version 3.3. |
Felipe Ferreira da Silva | be295cc | 2017-04-06 16:48:08 -0300 | [diff] [blame] | 1960 | * |
| 1961 | * @ingroup monitor |
| 1962 | */ |
Camilla Löwy | 0118743 | 2019-02-25 14:01:08 +0100 | [diff] [blame^] | 1963 | 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] | 1964 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1965 | /*! @brief Returns the physical size of the monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1966 | * |
| 1967 | * This function returns the size, in millimetres, of the display area of the |
| 1968 | * specified monitor. |
| 1969 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1970 | * Some systems do not provide accurate monitor size information, either |
| 1971 | * because the monitor |
| 1972 | * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) |
| 1973 | * data is incorrect or because the driver does not report it accurately. |
| 1974 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1975 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 1976 | * non-`NULL` size arguments will be set to zero. |
| 1977 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1978 | * @param[in] monitor The monitor to query. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1979 | * @param[out] widthMM Where to store the width, in millimetres, of the |
| 1980 | * monitor's display area, or `NULL`. |
| 1981 | * @param[out] heightMM Where to store the height, in millimetres, of the |
| 1982 | * monitor's display area, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1983 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1984 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 1985 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1986 | * @remark @win32 calculates the returned physical size from the |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1987 | * current resolution and system DPI instead of querying the monitor EDID data. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1988 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1989 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1990 | * |
| 1991 | * @sa @ref monitor_properties |
| 1992 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1993 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1994 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1995 | * @ingroup monitor |
| 1996 | */ |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1997 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1998 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 1999 | /*! @brief Retrieves the content scale for the specified monitor. |
| 2000 | * |
| 2001 | * This function retrieves the content scale for the specified monitor. The |
| 2002 | * content scale is the ratio between the current DPI and the platform's |
| 2003 | * default DPI. If you scale all pixel dimensions by this scale then your |
| 2004 | * content should appear at an appropriate size. This is especially important |
| 2005 | * for text and any UI elements. |
| 2006 | * |
| 2007 | * The content scale may depend on both the monitor resolution and pixel |
| 2008 | * density and on user settings. It may be very different from the raw DPI |
| 2009 | * calculated from the physical size and current resolution. |
| 2010 | * |
| 2011 | * @param[in] monitor The monitor to query. |
| 2012 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 2013 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 2014 | * |
| 2015 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2016 | * GLFW_PLATFORM_ERROR. |
| 2017 | * |
| 2018 | * @thread_safety This function must only be called from the main thread. |
| 2019 | * |
| 2020 | * @sa @ref monitor_scale |
| 2021 | * @sa @ref glfwGetWindowContentScale |
| 2022 | * |
| 2023 | * @since Added in version 3.3. |
| 2024 | * |
| 2025 | * @ingroup monitor |
| 2026 | */ |
| 2027 | GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); |
| 2028 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2029 | /*! @brief Returns the name of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2030 | * |
| 2031 | * 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] | 2032 | * specified monitor. The name typically reflects the make and model of the |
| 2033 | * monitor and is not guaranteed to be unique among the connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2034 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2035 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2036 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an |
| 2037 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2038 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2039 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2040 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2041 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 2042 | * should not free it yourself. It is valid until the specified monitor is |
| 2043 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2044 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2045 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2046 | * |
| 2047 | * @sa @ref monitor_properties |
| 2048 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2049 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2050 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2051 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2052 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2053 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2054 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 2055 | /*! @brief Sets the user pointer of the specified monitor. |
| 2056 | * |
| 2057 | * This function sets the user-defined pointer of the specified monitor. The |
| 2058 | * current value is retained until the monitor is disconnected. The initial |
| 2059 | * value is `NULL`. |
| 2060 | * |
| 2061 | * This function may be called from the monitor callback, even for a monitor |
| 2062 | * that is being disconnected. |
| 2063 | * |
| 2064 | * @param[in] monitor The monitor whose pointer to set. |
| 2065 | * @param[in] pointer The new value. |
| 2066 | * |
| 2067 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2068 | * |
| 2069 | * @thread_safety This function may be called from any thread. Access is not |
| 2070 | * synchronized. |
| 2071 | * |
| 2072 | * @sa @ref monitor_userptr |
| 2073 | * @sa @ref glfwGetMonitorUserPointer |
| 2074 | * |
| 2075 | * @since Added in version 3.3. |
| 2076 | * |
| 2077 | * @ingroup monitor |
| 2078 | */ |
| 2079 | GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); |
| 2080 | |
| 2081 | /*! @brief Returns the user pointer of the specified monitor. |
| 2082 | * |
| 2083 | * This function returns the current value of the user-defined pointer of the |
| 2084 | * specified monitor. The initial value is `NULL`. |
| 2085 | * |
| 2086 | * This function may be called from the monitor callback, even for a monitor |
| 2087 | * that is being disconnected. |
| 2088 | * |
| 2089 | * @param[in] monitor The monitor whose pointer to return. |
| 2090 | * |
| 2091 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2092 | * |
| 2093 | * @thread_safety This function may be called from any thread. Access is not |
| 2094 | * synchronized. |
| 2095 | * |
| 2096 | * @sa @ref monitor_userptr |
| 2097 | * @sa @ref glfwSetMonitorUserPointer |
| 2098 | * |
| 2099 | * @since Added in version 3.3. |
| 2100 | * |
| 2101 | * @ingroup monitor |
| 2102 | */ |
| 2103 | GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); |
| 2104 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2105 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2106 | * |
| 2107 | * This function sets the monitor configuration callback, or removes the |
| 2108 | * currently set callback. This is called when a monitor is connected to or |
| 2109 | * disconnected from the system. |
| 2110 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2111 | * @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] | 2112 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2113 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2114 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2115 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2116 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2117 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2118 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2119 | * |
| 2120 | * @sa @ref monitor_event |
| 2121 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2122 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2123 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2124 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2125 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2126 | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 2127 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2128 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2129 | * |
| 2130 | * 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] | 2131 | * monitor. The returned array is sorted in ascending order, first by color |
| 2132 | * bit depth (the sum of all channel depths) and then by resolution area (the |
| 2133 | * product of width and height). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2134 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2135 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2136 | * @param[out] count Where to store the number of video modes in the returned |
| 2137 | * array. This is set to zero if an error occurred. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2138 | * @return An array of video modes, or `NULL` if an |
| 2139 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2140 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2141 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2142 | * GLFW_PLATFORM_ERROR. |
| 2143 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2144 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2145 | * should not free it yourself. It is valid until the specified monitor is |
| 2146 | * disconnected, this function is called again for that monitor or the library |
| 2147 | * is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2148 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2149 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2150 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2151 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2152 | * @sa @ref glfwGetVideoMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2153 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2154 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2155 | * @glfw3 Changed to return an array of modes for a specific monitor. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2156 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2157 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2158 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2159 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2160 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2161 | /*! @brief Returns the current mode of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2162 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2163 | * This function returns the current video mode of the specified monitor. If |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2164 | * you have created a full screen window for that monitor, the return value |
| 2165 | * will depend on whether that window is iconified. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2166 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2167 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2168 | * @return The current mode of the monitor, or `NULL` if an |
| 2169 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2170 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2171 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2172 | * GLFW_PLATFORM_ERROR. |
| 2173 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2174 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2175 | * should not free it yourself. It is valid until the specified monitor is |
| 2176 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2177 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2178 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2179 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2180 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2181 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2182 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2183 | * @since Added in version 3.0. Replaces `glfwGetDesktopMode`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2184 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2185 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2186 | */ |
Camilla Berglund | ce1e84d | 2013-05-22 22:16:43 +0200 | [diff] [blame] | 2187 | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2188 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2189 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2190 | * |
Camilla Löwy | 3531c32 | 2018-12-17 17:40:18 +0100 | [diff] [blame] | 2191 | * This function generates an appropriately sized gamma ramp from the specified |
| 2192 | * exponent and then calls @ref glfwSetGammaRamp with it. The value must be |
| 2193 | * a finite number greater than zero. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2194 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2195 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2196 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2197 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2198 | * the default (usually sRGB-like) behavior. |
| 2199 | * |
| 2200 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2201 | * GLFW_SRGB_CAPABLE hint. |
| 2202 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2203 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 2204 | * @param[in] gamma The desired exponent. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2205 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2206 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2207 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 2208 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2209 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2210 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2211 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2212 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2213 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2214 | * @sa @ref monitor_gamma |
| 2215 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2216 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2217 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2218 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2219 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2220 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2221 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2222 | /*! @brief Returns the current gamma ramp for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2223 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2224 | * This function returns the current gamma ramp of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2225 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2226 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2227 | * @return The current gamma ramp, or `NULL` if an |
| 2228 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2229 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2230 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2231 | * GLFW_PLATFORM_ERROR. |
| 2232 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2233 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2234 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while |
| 2235 | * returning `NULL`. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2236 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2237 | * @pointer_lifetime The returned structure and its arrays are allocated and |
| 2238 | * freed by GLFW. You should not free them yourself. They are valid until the |
| 2239 | * specified monitor is disconnected, this function is called again for that |
| 2240 | * monitor or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2241 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2242 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2243 | * |
| 2244 | * @sa @ref monitor_gamma |
| 2245 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2246 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2247 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2248 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2249 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2250 | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2251 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2252 | /*! @brief Sets the current gamma ramp for the specified monitor. |
| 2253 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2254 | * This function sets the current gamma ramp for the specified monitor. The |
| 2255 | * original gamma ramp for that monitor is saved by GLFW the first time this |
| 2256 | * function is called and is restored by @ref glfwTerminate. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2257 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2258 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2259 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2260 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2261 | * the default (usually sRGB-like) behavior. |
| 2262 | * |
| 2263 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2264 | * GLFW_SRGB_CAPABLE hint. |
| 2265 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2266 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2267 | * @param[in] ramp The gamma ramp to use. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 2268 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2269 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2270 | * GLFW_PLATFORM_ERROR. |
| 2271 | * |
Camilla Löwy | 3531c32 | 2018-12-17 17:40:18 +0100 | [diff] [blame] | 2272 | * @remark The size of the specified gamma ramp should match the size of the |
| 2273 | * current ramp for that monitor. |
Camilla Berglund | 76fff4d | 2015-03-10 19:02:28 +0100 | [diff] [blame] | 2274 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2275 | * @remark @win32 The gamma ramp size must be 256. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2276 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2277 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2278 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2279 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2280 | * @pointer_lifetime The specified gamma ramp is copied before this function |
| 2281 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2282 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2283 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2284 | * |
| 2285 | * @sa @ref monitor_gamma |
| 2286 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2287 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2288 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2289 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2290 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2291 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 2292 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2293 | /*! @brief Resets all window hints to their default values. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2294 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2295 | * This function resets all window hints to their |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2296 | * [default values](@ref window_hints_values). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2297 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2298 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 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 | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2301 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2302 | * @sa @ref window_hints |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2303 | * @sa @ref glfwWindowHint |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2304 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2305 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2306 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2307 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2308 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2309 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 2310 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2311 | |
| 2312 | /*! @brief Sets the specified window hint to the desired value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2313 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 2314 | * 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] | 2315 | * hints, once set, retain their values until changed by a call to this |
| 2316 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 2317 | * |
| 2318 | * Only integer value hints can be set with this function. String value hints |
| 2319 | * are set with @ref glfwWindowHintString. |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 2320 | * |
Camilla Berglund | d6e0a43 | 2016-02-09 07:41:48 +0100 | [diff] [blame] | 2321 | * This function does not check whether the specified hint values are valid. |
| 2322 | * If you set hints to invalid values this will instead be reported by the next |
| 2323 | * call to @ref glfwCreateWindow. |
| 2324 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2325 | * Some hints are platform specific. These may be set on any platform but they |
| 2326 | * will only affect their specific platform. Other platforms will ignore them. |
| 2327 | * Setting these hints requires no platform specific headers or functions. |
| 2328 | * |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 2329 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 2330 | * @param[in] value The new value of the window hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2331 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2332 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2333 | * GLFW_INVALID_ENUM. |
| 2334 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2335 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 2336 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2337 | * @sa @ref window_hints |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2338 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2339 | * @sa @ref glfwDefaultWindowHints |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2340 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2341 | * @since Added in version 3.0. Replaces `glfwOpenWindowHint`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2342 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2343 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2344 | */ |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 2345 | GLFWAPI void glfwWindowHint(int hint, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2346 | |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2347 | /*! @brief Sets the specified window hint to the desired value. |
| 2348 | * |
| 2349 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 2350 | * hints, once set, retain their values until changed by a call to this |
| 2351 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 2352 | * |
| 2353 | * Only string type hints can be set with this function. Integer value hints |
| 2354 | * are set with @ref glfwWindowHint. |
| 2355 | * |
| 2356 | * This function does not check whether the specified hint values are valid. |
| 2357 | * If you set hints to invalid values this will instead be reported by the next |
| 2358 | * call to @ref glfwCreateWindow. |
| 2359 | * |
| 2360 | * Some hints are platform specific. These may be set on any platform but they |
| 2361 | * will only affect their specific platform. Other platforms will ignore them. |
| 2362 | * Setting these hints requires no platform specific headers or functions. |
| 2363 | * |
| 2364 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 2365 | * @param[in] value The new value of the window hint. |
| 2366 | * |
| 2367 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2368 | * GLFW_INVALID_ENUM. |
| 2369 | * |
| 2370 | * @pointer_lifetime The specified string is copied before this function |
| 2371 | * returns. |
| 2372 | * |
| 2373 | * @thread_safety This function must only be called from the main thread. |
| 2374 | * |
| 2375 | * @sa @ref window_hints |
| 2376 | * @sa @ref glfwWindowHint |
| 2377 | * @sa @ref glfwDefaultWindowHints |
| 2378 | * |
| 2379 | * @since Added in version 3.3. |
| 2380 | * |
| 2381 | * @ingroup window |
| 2382 | */ |
| 2383 | GLFWAPI void glfwWindowHintString(int hint, const char* value); |
| 2384 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2385 | /*! @brief Creates a window and its associated context. |
| 2386 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2387 | * This function creates a window and its associated OpenGL or OpenGL ES |
| 2388 | * context. Most of the options controlling how the window and its context |
| 2389 | * should be created are specified with [window hints](@ref window_hints). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2390 | * |
| 2391 | * Successful creation does not change which context is current. Before you |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2392 | * can use the newly created context, you need to |
| 2393 | * [make it current](@ref context_current). For information about the `share` |
| 2394 | * parameter, see @ref context_sharing. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2395 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2396 | * The created window, framebuffer and context may differ from what you |
| 2397 | * requested, as not all parameters and hints are |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 2398 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2399 | * window, especially for full screen windows. To query the actual attributes |
Camilla Berglund | e8bceaa | 2015-04-07 14:37:42 +0200 | [diff] [blame] | 2400 | * of the created window, framebuffer and context, see @ref |
| 2401 | * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2402 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2403 | * 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] | 2404 | * will cover. If no monitor is specified, the window will be windowed mode. |
| 2405 | * Unless you have a way for the user to choose a specific monitor, it is |
| 2406 | * recommended that you pick the primary monitor. For more information on how |
| 2407 | * to query connected monitors, see @ref monitor_monitors. |
Camilla Berglund | 4b7ae49 | 2013-07-07 12:06:59 +0200 | [diff] [blame] | 2408 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2409 | * For full screen windows, the specified size becomes the resolution of the |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2410 | * window's _desired video mode_. As long as a full screen window is not |
| 2411 | * iconified, the supported video mode most closely matching the desired video |
| 2412 | * mode is set for the specified monitor. For more information about full |
| 2413 | * screen windows, including the creation of so called _windowed full screen_ |
| 2414 | * or _borderless full screen_ windows, see @ref window_windowed_full_screen. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2415 | * |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 2416 | * 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] | 2417 | * full screen mode with @ref glfwSetWindowMonitor. This will not affect its |
| 2418 | * OpenGL or OpenGL ES context. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 2419 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2420 | * By default, newly created windows use the placement recommended by the |
| 2421 | * 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] | 2422 | * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2423 | * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) |
| 2424 | * it. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2425 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2426 | * As long as at least one full screen window is not iconified, the screensaver |
| 2427 | * is prohibited from starting. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2428 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2429 | * Window systems put limits on window sizes. Very large or very small window |
| 2430 | * dimensions may be overridden by the window system on creation. Check the |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2431 | * actual [size](@ref window_size) after creation. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2432 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2433 | * 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] | 2434 | * the initial value may vary depending on driver settings and defaults. |
| 2435 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2436 | * @param[in] width The desired width, in screen coordinates, of the window. |
| 2437 | * This must be greater than zero. |
| 2438 | * @param[in] height The desired height, in screen coordinates, of the window. |
| 2439 | * This must be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2440 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2441 | * @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] | 2442 | * windowed mode. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2443 | * @param[in] share The window whose context to share resources with, or `NULL` |
| 2444 | * to not share resources. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2445 | * @return The handle of the created window, or `NULL` if an |
| 2446 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2447 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2448 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2449 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref |
| 2450 | * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref |
| 2451 | * GLFW_PLATFORM_ERROR. |
| 2452 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2453 | * @remark @win32 Window creation will fail if the Microsoft GDI software |
| 2454 | * OpenGL implementation is the only one available. |
Camilla Berglund | 07db5da | 2013-09-26 19:15:36 +0200 | [diff] [blame] | 2455 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 2456 | * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it |
| 2457 | * 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] | 2458 | * the `IDI_APPLICATION` icon will be used instead. To set a different icon, |
| 2459 | * see @ref glfwSetWindowIcon. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2460 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2461 | * @remark @win32 The context to share resources with must not be current on |
| 2462 | * any other thread. |
Camilla Berglund | b19fb4c | 2014-12-27 21:14:41 +0100 | [diff] [blame] | 2463 | * |
Camilla Löwy | fd127d5 | 2016-12-03 19:32:00 +0100 | [diff] [blame] | 2464 | * @remark @macos The OS only supports forward-compatible core profile contexts |
| 2465 | * for OpenGL versions 3.2 and later. Before creating an OpenGL context of |
| 2466 | * version 3.2 or later you must set the |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2467 | * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and |
| 2468 | * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly. |
| 2469 | * 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] | 2470 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2471 | * @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] | 2472 | * 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] | 2473 | * For more information on bundles, see the |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2474 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 2475 | * in the Mac Developer Library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2476 | * |
Camilla Löwy | c50aba1 | 2017-03-01 04:09:51 +0100 | [diff] [blame] | 2477 | * @remark @macos The first time a window is created the menu bar is created. |
| 2478 | * If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu |
| 2479 | * bar. Otherwise a minimal menu bar is created manually with common commands |
| 2480 | * like Hide, Quit and About. The About entry opens a minimal about dialog |
| 2481 | * with information from the application's bundle. Menu bar creation can be |
| 2482 | * disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2483 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2484 | * @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] | 2485 | * at full resolution on Retina displays unless the |
| 2486 | * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) |
| 2487 | * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the |
| 2488 | * application bundle's `Info.plist`. For more information, see |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 2489 | * [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] | 2490 | * in the Mac Developer Library. The GLFW test and example programs use |
| 2491 | * a custom `Info.plist` template for this, which can be found as |
| 2492 | * `CMake/MacOSXBundleInfo.plist.in` in the source tree. |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 2493 | * |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 2494 | * @remark @macos When activating frame autosaving with |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 2495 | * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified |
| 2496 | * window size and position may be overriden by previously saved values. |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 2497 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2498 | * @remark @x11 Some window managers will not respect the placement of |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2499 | * initially hidden windows. |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 2500 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2501 | * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for |
| 2502 | * a window to reach its requested state. This means you may not be able to |
| 2503 | * query the final size, position or other attributes directly after window |
| 2504 | * creation. |
Camilla Berglund | 20ed0a1 | 2015-08-12 21:31:54 +0200 | [diff] [blame] | 2505 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2506 | * @remark @x11 The class part of the `WM_CLASS` window property will by |
| 2507 | * default be set to the window title passed to this function. The instance |
| 2508 | * part will use the contents of the `RESOURCE_NAME` environment variable, if |
| 2509 | * present and not empty, or fall back to the window title. Set the @ref |
| 2510 | * GLFW_X11_CLASS_NAME and @ref GLFW_X11_INSTANCE_NAME window hints to override |
| 2511 | * this. |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 2512 | * |
Emmanuel Gil Peyrot | bcd8f9a | 2019-02-15 19:02:32 +0100 | [diff] [blame] | 2513 | * @remark @wayland Compositors should implement the xdg-decoration protocol |
| 2514 | * for GLFW to decorate the window properly. If this protocol isn't |
| 2515 | * supported, or if the compositor prefers client-side decorations, a very |
| 2516 | * simple fallback frame will be drawn using the wp_viewporter protocol. A |
| 2517 | * compositor can still emit close, maximize or fullscreen events, using for |
| 2518 | * instance a keybind mechanism. If neither of these protocols is supported, |
| 2519 | * the window won't be decorated. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2520 | * |
| 2521 | * @remark @wayland A full screen window will not attempt to change the mode, |
| 2522 | * no matter what the requested size or refresh rate. |
| 2523 | * |
Emmanuel Gil Peyrot | 6516685 | 2017-02-17 15:52:50 +0000 | [diff] [blame] | 2524 | * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol |
| 2525 | * to be implemented in the user's compositor. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2526 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2527 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2528 | * |
| 2529 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2530 | * @sa @ref glfwDestroyWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2531 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2532 | * @since Added in version 3.0. Replaces `glfwOpenWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2533 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2534 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2535 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2536 | 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] | 2537 | |
| 2538 | /*! @brief Destroys the specified window and its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2539 | * |
| 2540 | * This function destroys the specified window and its context. On calling |
| 2541 | * this function, no further callbacks will be called for that window. |
| 2542 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2543 | * If the context of the specified window is current on the main thread, it is |
| 2544 | * detached before being destroyed. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2545 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2546 | * @param[in] window The window to destroy. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2547 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2548 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2549 | * GLFW_PLATFORM_ERROR. |
| 2550 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2551 | * @note The context of the specified window must not be current on any other |
| 2552 | * thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2553 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2554 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 2555 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2556 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2557 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2558 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2559 | * @sa @ref glfwCreateWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2560 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2561 | * @since Added in version 3.0. Replaces `glfwCloseWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2562 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2563 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2564 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2565 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2566 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2567 | /*! @brief Checks the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2568 | * |
| 2569 | * This function returns the value of the close flag of the specified window. |
| 2570 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2571 | * @param[in] window The window to query. |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2572 | * @return The value of the close flag. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2573 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2574 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2575 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2576 | * @thread_safety This function may be called from any thread. Access is not |
| 2577 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2578 | * |
| 2579 | * @sa @ref window_close |
| 2580 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2581 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 2582 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2583 | * @ingroup window |
| 2584 | */ |
| 2585 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
| 2586 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2587 | /*! @brief Sets the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2588 | * |
| 2589 | * This function sets the value of the close flag of the specified window. |
| 2590 | * This can be used to override the user's attempt to close the window, or |
| 2591 | * to signal that it should be closed. |
| 2592 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2593 | * @param[in] window The window whose flag to change. |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2594 | * @param[in] value The new value. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2595 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2596 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2597 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2598 | * @thread_safety This function may be called from any thread. Access is not |
| 2599 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2600 | * |
| 2601 | * @sa @ref window_close |
| 2602 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2603 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 2604 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2605 | * @ingroup window |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2606 | */ |
| 2607 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
| 2608 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2609 | /*! @brief Sets the title of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2610 | * |
| 2611 | * This function sets the window title, encoded as UTF-8, of the specified |
| 2612 | * window. |
| 2613 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2614 | * @param[in] window The window whose title to change. |
| 2615 | * @param[in] title The UTF-8 encoded window title. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2616 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2617 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2618 | * GLFW_PLATFORM_ERROR. |
| 2619 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2620 | * @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] | 2621 | * process events. |
Camilla Berglund | 6412dcb | 2015-04-07 21:52:29 +0200 | [diff] [blame] | 2622 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2623 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2624 | * |
| 2625 | * @sa @ref window_title |
| 2626 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2627 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2628 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2629 | * |
| 2630 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2631 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2632 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2633 | |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2634 | /*! @brief Sets the icon for the specified window. |
| 2635 | * |
| 2636 | * This function sets the icon of the specified window. If passed an array of |
| 2637 | * candidate images, those of or closest to the sizes desired by the system are |
| 2638 | * selected. If no images are specified, the window reverts to its default |
| 2639 | * icon. |
| 2640 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 2641 | * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight |
| 2642 | * bits per channel with the red channel first. They are arranged canonically |
| 2643 | * as packed sequential rows, starting from the top-left corner. |
| 2644 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2645 | * The desired image sizes varies depending on platform and system settings. |
| 2646 | * The selected images will be rescaled as needed. Good sizes include 16x16, |
| 2647 | * 32x32 and 48x48. |
| 2648 | * |
| 2649 | * @param[in] window The window whose icon to set. |
| 2650 | * @param[in] count The number of images in the specified array, or zero to |
| 2651 | * revert to the default window icon. |
| 2652 | * @param[in] images The images to create the icon from. This is ignored if |
| 2653 | * count is zero. |
| 2654 | * |
| 2655 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2656 | * GLFW_PLATFORM_ERROR. |
| 2657 | * |
| 2658 | * @pointer_lifetime The specified image data is copied before this function |
| 2659 | * returns. |
| 2660 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2661 | * @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] | 2662 | * window, so this function does nothing. The dock icon will be the same as |
| 2663 | * the application bundle's icon. For more information on bundles, see the |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2664 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 2665 | * in the Mac Developer Library. |
| 2666 | * |
Emmanuel Gil Peyrot | a162004 | 2017-12-03 04:19:15 +0100 | [diff] [blame] | 2667 | * @remark @wayland There is no existing protocol to change an icon, the |
| 2668 | * window will thus inherit the one defined in the application's desktop file. |
| 2669 | * This function always emits @ref GLFW_PLATFORM_ERROR. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2670 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2671 | * @thread_safety This function must only be called from the main thread. |
| 2672 | * |
| 2673 | * @sa @ref window_icon |
| 2674 | * |
| 2675 | * @since Added in version 3.2. |
| 2676 | * |
| 2677 | * @ingroup window |
| 2678 | */ |
| 2679 | GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images); |
| 2680 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2681 | /*! @brief Retrieves the position of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2682 | * |
| 2683 | * This function retrieves the position, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2684 | * upper-left corner of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2685 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2686 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 2687 | * non-`NULL` position arguments will be set to zero. |
| 2688 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2689 | * @param[in] window The window to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2690 | * @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] | 2691 | * the content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2692 | * @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] | 2693 | * the content area, or `NULL`. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2694 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2695 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2696 | * GLFW_PLATFORM_ERROR. |
| 2697 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2698 | * @remark @wayland There is no way for an application to retrieve the global |
| 2699 | * position of its windows, this function will always emit @ref |
| 2700 | * GLFW_PLATFORM_ERROR. |
| 2701 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2702 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2703 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2704 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2705 | * @sa @ref glfwSetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2706 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2707 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2708 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2709 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2710 | */ |
| 2711 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
| 2712 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2713 | /*! @brief Sets the position of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2714 | * |
| 2715 | * 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] | 2716 | * 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] | 2717 | * window is a full screen window, this function does nothing. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2718 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2719 | * __Do not use this function__ to move an already visible window unless you |
| 2720 | * have very good reasons for doing so, as it will confuse and annoy the user. |
| 2721 | * |
| 2722 | * The window manager may put limits on what positions are allowed. GLFW |
| 2723 | * cannot and should not override these limits. |
| 2724 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2725 | * @param[in] window The window to query. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2726 | * @param[in] xpos The x-coordinate of the upper-left corner of the content area. |
| 2727 | * @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] | 2728 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2729 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2730 | * GLFW_PLATFORM_ERROR. |
| 2731 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2732 | * @remark @wayland There is no way for an application to set the global |
| 2733 | * position of its windows, this function will always emit @ref |
| 2734 | * GLFW_PLATFORM_ERROR. |
| 2735 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2736 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2737 | * |
| 2738 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2739 | * @sa @ref glfwGetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2740 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2741 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2742 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2743 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2744 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2745 | */ |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 2746 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2747 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2748 | /*! @brief Retrieves the size of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2749 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2750 | * This function retrieves the size, in screen coordinates, of the content area |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 2751 | * 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] | 2752 | * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2753 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2754 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2755 | * non-`NULL` size arguments will be set to zero. |
| 2756 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2757 | * @param[in] window The window whose size to retrieve. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2758 | * @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] | 2759 | * content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2760 | * @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] | 2761 | * content area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2762 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2763 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2764 | * GLFW_PLATFORM_ERROR. |
| 2765 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2766 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2767 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2768 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2769 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2770 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2771 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2772 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2773 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2774 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2775 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2776 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2777 | |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2778 | /*! @brief Sets the size limits of the specified window. |
| 2779 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2780 | * 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] | 2781 | * 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] | 2782 | * once it is made windowed. If the window is not resizable, this function |
| 2783 | * does nothing. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2784 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2785 | * The size limits are applied immediately to a windowed mode window and may |
| 2786 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2787 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 2788 | * The maximum dimensions must be greater than or equal to the minimum |
| 2789 | * dimensions and all must be greater than or equal to zero. |
| 2790 | * |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2791 | * @param[in] window The window to set limits for. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2792 | * @param[in] minwidth The minimum width, in screen coordinates, of the content |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2793 | * area, or `GLFW_DONT_CARE`. |
| 2794 | * @param[in] minheight The minimum height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2795 | * content area, or `GLFW_DONT_CARE`. |
| 2796 | * @param[in] maxwidth The maximum width, in screen coordinates, of the content |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2797 | * area, or `GLFW_DONT_CARE`. |
| 2798 | * @param[in] maxheight The maximum height, in screen coordinates, of the |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2799 | * content area, or `GLFW_DONT_CARE`. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2800 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 2801 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2802 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2803 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2804 | * @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] | 2805 | * results are undefined. |
| 2806 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2807 | * @remark @wayland The size limits will not be applied until the window is |
| 2808 | * actually resized, either by the user or by the compositor. |
| 2809 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2810 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2811 | * |
| 2812 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2813 | * @sa @ref glfwSetWindowAspectRatio |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2814 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2815 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2816 | * |
| 2817 | * @ingroup window |
| 2818 | */ |
| 2819 | GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); |
| 2820 | |
| 2821 | /*! @brief Sets the aspect ratio of the specified window. |
| 2822 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2823 | * 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] | 2824 | * specified window. If the window is full screen, the aspect ratio only takes |
| 2825 | * 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] | 2826 | * function does nothing. |
| 2827 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 2828 | * The aspect ratio is specified as a numerator and a denominator and both |
| 2829 | * values must be greater than zero. For example, the common 16:9 aspect ratio |
| 2830 | * is specified as 16 and 9, respectively. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2831 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 2832 | * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect |
| 2833 | * ratio limit is disabled. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2834 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2835 | * The aspect ratio is applied immediately to a windowed mode window and may |
| 2836 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2837 | * |
| 2838 | * @param[in] window The window to set limits for. |
| 2839 | * @param[in] numer The numerator of the desired aspect ratio, or |
| 2840 | * `GLFW_DONT_CARE`. |
| 2841 | * @param[in] denom The denominator of the desired aspect ratio, or |
| 2842 | * `GLFW_DONT_CARE`. |
| 2843 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2844 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2845 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 2846 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2847 | * @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] | 2848 | * results are undefined. |
| 2849 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2850 | * @remark @wayland The aspect ratio will not be applied until the window is |
| 2851 | * actually resized, either by the user or by the compositor. |
| 2852 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2853 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2854 | * |
| 2855 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2856 | * @sa @ref glfwSetWindowSizeLimits |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2857 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2858 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2859 | * |
| 2860 | * @ingroup window |
| 2861 | */ |
| 2862 | GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); |
| 2863 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2864 | /*! @brief Sets the size of the content area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2865 | * |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 2866 | * 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] | 2867 | * the specified window. |
| 2868 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2869 | * For full screen windows, this function updates the resolution of its desired |
| 2870 | * video mode and switches to the video mode closest to it, without affecting |
| 2871 | * the window's context. As the context is unaffected, the bit depths of the |
| 2872 | * framebuffer remain unchanged. |
| 2873 | * |
| 2874 | * If you wish to update the refresh rate of the desired video mode in addition |
| 2875 | * to its resolution, see @ref glfwSetWindowMonitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2876 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2877 | * The window manager may put limits on what sizes are allowed. GLFW cannot |
| 2878 | * and should not override these limits. |
| 2879 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2880 | * @param[in] window The window to resize. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2881 | * @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] | 2882 | * content area. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2883 | * @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] | 2884 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2885 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2886 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2887 | * GLFW_PLATFORM_ERROR. |
| 2888 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2889 | * @remark @wayland A full screen window will not attempt to change the mode, |
| 2890 | * no matter what the requested size. |
| 2891 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2892 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2893 | * |
| 2894 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2895 | * @sa @ref glfwGetWindowSize |
| 2896 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2897 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2898 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2899 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2900 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2901 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2902 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2903 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2904 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2905 | /*! @brief Retrieves the size of the framebuffer of the specified window. |
| 2906 | * |
| 2907 | * This function retrieves the size, in pixels, of the framebuffer of the |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 2908 | * specified window. If you wish to retrieve the size of the window in screen |
| 2909 | * coordinates, see @ref glfwGetWindowSize. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2910 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2911 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2912 | * non-`NULL` size arguments will be set to zero. |
| 2913 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2914 | * @param[in] window The window whose framebuffer to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2915 | * @param[out] width Where to store the width, in pixels, of the framebuffer, |
| 2916 | * or `NULL`. |
| 2917 | * @param[out] height Where to store the height, in pixels, of the framebuffer, |
| 2918 | * or `NULL`. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2919 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2920 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2921 | * GLFW_PLATFORM_ERROR. |
| 2922 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2923 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2924 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2925 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2926 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2927 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2928 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2929 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2930 | * @ingroup window |
| 2931 | */ |
| 2932 | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); |
| 2933 | |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2934 | /*! @brief Retrieves the size of the frame of the window. |
| 2935 | * |
| 2936 | * This function retrieves the size, in screen coordinates, of each edge of the |
| 2937 | * frame of the specified window. This size includes the title bar, if the |
| 2938 | * window has one. The size of the frame may vary depending on the |
| 2939 | * [window-related hints](@ref window_hints_wnd) used to create it. |
| 2940 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2941 | * Because this function retrieves the size of each window frame edge and not |
| 2942 | * the offset along a particular coordinate axis, the retrieved values will |
| 2943 | * always be zero or positive. |
| 2944 | * |
| 2945 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2946 | * non-`NULL` size arguments will be set to zero. |
| 2947 | * |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2948 | * @param[in] window The window whose frame size to query. |
| 2949 | * @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] | 2950 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2951 | * @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] | 2952 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2953 | * @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] | 2954 | * right edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2955 | * @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] | 2956 | * bottom edge of the window frame, or `NULL`. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2957 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2958 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2959 | * GLFW_PLATFORM_ERROR. |
| 2960 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2961 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2962 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2963 | * @sa @ref window_size |
| 2964 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2965 | * @since Added in version 3.1. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2966 | * |
| 2967 | * @ingroup window |
| 2968 | */ |
| 2969 | GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); |
| 2970 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2971 | /*! @brief Retrieves the content scale for the specified window. |
| 2972 | * |
| 2973 | * This function retrieves the content scale for the specified window. The |
| 2974 | * content scale is the ratio between the current DPI and the platform's |
| 2975 | * default DPI. If you scale all pixel dimensions by this scale then your |
| 2976 | * content should appear at an appropriate size. This is especially important |
| 2977 | * for text and any UI elements. |
| 2978 | * |
| 2979 | * On systems where each monitors can have its own content scale, the window |
| 2980 | * content scale will depend on which monitor the system considers the window |
| 2981 | * to be on. |
| 2982 | * |
| 2983 | * @param[in] window The window to query. |
| 2984 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 2985 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 2986 | * |
| 2987 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2988 | * GLFW_PLATFORM_ERROR. |
| 2989 | * |
| 2990 | * @thread_safety This function must only be called from the main thread. |
| 2991 | * |
| 2992 | * @sa @ref window_scale |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 2993 | * @sa @ref glfwSetWindowContentScaleCallback |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2994 | * @sa @ref glfwGetMonitorContentScale |
| 2995 | * |
| 2996 | * @since Added in version 3.3. |
| 2997 | * |
| 2998 | * @ingroup window |
| 2999 | */ |
| 3000 | GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); |
| 3001 | |
Camilla Löwy | 11e47f0 | 2017-09-25 23:14:45 +0200 | [diff] [blame] | 3002 | /*! @brief Returns the opacity of the whole window. |
| 3003 | * |
| 3004 | * This function returns the opacity of the window, including any decorations. |
| 3005 | * |
| 3006 | * The opacity (or alpha) value is a positive finite number between zero and |
| 3007 | * one, where zero is fully transparent and one is fully opaque. If the system |
| 3008 | * does not support whole window transparency, this function always returns one. |
| 3009 | * |
| 3010 | * The initial opacity value for newly created windows is one. |
| 3011 | * |
| 3012 | * @param[in] window The window to query. |
| 3013 | * @return The opacity value of the specified window. |
| 3014 | * |
| 3015 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3016 | * GLFW_PLATFORM_ERROR. |
| 3017 | * |
| 3018 | * @thread_safety This function must only be called from the main thread. |
| 3019 | * |
| 3020 | * @sa @ref window_transparency |
| 3021 | * @sa @ref glfwSetWindowOpacity |
| 3022 | * |
| 3023 | * @since Added in version 3.3. |
| 3024 | * |
| 3025 | * @ingroup window |
| 3026 | */ |
| 3027 | GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window); |
| 3028 | |
| 3029 | /*! @brief Sets the opacity of the whole window. |
| 3030 | * |
| 3031 | * This function sets the opacity of the window, including any decorations. |
| 3032 | * |
| 3033 | * The opacity (or alpha) value is a positive finite number between zero and |
| 3034 | * one, where zero is fully transparent and one is fully opaque. |
| 3035 | * |
| 3036 | * The initial opacity value for newly created windows is one. |
| 3037 | * |
| 3038 | * A window created with framebuffer transparency may not use whole window |
| 3039 | * transparency. The results of doing this are undefined. |
| 3040 | * |
| 3041 | * @param[in] window The window to set the opacity for. |
| 3042 | * @param[in] opacity The desired opacity of the specified window. |
| 3043 | * |
| 3044 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3045 | * GLFW_PLATFORM_ERROR. |
| 3046 | * |
| 3047 | * @thread_safety This function must only be called from the main thread. |
| 3048 | * |
| 3049 | * @sa @ref window_transparency |
| 3050 | * @sa @ref glfwGetWindowOpacity |
| 3051 | * |
| 3052 | * @since Added in version 3.3. |
| 3053 | * |
| 3054 | * @ingroup window |
| 3055 | */ |
| 3056 | GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); |
| 3057 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3058 | /*! @brief Iconifies the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3059 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3060 | * This function iconifies (minimizes) the specified window if it was |
| 3061 | * previously restored. If the window is already iconified, this function does |
| 3062 | * nothing. |
| 3063 | * |
| 3064 | * If the specified window is a full screen window, the original monitor |
| 3065 | * resolution is restored until the window is restored. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3066 | * |
| 3067 | * @param[in] window The window to iconify. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3068 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3069 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3070 | * GLFW_PLATFORM_ERROR. |
| 3071 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3072 | * @remark @wayland There is no concept of iconification in wl_shell, this |
Emmanuel Gil Peyrot | a162004 | 2017-12-03 04:19:15 +0100 | [diff] [blame] | 3073 | * function will emit @ref GLFW_PLATFORM_ERROR when using this deprecated |
| 3074 | * protocol. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3075 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3076 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3077 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3078 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3079 | * @sa @ref glfwRestoreWindow |
| 3080 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3081 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3082 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3083 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3084 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3085 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3086 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3087 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3088 | |
| 3089 | /*! @brief Restores the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3090 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3091 | * This function restores the specified window if it was previously iconified |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3092 | * (minimized) or maximized. If the window is already restored, this function |
| 3093 | * does nothing. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3094 | * |
| 3095 | * If the specified window is a full screen window, the resolution chosen for |
| 3096 | * the window is restored on the selected monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3097 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3098 | * @param[in] window The window to restore. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3099 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3100 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3101 | * GLFW_PLATFORM_ERROR. |
| 3102 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3103 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3104 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3105 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3106 | * @sa @ref glfwIconifyWindow |
| 3107 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3108 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3109 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3110 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3111 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3112 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3113 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3114 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3115 | |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3116 | /*! @brief Maximizes the specified window. |
| 3117 | * |
| 3118 | * This function maximizes the specified window if it was previously not |
| 3119 | * maximized. If the window is already maximized, this function does nothing. |
| 3120 | * |
| 3121 | * If the specified window is a full screen window, this function does nothing. |
| 3122 | * |
| 3123 | * @param[in] window The window to maximize. |
| 3124 | * |
Camilla Berglund | f5b71f5 | 2016-05-27 14:20:39 +0200 | [diff] [blame] | 3125 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3126 | * GLFW_PLATFORM_ERROR. |
| 3127 | * |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3128 | * @par Thread Safety |
| 3129 | * This function may only be called from the main thread. |
| 3130 | * |
| 3131 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3132 | * @sa @ref glfwIconifyWindow |
| 3133 | * @sa @ref glfwRestoreWindow |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3134 | * |
| 3135 | * @since Added in GLFW 3.2. |
| 3136 | * |
| 3137 | * @ingroup window |
| 3138 | */ |
| 3139 | GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); |
| 3140 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3141 | /*! @brief Makes the specified window visible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3142 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3143 | * This function makes the specified window visible if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3144 | * 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] | 3145 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3146 | * |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3147 | * By default, windowed mode windows are focused when shown |
| 3148 | * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint |
| 3149 | * to change this behavior for all newly created windows, or change the |
| 3150 | * behavior for an existing window with @ref glfwSetWindowAttrib. |
| 3151 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3152 | * @param[in] window The window to make visible. |
| 3153 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3154 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3155 | * GLFW_PLATFORM_ERROR. |
| 3156 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3157 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3158 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3159 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3160 | * @sa @ref glfwHideWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3161 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3162 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3163 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3164 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3165 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3166 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3167 | |
| 3168 | /*! @brief Hides the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3169 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3170 | * This function hides the specified window if it was previously visible. If |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3171 | * 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] | 3172 | * nothing. |
| 3173 | * |
| 3174 | * @param[in] window The window to hide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3175 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3176 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3177 | * GLFW_PLATFORM_ERROR. |
| 3178 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3179 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3180 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3181 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3182 | * @sa @ref glfwShowWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3183 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3184 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3185 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3186 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3187 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3188 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3189 | |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3190 | /*! @brief Brings the specified window to front and sets input focus. |
| 3191 | * |
| 3192 | * This function brings the specified window to front and sets input focus. |
| 3193 | * The window should already be visible and not iconified. |
| 3194 | * |
| 3195 | * 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] | 3196 | * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to |
| 3197 | * disable this behavior. |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3198 | * |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3199 | * Also by default, windowed mode windows are focused when shown |
| 3200 | * with @ref glfwShowWindow. Set the |
| 3201 | * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior. |
| 3202 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3203 | * __Do not use this function__ to steal focus from other applications unless |
| 3204 | * you are certain that is what the user wants. Focus stealing can be |
| 3205 | * extremely disruptive. |
| 3206 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3207 | * For a less disruptive way of getting the user's attention, see |
| 3208 | * [attention requests](@ref window_attention). |
| 3209 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3210 | * @param[in] window The window to give input focus. |
| 3211 | * |
| 3212 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3213 | * GLFW_PLATFORM_ERROR. |
| 3214 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3215 | * @remark @wayland It is not possible for an application to bring its windows |
| 3216 | * to front, this function will always emit @ref GLFW_PLATFORM_ERROR. |
| 3217 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3218 | * @thread_safety This function must only be called from the main thread. |
| 3219 | * |
| 3220 | * @sa @ref window_focus |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3221 | * @sa @ref window_attention |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3222 | * |
| 3223 | * @since Added in version 3.2. |
| 3224 | * |
| 3225 | * @ingroup window |
| 3226 | */ |
| 3227 | GLFWAPI void glfwFocusWindow(GLFWwindow* window); |
| 3228 | |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3229 | /*! @brief Requests user attention to the specified window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3230 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3231 | * This function requests user attention to the specified window. On |
| 3232 | * platforms where this is not supported, attention is requested to the |
| 3233 | * application as a whole. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3234 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3235 | * Once the user has given attention, usually by focusing the window or |
| 3236 | * application, the system will end the request automatically. |
| 3237 | * |
| 3238 | * @param[in] window The window to request attention to. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3239 | * |
| 3240 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3241 | * GLFW_PLATFORM_ERROR. |
| 3242 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3243 | * @remark @macos Attention is requested to the application as a whole, not the |
| 3244 | * specific window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3245 | * |
| 3246 | * @thread_safety This function must only be called from the main thread. |
| 3247 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3248 | * @sa @ref window_attention |
| 3249 | * |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3250 | * @since Added in version 3.3. |
| 3251 | * |
| 3252 | * @ingroup window |
| 3253 | */ |
| 3254 | GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window); |
| 3255 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3256 | /*! @brief Returns the monitor that the window uses for full screen mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3257 | * |
| 3258 | * 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] | 3259 | * in full screen on. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3260 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 3261 | * @param[in] window The window to query. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 3262 | * @return The monitor, or `NULL` if the window is in windowed mode or an |
| 3263 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3264 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3265 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3266 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3267 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3268 | * |
| 3269 | * @sa @ref window_monitor |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3270 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3271 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3272 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3273 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 3274 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3275 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3276 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3277 | |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3278 | /*! @brief Sets the mode, monitor, video mode and placement of a window. |
| 3279 | * |
| 3280 | * This function sets the monitor that the window uses for full screen mode or, |
| 3281 | * if the monitor is `NULL`, makes it windowed mode. |
| 3282 | * |
| 3283 | * When setting a monitor, this function updates the width, height and refresh |
| 3284 | * rate of the desired video mode and switches to the video mode closest to it. |
| 3285 | * The window position is ignored when setting a monitor. |
| 3286 | * |
| 3287 | * 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] | 3288 | * 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] | 3289 | * is specified. |
| 3290 | * |
| 3291 | * If you only wish to update the resolution of a full screen window or the |
| 3292 | * size of a windowed mode window, see @ref glfwSetWindowSize. |
| 3293 | * |
| 3294 | * When a window transitions from full screen to windowed mode, this function |
| 3295 | * restores any previous window settings such as whether it is decorated, |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3296 | * floating, resizable, has size or aspect ratio limits, etc. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3297 | * |
| 3298 | * @param[in] window The window whose monitor, size or video mode to set. |
| 3299 | * @param[in] monitor The desired monitor, or `NULL` to set windowed mode. |
| 3300 | * @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] | 3301 | * content area. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3302 | * @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] | 3303 | * content area. |
| 3304 | * @param[in] width The desired with, in screen coordinates, of the content |
| 3305 | * area or video mode. |
| 3306 | * @param[in] height The desired height, in screen coordinates, of the content |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3307 | * area or video mode. |
Camilla Berglund | 325729d | 2016-05-22 14:25:04 +0200 | [diff] [blame] | 3308 | * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode, |
| 3309 | * or `GLFW_DONT_CARE`. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3310 | * |
| 3311 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3312 | * GLFW_PLATFORM_ERROR. |
| 3313 | * |
Camilla Berglund | ec17161 | 2016-10-28 06:20:20 +0200 | [diff] [blame] | 3314 | * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise |
| 3315 | * affected by any resizing or mode switching, although you may need to update |
| 3316 | * your viewport if the framebuffer size has changed. |
| 3317 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3318 | * @remark @wayland The desired window position is ignored, as there is no way |
| 3319 | * for an application to set this property. |
| 3320 | * |
| 3321 | * @remark @wayland Setting the window to full screen will not attempt to |
| 3322 | * change the mode, no matter what the requested size or refresh rate. |
| 3323 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3324 | * @thread_safety This function must only be called from the main thread. |
| 3325 | * |
| 3326 | * @sa @ref window_monitor |
| 3327 | * @sa @ref window_full_screen |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3328 | * @sa @ref glfwGetWindowMonitor |
| 3329 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3330 | * |
| 3331 | * @since Added in version 3.2. |
| 3332 | * |
| 3333 | * @ingroup window |
| 3334 | */ |
| 3335 | GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); |
| 3336 | |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 3337 | /*! @brief Returns an attribute of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3338 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3339 | * This function returns the value of an attribute of the specified window or |
| 3340 | * its OpenGL or OpenGL ES context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3341 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3342 | * @param[in] window The window to query. |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 3343 | * @param[in] attrib The [window attribute](@ref window_attribs) whose value to |
| 3344 | * return. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3345 | * @return The value of the attribute, or zero if an |
| 3346 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3347 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3348 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3349 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 3350 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3351 | * @remark Framebuffer related hints are not window attributes. See @ref |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 3352 | * window_attribs_fb for more information. |
| 3353 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3354 | * @remark Zero is a valid value for many window and context related |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 3355 | * attributes so you cannot use a return value of zero as an indication of |
| 3356 | * errors. However, this function should not fail as long as it is passed |
| 3357 | * valid arguments and the library has been [initialized](@ref intro_init). |
| 3358 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3359 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3360 | * |
| 3361 | * @sa @ref window_attribs |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3362 | * @sa @ref glfwSetWindowAttrib |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3363 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3364 | * @since Added in version 3.0. Replaces `glfwGetWindowParam` and |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3365 | * `glfwGetGLVersion`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3366 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3367 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3368 | */ |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 3369 | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3370 | |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3371 | /*! @brief Sets an attribute of the specified window. |
| 3372 | * |
| 3373 | * This function sets the value of an attribute of the specified window. |
| 3374 | * |
| 3375 | * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), |
| 3376 | * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), |
Doug Binks | 0be4f3f | 2018-05-29 14:51:36 +0100 | [diff] [blame] | 3377 | * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), |
| 3378 | * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and |
| 3379 | * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib). |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3380 | * |
| 3381 | * Some of these attributes are ignored for full screen windows. The new |
| 3382 | * value will take effect if the window is later made windowed. |
| 3383 | * |
| 3384 | * Some of these attributes are ignored for windowed mode windows. The new |
| 3385 | * value will take effect if the window is later made full screen. |
| 3386 | * |
| 3387 | * @param[in] window The window to set the attribute for. |
| 3388 | * @param[in] attrib A supported window attribute. |
| 3389 | * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`. |
| 3390 | * |
| 3391 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3392 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 3393 | * |
| 3394 | * @remark Calling @ref glfwGetWindowAttrib will always return the latest |
| 3395 | * value, even if that value is ignored by the current mode of the window. |
| 3396 | * |
| 3397 | * @thread_safety This function must only be called from the main thread. |
| 3398 | * |
| 3399 | * @sa @ref window_attribs |
| 3400 | * @sa @ref glfwGetWindowAttrib |
| 3401 | * |
| 3402 | * @since Added in version 3.3. |
| 3403 | * |
| 3404 | * @ingroup window |
| 3405 | */ |
| 3406 | GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value); |
| 3407 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3408 | /*! @brief Sets the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3409 | * |
| 3410 | * This function sets the user-defined pointer of the specified window. The |
| 3411 | * current value is retained until the window is destroyed. The initial value |
| 3412 | * is `NULL`. |
| 3413 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3414 | * @param[in] window The window whose pointer to set. |
| 3415 | * @param[in] pointer The new value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3416 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3417 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3418 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3419 | * @thread_safety This function may be called from any thread. Access is not |
| 3420 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3421 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3422 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3423 | * @sa @ref glfwGetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3424 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3425 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3426 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3427 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3428 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3429 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3430 | |
| 3431 | /*! @brief Returns the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3432 | * |
| 3433 | * This function returns the current value of the user-defined pointer of the |
| 3434 | * specified window. The initial value is `NULL`. |
| 3435 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3436 | * @param[in] window The window whose pointer to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3437 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3438 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3439 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3440 | * @thread_safety This function may be called from any thread. Access is not |
| 3441 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3442 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3443 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3444 | * @sa @ref glfwSetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3445 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3446 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3447 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3448 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3449 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3450 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3451 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3452 | /*! @brief Sets the position callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3453 | * |
| 3454 | * 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] | 3455 | * 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] | 3456 | * position, in screen coordinates, of the upper-left corner of the content |
| 3457 | * area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3458 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3459 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3460 | * @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] | 3461 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3462 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3463 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3464 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3465 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3466 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3467 | * @remark @wayland This callback will never be called, as there is no way for |
| 3468 | * an application to know its global position. |
| 3469 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3470 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3471 | * |
| 3472 | * @sa @ref window_pos |
| 3473 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3474 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3475 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3476 | * @ingroup window |
| 3477 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3478 | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3479 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3480 | /*! @brief Sets the size callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3481 | * |
| 3482 | * This function sets the size callback of the specified window, which is |
| 3483 | * 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] | 3484 | * in screen coordinates, of the content area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3485 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3486 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3487 | * @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] | 3488 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3489 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3490 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3491 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3492 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3493 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3494 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3495 | * |
| 3496 | * @sa @ref window_size |
| 3497 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3498 | * @since Added in version 1.0. |
| 3499 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3500 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3501 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3502 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3503 | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3504 | |
| 3505 | /*! @brief Sets the close callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3506 | * |
| 3507 | * This function sets the close callback of the specified window, which is |
| 3508 | * called when the user attempts to close the window, for example by clicking |
| 3509 | * the close widget in the title bar. |
| 3510 | * |
| 3511 | * The close flag is set before this callback is called, but you can modify it |
| 3512 | * at any time with @ref glfwSetWindowShouldClose. |
| 3513 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3514 | * The close callback is not triggered by @ref glfwDestroyWindow. |
| 3515 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3516 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3517 | * @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] | 3518 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3519 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3520 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3521 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3522 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3523 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 3524 | * @remark @macos Selecting Quit from the application menu will trigger the |
| 3525 | * close callback for all windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3526 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3527 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3528 | * |
| 3529 | * @sa @ref window_close |
| 3530 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3531 | * @since Added in version 2.5. |
| 3532 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3533 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3534 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3535 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3536 | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3537 | |
| 3538 | /*! @brief Sets the refresh callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3539 | * |
| 3540 | * 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] | 3541 | * 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] | 3542 | * if the window has been exposed after having been covered by another window. |
| 3543 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3544 | * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where |
| 3545 | * the window contents are saved off-screen, this callback may be called only |
| 3546 | * very infrequently or never at all. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3547 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3548 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3549 | * @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] | 3550 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3551 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3552 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3553 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3554 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3555 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3556 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3557 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3558 | * @sa @ref window_refresh |
| 3559 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3560 | * @since Added in version 2.5. |
| 3561 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 3562 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3563 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3564 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3565 | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3566 | |
| 3567 | /*! @brief Sets the focus callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3568 | * |
| 3569 | * This function sets the focus callback of the specified window, which is |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3570 | * called when the window gains or loses input focus. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3571 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3572 | * After the focus callback is called for a window that lost input focus, |
| 3573 | * synthetic key and mouse button release events will be generated for all such |
| 3574 | * that had been pressed. For more information, see @ref glfwSetKeyCallback |
| 3575 | * and @ref glfwSetMouseButtonCallback. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 3576 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3577 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3578 | * @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] | 3579 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3580 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3581 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3582 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3583 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3584 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3585 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3586 | * |
| 3587 | * @sa @ref window_focus |
| 3588 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3589 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3590 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3591 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3592 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3593 | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3594 | |
| 3595 | /*! @brief Sets the iconify callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3596 | * |
| 3597 | * This function sets the iconification callback of the specified window, which |
| 3598 | * is called when the window is iconified or restored. |
| 3599 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3600 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3601 | * @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] | 3602 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3603 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3604 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3605 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3606 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3607 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3608 | * @remark @wayland The wl_shell protocol has no concept of iconification, |
Emmanuel Gil Peyrot | a162004 | 2017-12-03 04:19:15 +0100 | [diff] [blame] | 3609 | * this callback will never be called when using this deprecated protocol. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3610 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3611 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3612 | * |
| 3613 | * @sa @ref window_iconify |
| 3614 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3615 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3616 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3617 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3618 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3619 | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 3620 | |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 3621 | /*! @brief Sets the maximize callback for the specified window. |
| 3622 | * |
| 3623 | * This function sets the maximization callback of the specified window, which |
| 3624 | * is called when the window is maximized or restored. |
| 3625 | * |
| 3626 | * @param[in] window The window whose callback to set. |
| 3627 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3628 | * callback. |
| 3629 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3630 | * library had not been [initialized](@ref intro_init). |
| 3631 | * |
| 3632 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3633 | * |
| 3634 | * @thread_safety This function must only be called from the main thread. |
| 3635 | * |
| 3636 | * @sa @ref window_maximize |
| 3637 | * |
| 3638 | * @since Added in version 3.3. |
| 3639 | * |
| 3640 | * @ingroup window |
| 3641 | */ |
| 3642 | GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun); |
| 3643 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3644 | /*! @brief Sets the framebuffer resize callback for the specified window. |
| 3645 | * |
| 3646 | * This function sets the framebuffer resize callback of the specified window, |
| 3647 | * which is called when the framebuffer of the specified window is resized. |
| 3648 | * |
| 3649 | * @param[in] window The window whose callback to set. |
| 3650 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3651 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3652 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3653 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3654 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3655 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3656 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3657 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3658 | * |
| 3659 | * @sa @ref window_fbsize |
| 3660 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3661 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3662 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3663 | * @ingroup window |
| 3664 | */ |
| 3665 | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun); |
| 3666 | |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 3667 | /*! @brief Sets the window content scale callback for the specified window. |
| 3668 | * |
| 3669 | * This function sets the window content scale callback of the specified window, |
| 3670 | * which is called when the content scale of the specified window changes. |
| 3671 | * |
| 3672 | * @param[in] window The window whose callback to set. |
| 3673 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3674 | * callback. |
| 3675 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3676 | * library had not been [initialized](@ref intro_init). |
| 3677 | * |
| 3678 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3679 | * |
| 3680 | * @thread_safety This function must only be called from the main thread. |
| 3681 | * |
| 3682 | * @sa @ref window_scale |
| 3683 | * @sa @ref glfwGetWindowContentScale |
| 3684 | * |
| 3685 | * @since Added in version 3.3. |
| 3686 | * |
| 3687 | * @ingroup window |
| 3688 | */ |
| 3689 | GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun cbfun); |
| 3690 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3691 | /*! @brief Processes all pending events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3692 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3693 | * This function processes only those events that are already in the event |
| 3694 | * queue and then returns immediately. Processing events will cause the window |
| 3695 | * and input callbacks associated with those events to be called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3696 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3697 | * On some platforms, a window move, resize or menu operation will cause event |
| 3698 | * processing to block. This is due to how event processing is designed on |
| 3699 | * those platforms. You can use the |
| 3700 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3701 | * your window when necessary during such operations. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3702 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3703 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3704 | * event processing functions like this one. While it is necessary to poll for |
| 3705 | * events, window systems that require GLFW to register callbacks of its own |
| 3706 | * can pass events to GLFW in response to many window system function calls. |
| 3707 | * GLFW will pass those events on to the application callbacks before |
| 3708 | * returning. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 3709 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3710 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3711 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3712 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3713 | * GLFW_PLATFORM_ERROR. |
| 3714 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3715 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 3716 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3717 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 3718 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3719 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3720 | * @sa @ref glfwWaitEvents |
| 3721 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3722 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3723 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3724 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3725 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3726 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 3727 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3728 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3729 | /*! @brief Waits until events are queued and processes them. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3730 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3731 | * This function puts the calling thread to sleep until at least one event is |
| 3732 | * available in the event queue. Once one or more events are available, |
| 3733 | * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue |
| 3734 | * are processed and the function then returns immediately. Processing events |
| 3735 | * will cause the window and input callbacks associated with those events to be |
| 3736 | * called. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 3737 | * |
| 3738 | * Since not all events are associated with callbacks, this function may return |
| 3739 | * without a callback having been called even if you are monitoring all |
| 3740 | * callbacks. |
| 3741 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3742 | * On some platforms, a window move, resize or menu operation will cause event |
| 3743 | * processing to block. This is due to how event processing is designed on |
| 3744 | * those platforms. You can use the |
| 3745 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3746 | * your window when necessary during such operations. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3747 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3748 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3749 | * event processing functions like this one. While it is necessary to poll for |
| 3750 | * events, window systems that require GLFW to register callbacks of its own |
| 3751 | * can pass events to GLFW in response to many window system function calls. |
| 3752 | * GLFW will pass those events on to the application callbacks before |
| 3753 | * returning. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3754 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3755 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3756 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3757 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3758 | * GLFW_PLATFORM_ERROR. |
| 3759 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3760 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 3761 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3762 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3763 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3764 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3765 | * @sa @ref glfwPollEvents |
| 3766 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3767 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3768 | * @since Added in version 2.5. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3769 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3770 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3771 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 3772 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 3773 | |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3774 | /*! @brief Waits with timeout until events are queued and processes them. |
| 3775 | * |
| 3776 | * This function puts the calling thread to sleep until at least one event is |
| 3777 | * available in the event queue, or until the specified timeout is reached. If |
| 3778 | * one or more events are available, it behaves exactly like @ref |
| 3779 | * glfwPollEvents, i.e. the events in the queue are processed and the function |
| 3780 | * then returns immediately. Processing events will cause the window and input |
| 3781 | * callbacks associated with those events to be called. |
| 3782 | * |
| 3783 | * The timeout value must be a positive finite number. |
| 3784 | * |
| 3785 | * Since not all events are associated with callbacks, this function may return |
| 3786 | * without a callback having been called even if you are monitoring all |
| 3787 | * callbacks. |
| 3788 | * |
| 3789 | * On some platforms, a window move, resize or menu operation will cause event |
| 3790 | * processing to block. This is due to how event processing is designed on |
| 3791 | * those platforms. You can use the |
| 3792 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3793 | * your window when necessary during such operations. |
| 3794 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3795 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3796 | * event processing functions like this one. While it is necessary to poll for |
| 3797 | * events, window systems that require GLFW to register callbacks of its own |
| 3798 | * can pass events to GLFW in response to many window system function calls. |
| 3799 | * GLFW will pass those events on to the application callbacks before |
| 3800 | * returning. |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3801 | * |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3802 | * Event processing is not required for joystick input to work. |
| 3803 | * |
| 3804 | * @param[in] timeout The maximum amount of time, in seconds, to wait. |
| 3805 | * |
Sylvain Boilard | 3b255af | 2018-09-13 16:23:44 +0200 | [diff] [blame] | 3806 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Camilla Löwy | 8e313d9 | 2018-12-13 20:33:17 +0100 | [diff] [blame] | 3807 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Sylvain Boilard | 3b255af | 2018-09-13 16:23:44 +0200 | [diff] [blame] | 3808 | * |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3809 | * @reentrancy This function must not be called from a callback. |
| 3810 | * |
| 3811 | * @thread_safety This function must only be called from the main thread. |
| 3812 | * |
| 3813 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3814 | * @sa @ref glfwPollEvents |
| 3815 | * @sa @ref glfwWaitEvents |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3816 | * |
| 3817 | * @since Added in version 3.2. |
| 3818 | * |
| 3819 | * @ingroup window |
| 3820 | */ |
| 3821 | GLFWAPI void glfwWaitEventsTimeout(double timeout); |
| 3822 | |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3823 | /*! @brief Posts an empty event to the event queue. |
| 3824 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3825 | * 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] | 3826 | * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3827 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3828 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3829 | * GLFW_PLATFORM_ERROR. |
| 3830 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3831 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3832 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3833 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3834 | * @sa @ref glfwWaitEvents |
| 3835 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3836 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3837 | * @since Added in version 3.1. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3838 | * |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3839 | * @ingroup window |
| 3840 | */ |
| 3841 | GLFWAPI void glfwPostEmptyEvent(void); |
| 3842 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3843 | /*! @brief Returns the value of an input option for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3844 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3845 | * 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] | 3846 | * 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] | 3847 | * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3848 | * @ref GLFW_RAW_MOUSE_MOTION. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3849 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3850 | * @param[in] window The window to query. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3851 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3852 | * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or |
| 3853 | * `GLFW_RAW_MOUSE_MOTION`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3854 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3855 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3856 | * GLFW_INVALID_ENUM. |
| 3857 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3858 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3859 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3860 | * @sa @ref glfwSetInputMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3861 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3862 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3863 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3864 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3865 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3866 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3867 | |
| 3868 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3869 | * |
| 3870 | * 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] | 3871 | * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3872 | * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3873 | * @ref GLFW_RAW_MOUSE_MOTION. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3874 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3875 | * 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] | 3876 | * modes: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 3877 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 3878 | * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the |
| 3879 | * 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] | 3880 | * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual |
| 3881 | * and unlimited cursor movement. This is useful for implementing for |
| 3882 | * example 3D camera controls. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3883 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 3884 | * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to |
| 3885 | * 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] | 3886 | * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` |
| 3887 | * the next time it is called even if the key had been released before the |
| 3888 | * call. This is useful when you are only interested in whether keys have been |
| 3889 | * pressed but not when or in which order. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3890 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3891 | * 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] | 3892 | * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. |
| 3893 | * If sticky mouse buttons are enabled, a mouse button press will ensure that |
| 3894 | * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even |
| 3895 | * if the mouse button had been released before the call. This is useful when |
| 3896 | * you are only interested in whether mouse buttons have been pressed but not |
| 3897 | * when or in which order. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3898 | * |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3899 | * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to |
| 3900 | * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled, |
| 3901 | * callbacks that receive modifier bits will also have the @ref |
| 3902 | * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on, |
| 3903 | * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on. |
| 3904 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3905 | * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE` |
| 3906 | * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is |
| 3907 | * disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported, |
| 3908 | * attempting to set this will emit @ref GLFW_PLATFORM_ERROR. Call @ref |
| 3909 | * glfwRawMouseMotionSupported to check for support. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3910 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3911 | * @param[in] window The window whose input mode to set. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3912 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3913 | * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or |
| 3914 | * `GLFW_RAW_MOUSE_MOTION`. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3915 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3916 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3917 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3918 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 3919 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3920 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3921 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3922 | * @sa @ref glfwGetInputMode |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3923 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3924 | * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3925 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3926 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3927 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3928 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3929 | |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3930 | /*! @brief Returns whether raw mouse motion is supported. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3931 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3932 | * This function returns whether raw mouse motion is supported on the current |
| 3933 | * system. This status does not change after GLFW has been initialized so you |
| 3934 | * only need to check this once. If you attempt to enable raw motion on |
| 3935 | * 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] | 3936 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3937 | * Raw mouse motion is closer to the actual motion of the mouse across |
| 3938 | * a surface. It is not affected by the scaling and acceleration applied to |
| 3939 | * the motion of the desktop cursor. That processing is suitable for a cursor |
| 3940 | * while raw motion is better for controlling for example a 3D camera. Because |
| 3941 | * 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] | 3942 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3943 | * @return `GLFW_TRUE` if raw mouse motion is supported on the current machine, |
| 3944 | * or `GLFW_FALSE` otherwise. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3945 | * |
| 3946 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3947 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3948 | * @thread_safety This function must only be called from the main thread. |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3949 | * |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3950 | * @sa @ref raw_mouse_motion |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3951 | * @sa @ref glfwSetInputMode |
| 3952 | * |
| 3953 | * @since Added in version 3.3. |
| 3954 | * |
| 3955 | * @ingroup input |
| 3956 | */ |
Camilla Löwy | 1155c83 | 2019-02-11 19:10:20 +0100 | [diff] [blame] | 3957 | GLFWAPI int glfwRawMouseMotionSupported(void); |
Nathan Poirier | 9e29f55 | 2018-12-14 03:08:25 +0100 | [diff] [blame] | 3958 | |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 3959 | /*! @brief Returns the layout-specific name of the specified printable key. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3960 | * |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 3961 | * This function returns the name of the specified printable key, encoded as |
| 3962 | * UTF-8. This is typically the character that key would produce without any |
| 3963 | * modifier keys, intended for displaying key bindings to the user. For dead |
| 3964 | * keys, it is typically the diacritic it would add to a character. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3965 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 3966 | * __Do not use this function__ for [text input](@ref input_char). You will |
| 3967 | * 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] | 3968 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 3969 | * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key, |
| 3970 | * otherwise the scancode is ignored. If you specify a non-printable key, or |
| 3971 | * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this |
| 3972 | * function returns `NULL` but does not emit an error. |
| 3973 | * |
| 3974 | * This behavior allows you to always pass in the arguments in the |
Camilla Berglund | 70ffae7 | 2016-02-22 11:54:56 +0100 | [diff] [blame] | 3975 | * [key callback](@ref input_key) without modification. |
| 3976 | * |
| 3977 | * The printable keys are: |
| 3978 | * - `GLFW_KEY_APOSTROPHE` |
| 3979 | * - `GLFW_KEY_COMMA` |
| 3980 | * - `GLFW_KEY_MINUS` |
| 3981 | * - `GLFW_KEY_PERIOD` |
| 3982 | * - `GLFW_KEY_SLASH` |
| 3983 | * - `GLFW_KEY_SEMICOLON` |
| 3984 | * - `GLFW_KEY_EQUAL` |
| 3985 | * - `GLFW_KEY_LEFT_BRACKET` |
| 3986 | * - `GLFW_KEY_RIGHT_BRACKET` |
| 3987 | * - `GLFW_KEY_BACKSLASH` |
| 3988 | * - `GLFW_KEY_WORLD_1` |
| 3989 | * - `GLFW_KEY_WORLD_2` |
| 3990 | * - `GLFW_KEY_0` to `GLFW_KEY_9` |
| 3991 | * - `GLFW_KEY_A` to `GLFW_KEY_Z` |
| 3992 | * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9` |
| 3993 | * - `GLFW_KEY_KP_DECIMAL` |
| 3994 | * - `GLFW_KEY_KP_DIVIDE` |
| 3995 | * - `GLFW_KEY_KP_MULTIPLY` |
| 3996 | * - `GLFW_KEY_KP_SUBTRACT` |
| 3997 | * - `GLFW_KEY_KP_ADD` |
| 3998 | * - `GLFW_KEY_KP_EQUAL` |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3999 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 4000 | * Names for printable keys depend on keyboard layout, while names for |
| 4001 | * non-printable keys are the same across layouts but depend on the application |
| 4002 | * language and should be localized along with other user interface text. |
| 4003 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4004 | * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`. |
| 4005 | * @param[in] scancode The scancode of the key to query. |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 4006 | * @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] | 4007 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4008 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4009 | * GLFW_PLATFORM_ERROR. |
| 4010 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4011 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4012 | * should not free it yourself. It is valid until the next call to @ref |
| 4013 | * glfwGetKeyName, or until the library is terminated. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4014 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4015 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4016 | * |
| 4017 | * @sa @ref input_key_name |
| 4018 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4019 | * @since Added in version 3.2. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4020 | * |
| 4021 | * @ingroup input |
| 4022 | */ |
| 4023 | GLFWAPI const char* glfwGetKeyName(int key, int scancode); |
| 4024 | |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4025 | /*! @brief Returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4026 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4027 | * This function returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4028 | * |
| 4029 | * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this |
| 4030 | * method will return `-1`. |
| 4031 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4032 | * @param[in] key Any [named key](@ref keys). |
| 4033 | * @return The platform-specific scancode for the key, or `-1` if an |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4034 | * [error](@ref error_handling) occurred. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4035 | * |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4036 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4037 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4038 | * |
| 4039 | * @thread_safety This function may be called from any thread. |
| 4040 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 4041 | * @sa @ref input_key |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4042 | * |
| 4043 | * @since Added in version 3.3. |
| 4044 | * |
| 4045 | * @ingroup input |
| 4046 | */ |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 4047 | GLFWAPI int glfwGetKeyScancode(int key); |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 4048 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4049 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 4050 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4051 | * |
| 4052 | * This function returns the last state reported for the specified key to the |
| 4053 | * specified window. The returned state is one of `GLFW_PRESS` or |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4054 | * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4055 | * the key callback. |
| 4056 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4057 | * 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] | 4058 | * `GLFW_PRESS` the first time you call it for a key that was pressed, even if |
| 4059 | * that key has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4060 | * |
| 4061 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 4062 | * named after their use on the standard US keyboard layout. If you want to |
| 4063 | * input text, use the Unicode character callback instead. |
| 4064 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4065 | * The [modifier key bit masks](@ref mods) are not key tokens and cannot be |
| 4066 | * used with this function. |
| 4067 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 4068 | * __Do not use this function__ to implement [text input](@ref input_char). |
| 4069 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4070 | * @param[in] window The desired window. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4071 | * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is |
| 4072 | * not a valid key for this function. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4073 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4074 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4075 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4076 | * GLFW_INVALID_ENUM. |
| 4077 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4078 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4079 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4080 | * @sa @ref input_key |
| 4081 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4082 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4083 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 4084 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4085 | * @ingroup input |
| 4086 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4087 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4088 | |
| 4089 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 4090 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4091 | * |
| 4092 | * This function returns the last state reported for the specified mouse button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4093 | * 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] | 4094 | * `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4095 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4096 | * 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] | 4097 | * returns `GLFW_PRESS` the first time you call it for a mouse button that was |
| 4098 | * pressed, even if that mouse button has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4099 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4100 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4101 | * @param[in] button The desired [mouse button](@ref buttons). |
| 4102 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4103 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4104 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4105 | * GLFW_INVALID_ENUM. |
| 4106 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4107 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4108 | * |
| 4109 | * @sa @ref input_mouse_button |
| 4110 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4111 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4112 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4113 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4114 | * @ingroup input |
| 4115 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4116 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4117 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4118 | /*! @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] | 4119 | * the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4120 | * |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 4121 | * This function returns the position of the cursor, in screen coordinates, |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4122 | * 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] | 4123 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4124 | * |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4125 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
| 4126 | * position is unbounded and limited only by the minimum and maximum values of |
| 4127 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4128 | * |
Camilla Berglund | 3ec2925 | 2013-04-25 18:03:15 +0200 | [diff] [blame] | 4129 | * The coordinate can be converted to their integer equivalents with the |
| 4130 | * `floor` function. Casting directly to an integer type works for positive |
| 4131 | * coordinates, but fails for negative ones. |
| 4132 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4133 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 4134 | * non-`NULL` position arguments will be set to zero. |
| 4135 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4136 | * @param[in] window The desired window. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4137 | * @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] | 4138 | * left edge of the content area, or `NULL`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4139 | * @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] | 4140 | * top edge of the content area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4141 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4142 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4143 | * GLFW_PLATFORM_ERROR. |
| 4144 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4145 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4146 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4147 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4148 | * @sa @ref glfwSetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4149 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4150 | * @since Added in version 3.0. Replaces `glfwGetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4151 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4152 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4153 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4154 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4155 | |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4156 | /*! @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] | 4157 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4158 | * |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 4159 | * This function sets the position, in screen coordinates, of the cursor |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4160 | * 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] | 4161 | * window. The window must have input focus. If the window does not have |
| 4162 | * input focus when this function is called, it fails silently. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4163 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 4164 | * __Do not use this function__ to implement things like camera controls. GLFW |
| 4165 | * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the |
| 4166 | * cursor, transparently re-centers it and provides unconstrained cursor |
| 4167 | * motion. See @ref glfwSetInputMode for more information. |
| 4168 | * |
| 4169 | * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is |
| 4170 | * unconstrained and limited only by the minimum and maximum values of |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4171 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4172 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4173 | * @param[in] window The desired window. |
| 4174 | * @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] | 4175 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4176 | * @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] | 4177 | * content area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4178 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4179 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4180 | * GLFW_PLATFORM_ERROR. |
| 4181 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4182 | * @remark @wayland This function will only work when the cursor mode is |
| 4183 | * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing. |
| 4184 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4185 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4186 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4187 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4188 | * @sa @ref glfwGetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4189 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4190 | * @since Added in version 3.0. Replaces `glfwSetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4191 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4192 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4193 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4194 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4195 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4196 | /*! @brief Creates a custom cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4197 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4198 | * Creates a new custom cursor image that can be set for a window with @ref |
| 4199 | * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. |
| 4200 | * Any remaining cursors are destroyed by @ref glfwTerminate. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4201 | * |
Camilla Berglund | 85a01bf | 2015-08-17 21:04:19 +0200 | [diff] [blame] | 4202 | * 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] | 4203 | * bits per channel with the red channel first. They are arranged canonically |
| 4204 | * as packed sequential rows, starting from the top-left corner. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4205 | * |
| 4206 | * The cursor hotspot is specified in pixels, relative to the upper-left corner |
| 4207 | * of the cursor image. Like all other coordinate systems in GLFW, the X-axis |
| 4208 | * points to the right and the Y-axis points down. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4209 | * |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 4210 | * @param[in] image The desired cursor image. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4211 | * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. |
| 4212 | * @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] | 4213 | * @return The handle of the created cursor, or `NULL` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4214 | * [error](@ref error_handling) occurred. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4215 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4216 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4217 | * GLFW_PLATFORM_ERROR. |
| 4218 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4219 | * @pointer_lifetime The specified image data is copied before this function |
| 4220 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4221 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4222 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4223 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4224 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4225 | * @sa @ref glfwDestroyCursor |
| 4226 | * @sa @ref glfwCreateStandardCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4227 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4228 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4229 | * |
| 4230 | * @ingroup input |
| 4231 | */ |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 4232 | GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4233 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4234 | /*! @brief Creates a cursor with a standard shape. |
| 4235 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4236 | * Returns a cursor with a [standard shape](@ref shapes), that can be set for |
| 4237 | * a window with @ref glfwSetCursor. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4238 | * |
| 4239 | * @param[in] shape One of the [standard shapes](@ref shapes). |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4240 | * @return A new cursor ready to use or `NULL` if an |
| 4241 | * [error](@ref error_handling) occurred. |
| 4242 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4243 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4244 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4245 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4246 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4247 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4248 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4249 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4250 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4251 | * @since Added in version 3.1. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4252 | * |
| 4253 | * @ingroup input |
| 4254 | */ |
| 4255 | GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); |
| 4256 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4257 | /*! @brief Destroys a cursor. |
| 4258 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4259 | * This function destroys a cursor previously created with @ref |
| 4260 | * glfwCreateCursor. Any remaining cursors will be destroyed by @ref |
| 4261 | * glfwTerminate. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4262 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4263 | * If the specified cursor is current for any window, that window will be |
| 4264 | * reverted to the default cursor. This does not affect the cursor mode. |
| 4265 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4266 | * @param[in] cursor The cursor object to destroy. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4267 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4268 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4269 | * GLFW_PLATFORM_ERROR. |
| 4270 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4271 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4272 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4273 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4274 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4275 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4276 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4277 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4278 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4279 | * |
| 4280 | * @ingroup input |
| 4281 | */ |
| 4282 | GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); |
| 4283 | |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4284 | /*! @brief Sets the cursor for the window. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4285 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4286 | * 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] | 4287 | * 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] | 4288 | * when the [cursor mode](@ref cursor_mode) of the window is |
| 4289 | * `GLFW_CURSOR_NORMAL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4290 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4291 | * On some platforms, the set cursor may not be visible unless the window also |
| 4292 | * has input focus. |
| 4293 | * |
| 4294 | * @param[in] window The window to set the cursor for. |
| 4295 | * @param[in] cursor The cursor to set, or `NULL` to switch back to the default |
| 4296 | * arrow cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4297 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4298 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4299 | * GLFW_PLATFORM_ERROR. |
| 4300 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4301 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4302 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4303 | * @sa @ref cursor_object |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4304 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4305 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4306 | * |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4307 | * @ingroup input |
| 4308 | */ |
| 4309 | GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); |
| 4310 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4311 | /*! @brief Sets the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4312 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4313 | * 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] | 4314 | * when a key is pressed, repeated or released. |
| 4315 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4316 | * The key functions deal with physical keys, with layout independent |
| 4317 | * [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] | 4318 | * layout. If you want to input text, use the |
| 4319 | * [character callback](@ref glfwSetCharCallback) instead. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4320 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4321 | * When a window loses input focus, it will generate synthetic key release |
| 4322 | * events for all pressed keys. You can tell these events from user-generated |
| 4323 | * events by the fact that the synthetic ones are generated after the focus |
| 4324 | * loss event has been processed, i.e. after the |
| 4325 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 4326 | * |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 4327 | * The scancode of a key is specific to that platform or sometimes even to that |
| 4328 | * machine. Scancodes are intended to allow users to bind keys that don't have |
| 4329 | * 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] | 4330 | * 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] | 4331 | * |
| 4332 | * Sometimes GLFW needs to generate synthetic key events, in which case the |
| 4333 | * scancode may be zero. |
| 4334 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4335 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4336 | * @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] | 4337 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4338 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4339 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4340 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4341 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4342 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4343 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4344 | * |
| 4345 | * @sa @ref input_key |
| 4346 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4347 | * @since Added in version 1.0. |
| 4348 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4349 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4350 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4351 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4352 | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4353 | |
| 4354 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4355 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4356 | * This function sets the character callback of the specified window, which is |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4357 | * called when a Unicode character is input. |
| 4358 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4359 | * The character callback is intended for Unicode text input. As it deals with |
| 4360 | * characters, it is keyboard layout dependent, whereas the |
| 4361 | * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 |
| 4362 | * to physical keys, as a key may produce zero, one or more characters. If you |
| 4363 | * want to know whether a specific physical key was pressed or released, see |
| 4364 | * the key callback instead. |
| 4365 | * |
| 4366 | * The character callback behaves as system text input normally does and will |
| 4367 | * 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] | 4368 | * 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] | 4369 | * on Windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4370 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4371 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4372 | * @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] | 4373 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4374 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4375 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4376 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4377 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4378 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4379 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4380 | * |
| 4381 | * @sa @ref input_char |
| 4382 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4383 | * @since Added in version 2.4. |
| 4384 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4385 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4386 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4387 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4388 | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4389 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4390 | /*! @brief Sets the Unicode character with modifiers callback. |
| 4391 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4392 | * This function sets the character with modifiers callback of the specified |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4393 | * window, which is called when a Unicode character is input regardless of what |
| 4394 | * modifier keys are used. |
| 4395 | * |
| 4396 | * The character with modifiers callback is intended for implementing custom |
| 4397 | * Unicode character input. For regular Unicode text input, see the |
| 4398 | * [character callback](@ref glfwSetCharCallback). Like the character |
| 4399 | * callback, the character with modifiers callback deals with characters and is |
| 4400 | * keyboard layout dependent. Characters do not map 1:1 to physical keys, as |
| 4401 | * a key may produce zero, one or more characters. If you want to know whether |
| 4402 | * a specific physical key was pressed or released, see the |
| 4403 | * [key callback](@ref glfwSetKeyCallback) instead. |
| 4404 | * |
| 4405 | * @param[in] window The window whose callback to set. |
| 4406 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 4407 | * callback. |
| 4408 | * @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] | 4409 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4410 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 4411 | * @deprecated Scheduled for removal in version 4.0. |
| 4412 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4413 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4414 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4415 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4416 | * |
| 4417 | * @sa @ref input_char |
| 4418 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4419 | * @since Added in version 3.1. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4420 | * |
| 4421 | * @ingroup input |
| 4422 | */ |
| 4423 | GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun); |
| 4424 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4425 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4426 | * |
| 4427 | * This function sets the mouse button callback of the specified window, which |
| 4428 | * is called when a mouse button is pressed or released. |
| 4429 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4430 | * When a window loses input focus, it will generate synthetic mouse button |
| 4431 | * release events for all pressed mouse buttons. You can tell these events |
| 4432 | * from user-generated events by the fact that the synthetic ones are generated |
| 4433 | * after the focus loss event has been processed, i.e. after the |
| 4434 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 4435 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4436 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4437 | * @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] | 4438 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4439 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4440 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4441 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4442 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4443 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4444 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4445 | * |
| 4446 | * @sa @ref input_mouse_button |
| 4447 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4448 | * @since Added in version 1.0. |
| 4449 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4450 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4451 | * @ingroup input |
| 4452 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4453 | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4454 | |
| 4455 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4456 | * |
| 4457 | * This function sets the cursor position callback of the specified window, |
| 4458 | * 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] | 4459 | * 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] | 4460 | * content area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4461 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4462 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4463 | * @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] | 4464 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4465 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4466 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4467 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4468 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4469 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4470 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4471 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4472 | * @sa @ref cursor_pos |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4473 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4474 | * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4475 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4476 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4477 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4478 | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4479 | |
| 4480 | /*! @brief Sets the cursor enter/exit callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4481 | * |
| 4482 | * This function sets the cursor boundary crossing callback of the specified |
Camilla Löwy | d5ab3e9 | 2019-01-22 20:54:16 +0100 | [diff] [blame] | 4483 | * 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] | 4484 | * the window. |
| 4485 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4486 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4487 | * @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] | 4488 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4489 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4490 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4491 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4492 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4493 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4494 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4495 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4496 | * @sa @ref cursor_enter |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4497 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4498 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4499 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4500 | * @ingroup input |
| 4501 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4502 | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4503 | |
| 4504 | /*! @brief Sets the scroll callback. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4505 | * |
| 4506 | * This function sets the scroll callback of the specified window, which is |
| 4507 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
| 4508 | * area of a touchpad. |
| 4509 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4510 | * The scroll callback receives all scrolling input, like that from a mouse |
| 4511 | * wheel or a touchpad scrolling area. |
| 4512 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4513 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4514 | * @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] | 4515 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4516 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4517 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4518 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4519 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4520 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4521 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4522 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4523 | * @sa @ref scrolling |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4524 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4525 | * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4526 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4527 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4528 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4529 | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4530 | |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4531 | /*! @brief Sets the file drop callback. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4532 | * |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4533 | * This function sets the file drop callback of the specified window, which is |
| 4534 | * called when one or more dragged files are dropped on the window. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4535 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4536 | * Because the path array and its strings may have been generated specifically |
| 4537 | * for that event, they are not guaranteed to be valid after the callback has |
| 4538 | * returned. If you wish to use them after the callback returns, you need to |
| 4539 | * make a deep copy. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4540 | * |
| 4541 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4542 | * @param[in] cbfun The new file drop callback, or `NULL` to remove the |
| 4543 | * currently set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4544 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4545 | * library had not been [initialized](@ref intro_init). |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4546 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4547 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4548 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4549 | * @remark @wayland File drop is currently unimplemented. |
| 4550 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4551 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4552 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4553 | * @sa @ref path_drop |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4554 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4555 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4556 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4557 | * @ingroup input |
| 4558 | */ |
| 4559 | GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun); |
| 4560 | |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 4561 | /*! @brief Returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4562 | * |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 4563 | * This function returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4564 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4565 | * There is no need to call this function before other functions that accept |
| 4566 | * a joystick ID, as they all check for presence before performing any other |
| 4567 | * work. |
| 4568 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4569 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 4570 | * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4571 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4572 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4573 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4574 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4575 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4576 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4577 | * @sa @ref joystick |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4578 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4579 | * @since Added in version 3.0. Replaces `glfwGetJoystickParam`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4580 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4581 | * @ingroup input |
| 4582 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4583 | GLFWAPI int glfwJoystickPresent(int jid); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4584 | |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4585 | /*! @brief Returns the values of all axes of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4586 | * |
| 4587 | * This function returns the values of all axes of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4588 | * 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] | 4589 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4590 | * 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] | 4591 | * but will not generate an error. This can be used instead of first calling |
| 4592 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4593 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4594 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4595 | * @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] | 4596 | * array. This is set to zero if the joystick is not present or an error |
| 4597 | * occurred. |
| 4598 | * @return An array of axis values, or `NULL` if the joystick is not present or |
| 4599 | * an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4600 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4601 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4602 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4603 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4604 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 4605 | * 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] | 4606 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4607 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4608 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4609 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4610 | * @sa @ref joystick_axis |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4611 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4612 | * @since Added in version 3.0. Replaces `glfwGetJoystickPos`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4613 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4614 | * @ingroup input |
| 4615 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4616 | GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4617 | |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 4618 | /*! @brief Returns the state of all buttons of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4619 | * |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 4620 | * This function returns the state of all buttons of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4621 | * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4622 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4623 | * For backward compatibility with earlier versions that did not have @ref |
| 4624 | * glfwGetJoystickHats, the button array also includes all hats, each |
| 4625 | * represented as four buttons. The hats are in the same order as returned by |
| 4626 | * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and |
| 4627 | * _left_. To disable these extra buttons, set the @ref |
| 4628 | * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization. |
| 4629 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4630 | * 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] | 4631 | * but will not generate an error. This can be used instead of first calling |
| 4632 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4633 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4634 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4635 | * @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] | 4636 | * array. This is set to zero if the joystick is not present or an error |
| 4637 | * occurred. |
| 4638 | * @return An array of button states, or `NULL` if the joystick is not present |
| 4639 | * or an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4640 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4641 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4642 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4643 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4644 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 4645 | * 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] | 4646 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4647 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4648 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4649 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4650 | * @sa @ref joystick_button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4651 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4652 | * @since Added in version 2.2. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4653 | * @glfw3 Changed to return a dynamic array. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4654 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4655 | * @ingroup input |
| 4656 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4657 | GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4658 | |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4659 | /*! @brief Returns the state of all hats of the specified joystick. |
| 4660 | * |
| 4661 | * 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] | 4662 | * Each element in the array is one of the following values: |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4663 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4664 | * Name | Value |
Camilla Löwy | bb2ca1d | 2018-11-27 21:49:19 +0100 | [diff] [blame] | 4665 | * ---- | ----- |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4666 | * `GLFW_HAT_CENTERED` | 0 |
| 4667 | * `GLFW_HAT_UP` | 1 |
| 4668 | * `GLFW_HAT_RIGHT` | 2 |
| 4669 | * `GLFW_HAT_DOWN` | 4 |
| 4670 | * `GLFW_HAT_LEFT` | 8 |
| 4671 | * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` |
| 4672 | * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` |
| 4673 | * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` |
| 4674 | * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4675 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4676 | * The diagonal directions are bitwise combinations of the primary (up, right, |
| 4677 | * down and left) directions and you can test for these individually by ANDing |
| 4678 | * it with the corresponding direction. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4679 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4680 | * @code |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 4681 | * if (hats[2] & GLFW_HAT_RIGHT) |
| 4682 | * { |
| 4683 | * // State of hat 2 could be right-up, right or right-down |
| 4684 | * } |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4685 | * @endcode |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4686 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4687 | * 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] | 4688 | * but will not generate an error. This can be used instead of first calling |
| 4689 | * @ref glfwJoystickPresent. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4690 | * |
| 4691 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4692 | * @param[out] count Where to store the number of hat states in the returned |
| 4693 | * array. This is set to zero if the joystick is not present or an error |
| 4694 | * occurred. |
| 4695 | * @return An array of hat states, or `NULL` if the joystick is not present |
| 4696 | * or an [error](@ref error_handling) occurred. |
| 4697 | * |
| 4698 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4699 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4700 | * |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4701 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 4702 | * should not free it yourself. It is valid until the specified joystick is |
| 4703 | * disconnected, this function is called again for that joystick or the library |
| 4704 | * is terminated. |
| 4705 | * |
| 4706 | * @thread_safety This function must only be called from the main thread. |
| 4707 | * |
| 4708 | * @sa @ref joystick_hat |
| 4709 | * |
| 4710 | * @since Added in version 3.3. |
| 4711 | * |
| 4712 | * @ingroup input |
| 4713 | */ |
| 4714 | GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count); |
| 4715 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 4716 | /*! @brief Returns the name of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4717 | * |
| 4718 | * 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] | 4719 | * The returned string is allocated and freed by GLFW. You should not free it |
| 4720 | * yourself. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4721 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4722 | * 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] | 4723 | * but will not generate an error. This can be used instead of first calling |
| 4724 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4725 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4726 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4727 | * @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] | 4728 | * is not present or an [error](@ref error_handling) occurred. |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 4729 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4730 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4731 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4732 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4733 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4734 | * 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] | 4735 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4736 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4737 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4738 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4739 | * @sa @ref joystick_name |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4740 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4741 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4742 | * |
| 4743 | * @ingroup input |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 4744 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4745 | GLFWAPI const char* glfwGetJoystickName(int jid); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4746 | |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4747 | /*! @brief Returns the SDL comaptible GUID of the specified joystick. |
| 4748 | * |
| 4749 | * This function returns the SDL compatible GUID, as a UTF-8 encoded |
| 4750 | * hexadecimal string, of the specified joystick. The returned string is |
| 4751 | * allocated and freed by GLFW. You should not free it yourself. |
| 4752 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4753 | * The GUID is what connects a joystick to a gamepad mapping. A connected |
| 4754 | * joystick will always have a GUID even if there is no gamepad mapping |
| 4755 | * assigned to it. |
| 4756 | * |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4757 | * 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] | 4758 | * but will not generate an error. This can be used instead of first calling |
| 4759 | * @ref glfwJoystickPresent. |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4760 | * |
| 4761 | * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to |
| 4762 | * uniquely identify the make and model of a joystick but does not identify |
| 4763 | * a specific unit, e.g. all wired Xbox 360 controllers will have the same |
| 4764 | * GUID on that platform. The GUID for a unit may vary between platforms |
| 4765 | * depending on what hardware information the platform specific APIs provide. |
| 4766 | * |
| 4767 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4768 | * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick |
| 4769 | * is not present or an [error](@ref error_handling) occurred. |
| 4770 | * |
| 4771 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4772 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4773 | * |
| 4774 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4775 | * should not free it yourself. It is valid until the specified joystick is |
| 4776 | * disconnected or the library is terminated. |
| 4777 | * |
| 4778 | * @thread_safety This function must only be called from the main thread. |
| 4779 | * |
| 4780 | * @sa @ref gamepad |
| 4781 | * |
| 4782 | * @since Added in version 3.3. |
| 4783 | * |
| 4784 | * @ingroup input |
| 4785 | */ |
| 4786 | GLFWAPI const char* glfwGetJoystickGUID(int jid); |
| 4787 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 4788 | /*! @brief Sets the user pointer of the specified joystick. |
| 4789 | * |
| 4790 | * This function sets the user-defined pointer of the specified joystick. The |
| 4791 | * current value is retained until the joystick is disconnected. The initial |
| 4792 | * value is `NULL`. |
| 4793 | * |
| 4794 | * This function may be called from the joystick callback, even for a joystick |
| 4795 | * that is being disconnected. |
| 4796 | * |
Camilla Löwy | d222a40 | 2018-02-25 20:37:31 +0100 | [diff] [blame] | 4797 | * @param[in] jid The joystick whose pointer to set. |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 4798 | * @param[in] pointer The new value. |
| 4799 | * |
| 4800 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4801 | * |
| 4802 | * @thread_safety This function may be called from any thread. Access is not |
| 4803 | * synchronized. |
| 4804 | * |
| 4805 | * @sa @ref joystick_userptr |
| 4806 | * @sa @ref glfwGetJoystickUserPointer |
| 4807 | * |
| 4808 | * @since Added in version 3.3. |
| 4809 | * |
| 4810 | * @ingroup input |
| 4811 | */ |
| 4812 | GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer); |
| 4813 | |
| 4814 | /*! @brief Returns the user pointer of the specified joystick. |
| 4815 | * |
| 4816 | * This function returns the current value of the user-defined pointer of the |
| 4817 | * specified joystick. The initial value is `NULL`. |
| 4818 | * |
| 4819 | * This function may be called from the joystick callback, even for a joystick |
| 4820 | * that is being disconnected. |
| 4821 | * |
Camilla Löwy | d222a40 | 2018-02-25 20:37:31 +0100 | [diff] [blame] | 4822 | * @param[in] jid The joystick whose pointer to return. |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 4823 | * |
| 4824 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4825 | * |
| 4826 | * @thread_safety This function may be called from any thread. Access is not |
| 4827 | * synchronized. |
| 4828 | * |
| 4829 | * @sa @ref joystick_userptr |
| 4830 | * @sa @ref glfwSetJoystickUserPointer |
| 4831 | * |
| 4832 | * @since Added in version 3.3. |
| 4833 | * |
| 4834 | * @ingroup input |
| 4835 | */ |
| 4836 | GLFWAPI void* glfwGetJoystickUserPointer(int jid); |
| 4837 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4838 | /*! @brief Returns whether the specified joystick has a gamepad mapping. |
| 4839 | * |
| 4840 | * This function returns whether the specified joystick is both present and has |
| 4841 | * a gamepad mapping. |
| 4842 | * |
| 4843 | * If the specified joystick is present but does not have a gamepad mapping |
| 4844 | * 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] | 4845 | * @ref glfwJoystickPresent to check if a joystick is present regardless of |
| 4846 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4847 | * |
| 4848 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4849 | * @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping, |
| 4850 | * or `GLFW_FALSE` otherwise. |
| 4851 | * |
| 4852 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4853 | * GLFW_INVALID_ENUM. |
| 4854 | * |
| 4855 | * @thread_safety This function must only be called from the main thread. |
| 4856 | * |
| 4857 | * @sa @ref gamepad |
| 4858 | * @sa @ref glfwGetGamepadState |
| 4859 | * |
| 4860 | * @since Added in version 3.3. |
| 4861 | * |
| 4862 | * @ingroup input |
| 4863 | */ |
| 4864 | GLFWAPI int glfwJoystickIsGamepad(int jid); |
| 4865 | |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 4866 | /*! @brief Sets the joystick configuration callback. |
| 4867 | * |
| 4868 | * This function sets the joystick configuration callback, or removes the |
| 4869 | * currently set callback. This is called when a joystick is connected to or |
| 4870 | * disconnected from the system. |
| 4871 | * |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 4872 | * For joystick connection and disconnection events to be delivered on all |
| 4873 | * platforms, you need to call one of the [event processing](@ref events) |
| 4874 | * functions. Joystick disconnection may also be detected and the callback |
| 4875 | * called by joystick functions. The function will then return whatever it |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4876 | * returns if the joystick is not present. |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 4877 | * |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 4878 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 4879 | * callback. |
| 4880 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4881 | * library had not been [initialized](@ref intro_init). |
| 4882 | * |
| 4883 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4884 | * |
| 4885 | * @thread_safety This function must only be called from the main thread. |
| 4886 | * |
| 4887 | * @sa @ref joystick_event |
| 4888 | * |
| 4889 | * @since Added in version 3.2. |
| 4890 | * |
| 4891 | * @ingroup input |
| 4892 | */ |
| 4893 | GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun); |
| 4894 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4895 | /*! @brief Adds the specified SDL_GameControllerDB gamepad mappings. |
| 4896 | * |
| 4897 | * This function parses the specified ASCII encoded string and updates the |
| 4898 | * internal list with any gamepad mappings it finds. This string may |
| 4899 | * contain either a single gamepad mapping or many mappings separated by |
| 4900 | * newlines. The parser supports the full format of the `gamecontrollerdb.txt` |
| 4901 | * source file including empty lines and comments. |
| 4902 | * |
| 4903 | * See @ref gamepad_mapping for a description of the format. |
| 4904 | * |
| 4905 | * If there is already a gamepad mapping for a given GUID in the internal list, |
| 4906 | * it will be replaced by the one passed to this function. If the library is |
| 4907 | * terminated and re-initialized the internal list will revert to the built-in |
| 4908 | * default. |
| 4909 | * |
| 4910 | * @param[in] string The string containing the gamepad mappings. |
| 4911 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
| 4912 | * [error](@ref error_handling) occurred. |
| 4913 | * |
| 4914 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4915 | * GLFW_INVALID_VALUE. |
| 4916 | * |
| 4917 | * @thread_safety This function must only be called from the main thread. |
| 4918 | * |
| 4919 | * @sa @ref gamepad |
| 4920 | * @sa @ref glfwJoystickIsGamepad |
| 4921 | * @sa @ref glfwGetGamepadName |
| 4922 | * |
| 4923 | * @since Added in version 3.3. |
| 4924 | * |
| 4925 | * @ingroup input |
| 4926 | */ |
| 4927 | GLFWAPI int glfwUpdateGamepadMappings(const char* string); |
| 4928 | |
| 4929 | /*! @brief Returns the human-readable gamepad name for the specified joystick. |
| 4930 | * |
| 4931 | * This function returns the human-readable name of the gamepad from the |
| 4932 | * gamepad mapping assigned to the specified joystick. |
| 4933 | * |
| 4934 | * 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] | 4935 | * this function will return `NULL` but will not generate an error. Call |
| 4936 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 4937 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4938 | * |
| 4939 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4940 | * @return The UTF-8 encoded name of the gamepad, or `NULL` if the |
| 4941 | * joystick is not present, does not have a mapping or an |
| 4942 | * [error](@ref error_handling) occurred. |
| 4943 | * |
| 4944 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4945 | * should not free it yourself. It is valid until the specified joystick is |
| 4946 | * disconnected, the gamepad mappings are updated or the library is terminated. |
| 4947 | * |
| 4948 | * @thread_safety This function must only be called from the main thread. |
| 4949 | * |
| 4950 | * @sa @ref gamepad |
| 4951 | * @sa @ref glfwJoystickIsGamepad |
| 4952 | * |
| 4953 | * @since Added in version 3.3. |
| 4954 | * |
| 4955 | * @ingroup input |
| 4956 | */ |
| 4957 | GLFWAPI const char* glfwGetGamepadName(int jid); |
| 4958 | |
| 4959 | /*! @brief Retrieves the state of the specified joystick remapped as a gamepad. |
| 4960 | * |
| 4961 | * This function retrives the state of the specified joystick remapped to |
| 4962 | * an Xbox-like gamepad. |
| 4963 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4964 | * If the specified joystick is not present or does not have a gamepad mapping |
| 4965 | * this function will return `GLFW_FALSE` but will not generate an error. Call |
| 4966 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 4967 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4968 | * |
| 4969 | * The Guide button may not be available for input as it is often hooked by the |
| 4970 | * system or the Steam client. |
| 4971 | * |
| 4972 | * Not all devices have all the buttons or axes provided by @ref |
| 4973 | * GLFWgamepadstate. Unavailable buttons and axes will always report |
Camilla Löwy | 34d20b0 | 2018-03-03 22:24:26 +0100 | [diff] [blame] | 4974 | * `GLFW_RELEASE` and 0.0 respectively. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4975 | * |
| 4976 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4977 | * @param[out] state The gamepad input state of the joystick. |
| 4978 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is |
| 4979 | * connected, it has no gamepad mapping or an [error](@ref error_handling) |
| 4980 | * occurred. |
| 4981 | * |
| 4982 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4983 | * GLFW_INVALID_ENUM. |
| 4984 | * |
Camilla Löwy | e1495c0 | 2018-08-09 13:57:10 +0200 | [diff] [blame] | 4985 | * @thread_safety This function must only be called from the main thread. |
| 4986 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4987 | * @sa @ref gamepad |
| 4988 | * @sa @ref glfwUpdateGamepadMappings |
| 4989 | * @sa @ref glfwJoystickIsGamepad |
| 4990 | * |
| 4991 | * @since Added in version 3.3. |
| 4992 | * |
| 4993 | * @ingroup input |
| 4994 | */ |
| 4995 | GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); |
| 4996 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4997 | /*! @brief Sets the clipboard to the specified string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4998 | * |
| 4999 | * This function sets the system clipboard to the specified, UTF-8 encoded |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5000 | * string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5001 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 5002 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5003 | * @param[in] string A UTF-8 encoded string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5004 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5005 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5006 | * GLFW_PLATFORM_ERROR. |
| 5007 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5008 | * @pointer_lifetime The specified string is copied before this function |
| 5009 | * returns. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 5010 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5011 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5012 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5013 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5014 | * @sa @ref glfwGetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5015 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5016 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5017 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 5018 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5019 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5020 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5021 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5022 | /*! @brief Returns the contents of the clipboard as a string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5023 | * |
| 5024 | * This function returns the contents of the system clipboard, if it contains |
Camilla Berglund | cf9079c | 2015-09-16 18:51:49 +0200 | [diff] [blame] | 5025 | * 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] | 5026 | * if its contents cannot be converted, `NULL` is returned and a @ref |
| 5027 | * GLFW_FORMAT_UNAVAILABLE error is generated. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5028 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 5029 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5030 | * @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] | 5031 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5032 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5033 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5034 | * GLFW_PLATFORM_ERROR. |
| 5035 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5036 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 5037 | * 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] | 5038 | * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library |
| 5039 | * is terminated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5040 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5041 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5042 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5043 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5044 | * @sa @ref glfwSetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5045 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5046 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5047 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 5048 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5049 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5050 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 5051 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5052 | /*! @brief Returns the value of the GLFW timer. |
| 5053 | * |
| 5054 | * This function returns the value of the GLFW timer. Unless the timer has |
| 5055 | * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW |
| 5056 | * was initialized. |
| 5057 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5058 | * The resolution of the timer is system dependent, but is usually on the order |
| 5059 | * of a few micro- or nanoseconds. It uses the highest-resolution monotonic |
| 5060 | * time source on each supported platform. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5061 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5062 | * @return The current value, in seconds, or zero if an |
| 5063 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5064 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5065 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5066 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 5067 | * @thread_safety This function may be called from any thread. Reading and |
| 5068 | * writing of the internal timer offset is not atomic, so it needs to be |
| 5069 | * externally synchronized with calls to @ref glfwSetTime. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5070 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5071 | * @sa @ref time |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5072 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5073 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5074 | * |
| 5075 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5076 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 5077 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5078 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5079 | /*! @brief Sets the GLFW timer. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5080 | * |
| 5081 | * 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] | 5082 | * up from that value. The value must be a positive finite number less than |
| 5083 | * or equal to 18446744073.0, which is approximately 584.5 years. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5084 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5085 | * @param[in] time The new value, in seconds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5086 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5087 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5088 | * GLFW_INVALID_VALUE. |
| 5089 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5090 | * @remark The upper limit of the timer is calculated as |
Camilla Berglund | 6e20cda | 2015-03-10 12:01:38 +0100 | [diff] [blame] | 5091 | * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations |
| 5092 | * storing nanoseconds in 64 bits. The limit may be increased in the future. |
| 5093 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 5094 | * @thread_safety This function may be called from any thread. Reading and |
| 5095 | * writing of the internal timer offset is not atomic, so it needs to be |
| 5096 | * externally synchronized with calls to @ref glfwGetTime. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5097 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5098 | * @sa @ref time |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5099 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5100 | * @since Added in version 2.2. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5101 | * |
| 5102 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5103 | */ |
| 5104 | GLFWAPI void glfwSetTime(double time); |
| 5105 | |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5106 | /*! @brief Returns the current value of the raw timer. |
| 5107 | * |
Camilla Berglund | 337c77a | 2016-03-06 14:11:14 +0100 | [diff] [blame] | 5108 | * This function returns the current value of the raw timer, measured in |
| 5109 | * 1 / frequency seconds. To get the frequency, call @ref |
| 5110 | * glfwGetTimerFrequency. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5111 | * |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 5112 | * @return The value of the timer, or zero if an |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5113 | * [error](@ref error_handling) occurred. |
| 5114 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 5115 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5116 | * |
| 5117 | * @thread_safety This function may be called from any thread. |
| 5118 | * |
| 5119 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5120 | * @sa @ref glfwGetTimerFrequency |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5121 | * |
| 5122 | * @since Added in version 3.2. |
| 5123 | * |
| 5124 | * @ingroup input |
| 5125 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 5126 | GLFWAPI uint64_t glfwGetTimerValue(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5127 | |
| 5128 | /*! @brief Returns the frequency, in Hz, of the raw timer. |
| 5129 | * |
Camilla Berglund | defaea3 | 2016-03-07 13:36:54 +0100 | [diff] [blame] | 5130 | * This function returns the frequency, in Hz, of the raw timer. |
| 5131 | * |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5132 | * @return The frequency of the timer, in Hz, or zero if an |
| 5133 | * [error](@ref error_handling) occurred. |
| 5134 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 5135 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5136 | * |
| 5137 | * @thread_safety This function may be called from any thread. |
| 5138 | * |
| 5139 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5140 | * @sa @ref glfwGetTimerValue |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5141 | * |
| 5142 | * @since Added in version 3.2. |
| 5143 | * |
| 5144 | * @ingroup input |
| 5145 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 5146 | GLFWAPI uint64_t glfwGetTimerFrequency(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5147 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5148 | /*! @brief Makes the context of the specified window current for the calling |
| 5149 | * thread. |
| 5150 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5151 | * 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] | 5152 | * 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] | 5153 | * a single thread at a time and each thread can have only a single current |
| 5154 | * context at a time. |
| 5155 | * |
Camilla Löwy | f2756d0 | 2017-11-02 19:30:12 +0100 | [diff] [blame] | 5156 | * When moving a context between threads, you must make it non-current on the |
| 5157 | * old thread before making it current on the new one. |
| 5158 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5159 | * By default, making a context non-current implicitly forces a pipeline flush. |
| 5160 | * On machines that support `GL_KHR_context_flush_control`, you can control |
| 5161 | * whether a context performs this flush by setting the |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 5162 | * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) |
| 5163 | * hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5164 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 5165 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 5166 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 5167 | * error. |
| 5168 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5169 | * @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] | 5170 | * detach the current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5171 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5172 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5173 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5174 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5175 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5176 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5177 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5178 | * @sa @ref glfwGetCurrentContext |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5179 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5180 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5181 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5182 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5183 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5184 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5185 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5186 | /*! @brief Returns the window whose context is current on the calling thread. |
| 5187 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5188 | * This function returns the window whose OpenGL or OpenGL ES context is |
| 5189 | * current on the calling thread. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5190 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5191 | * @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] | 5192 | * context is current. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5193 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5194 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5195 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5196 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5197 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5198 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5199 | * @sa @ref glfwMakeContextCurrent |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5200 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5201 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5202 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5203 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5204 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5205 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5206 | |
| 5207 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5208 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5209 | * This function swaps the front and back buffers of the specified window when |
| 5210 | * rendering with OpenGL or OpenGL ES. If the swap interval is greater than |
| 5211 | * zero, the GPU driver waits the specified number of screen updates before |
| 5212 | * swapping the buffers. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5213 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 5214 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 5215 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 5216 | * error. |
| 5217 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5218 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5219 | * see `vkQueuePresentKHR` instead. |
| 5220 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5221 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5222 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5223 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5224 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5225 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5226 | * @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] | 5227 | * calling thread. |
| 5228 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5229 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 5230 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5231 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5232 | * @sa @ref glfwSwapInterval |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5233 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5234 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5235 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5236 | * |
| 5237 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5238 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5239 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5240 | |
| 5241 | /*! @brief Sets the swap interval for the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5242 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5243 | * This function sets the swap interval for the current OpenGL or OpenGL ES |
| 5244 | * context, i.e. the number of screen updates to wait from the time @ref |
| 5245 | * glfwSwapBuffers was called before swapping the buffers and returning. This |
| 5246 | * is sometimes called _vertical synchronization_, _vertical retrace |
| 5247 | * synchronization_ or just _vsync_. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5248 | * |
Camilla Löwy | 8094a1c | 2017-11-27 15:53:59 +0100 | [diff] [blame] | 5249 | * 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] | 5250 | * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap |
| 5251 | * intervals, which allows the driver to swap immediately even if a frame |
| 5252 | * arrives a little bit late. You can check for these extensions with @ref |
| 5253 | * glfwExtensionSupported. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 5254 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5255 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5256 | * 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] | 5257 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5258 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5259 | * see the present mode of your swapchain instead. |
| 5260 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5261 | * @param[in] interval The minimum number of screen updates to wait for |
| 5262 | * until the buffers are swapped by @ref glfwSwapBuffers. |
| 5263 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5264 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5265 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5266 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5267 | * @remark This function is not called during context creation, leaving the |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5268 | * 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] | 5269 | * because some swap interval extensions used by GLFW do not allow the swap |
| 5270 | * interval to be reset to zero once it has been set to a non-zero value. |
| 5271 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5272 | * @remark Some GPU drivers do not honor the requested swap interval, either |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5273 | * because of a user setting that overrides the application's request or due to |
| 5274 | * bugs in the driver. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 5275 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5276 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5277 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5278 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5279 | * @sa @ref glfwSwapBuffers |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5280 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5281 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5282 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5283 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5284 | */ |
| 5285 | GLFWAPI void glfwSwapInterval(int interval); |
| 5286 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5287 | /*! @brief Returns whether the specified extension is available. |
| 5288 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 5289 | * This function returns whether the specified |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5290 | * [API extension](@ref context_glext) is supported by the current OpenGL or |
| 5291 | * OpenGL ES context. It searches both for client API extension and context |
| 5292 | * creation API extensions. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5293 | * |
| 5294 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5295 | * 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] | 5296 | * |
| 5297 | * As this functions retrieves and searches one or more extension strings each |
| 5298 | * call, it is recommended that you cache its results if it is going to be used |
| 5299 | * frequently. The extension strings will not change during the lifetime of |
| 5300 | * a context, so there is no danger in doing this. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5301 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5302 | * This function does not apply to Vulkan. If you are using Vulkan, see @ref |
| 5303 | * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties` |
| 5304 | * and `vkEnumerateDeviceExtensionProperties` instead. |
| 5305 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5306 | * @param[in] extension The ASCII encoded name of the extension. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 5307 | * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` |
| 5308 | * otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5309 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5310 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5311 | * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref |
| 5312 | * GLFW_PLATFORM_ERROR. |
| 5313 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5314 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5315 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5316 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5317 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5318 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5319 | * @since Added in version 1.0. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5320 | * |
| 5321 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5322 | */ |
| 5323 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 5324 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5325 | /*! @brief Returns the address of the specified function for the current |
| 5326 | * context. |
| 5327 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5328 | * This function returns the address of the specified OpenGL or OpenGL ES |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5329 | * [core or extension function](@ref context_glext), if it is supported |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 5330 | * by the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5331 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5332 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5333 | * 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] | 5334 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5335 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5336 | * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and |
| 5337 | * `vkGetDeviceProcAddr` instead. |
| 5338 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5339 | * @param[in] procname The ASCII encoded name of the function. |
Camilla Berglund | a36e3a2 | 2015-11-05 17:14:26 +0100 | [diff] [blame] | 5340 | * @return The address of the function, or `NULL` if an |
| 5341 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5342 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5343 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5344 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5345 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5346 | * @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] | 5347 | * between contexts. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5348 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5349 | * @remark This function may return a non-`NULL` address despite the |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5350 | * associated version or extension not being available. Always check the |
Camilla Berglund | c8e0687 | 2015-08-27 21:40:22 +0200 | [diff] [blame] | 5351 | * context version or extension string first. |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5352 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5353 | * @pointer_lifetime The returned function pointer is valid until the context |
| 5354 | * is destroyed or the library is terminated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5355 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5356 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5357 | * |
| 5358 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5359 | * @sa @ref glfwExtensionSupported |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5360 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5361 | * @since Added in version 1.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5362 | * |
| 5363 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5364 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 5365 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5366 | |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5367 | /*! @brief Returns whether the Vulkan loader and an ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5368 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5369 | * This function returns whether the Vulkan loader and any minimally functional |
| 5370 | * ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5371 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5372 | * The availability of a Vulkan loader and even an ICD does not by itself |
| 5373 | * guarantee that surface creation or even instance creation is possible. |
| 5374 | * For example, on Fermi systems Nvidia will install an ICD that provides no |
| 5375 | * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check |
| 5376 | * whether the extensions necessary for Vulkan surface creation are available |
| 5377 | * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue |
| 5378 | * family of a physical device supports image presentation. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5379 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5380 | * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` |
| 5381 | * otherwise. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5382 | * |
| 5383 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5384 | * |
| 5385 | * @thread_safety This function may be called from any thread. |
| 5386 | * |
| 5387 | * @sa @ref vulkan_support |
| 5388 | * |
| 5389 | * @since Added in version 3.2. |
| 5390 | * |
| 5391 | * @ingroup vulkan |
| 5392 | */ |
| 5393 | GLFWAPI int glfwVulkanSupported(void); |
| 5394 | |
| 5395 | /*! @brief Returns the Vulkan instance extensions required by GLFW. |
| 5396 | * |
| 5397 | * This function returns an array of names of Vulkan instance extensions required |
| 5398 | * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the |
| 5399 | * list will always contains `VK_KHR_surface`, so if you don't require any |
| 5400 | * additional extensions you can pass this list directly to the |
| 5401 | * `VkInstanceCreateInfo` struct. |
| 5402 | * |
| 5403 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 5404 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5405 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5406 | * |
| 5407 | * If Vulkan is available but no set of extensions allowing window surface |
| 5408 | * creation was found, this function returns `NULL`. You may still use Vulkan |
| 5409 | * for off-screen rendering and compute work. |
| 5410 | * |
| 5411 | * @param[out] count Where to store the number of extensions in the returned |
| 5412 | * array. This is set to zero if an error occurred. |
| 5413 | * @return An array of ASCII encoded extension names, or `NULL` if an |
| 5414 | * [error](@ref error_handling) occurred. |
| 5415 | * |
| 5416 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5417 | * GLFW_API_UNAVAILABLE. |
| 5418 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 5419 | * @remark Additional extensions may be required by future versions of GLFW. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5420 | * You should check if any extensions you wish to enable are already in the |
| 5421 | * returned array, as it is an error to specify an extension more than once in |
| 5422 | * the `VkInstanceCreateInfo` struct. |
| 5423 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5424 | * @remark @macos This function currently only supports the |
| 5425 | * `VK_MVK_macos_surface` extension from MoltenVK. |
| 5426 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5427 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5428 | * should not free it yourself. It is guaranteed to be valid only until the |
| 5429 | * library is terminated. |
| 5430 | * |
| 5431 | * @thread_safety This function may be called from any thread. |
| 5432 | * |
| 5433 | * @sa @ref vulkan_ext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5434 | * @sa @ref glfwCreateWindowSurface |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5435 | * |
| 5436 | * @since Added in version 3.2. |
| 5437 | * |
| 5438 | * @ingroup vulkan |
| 5439 | */ |
Camilla Berglund | 7ab7d8b | 2016-03-23 10:24:01 +0100 | [diff] [blame] | 5440 | GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count); |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5441 | |
| 5442 | #if defined(VK_VERSION_1_0) |
| 5443 | |
| 5444 | /*! @brief Returns the address of the specified Vulkan instance function. |
| 5445 | * |
| 5446 | * This function returns the address of the specified Vulkan core or extension |
| 5447 | * function for the specified instance. If instance is set to `NULL` it can |
| 5448 | * return any function exported from the Vulkan loader, including at least the |
| 5449 | * following functions: |
| 5450 | * |
| 5451 | * - `vkEnumerateInstanceExtensionProperties` |
| 5452 | * - `vkEnumerateInstanceLayerProperties` |
| 5453 | * - `vkCreateInstance` |
| 5454 | * - `vkGetInstanceProcAddr` |
| 5455 | * |
| 5456 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 5457 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5458 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5459 | * |
| 5460 | * This function is equivalent to calling `vkGetInstanceProcAddr` with |
| 5461 | * a platform-specific query of the Vulkan loader as a fallback. |
| 5462 | * |
| 5463 | * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve |
| 5464 | * functions related to instance creation. |
| 5465 | * @param[in] procname The ASCII encoded name of the function. |
| 5466 | * @return The address of the function, or `NULL` if an |
| 5467 | * [error](@ref error_handling) occurred. |
| 5468 | * |
| 5469 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5470 | * GLFW_API_UNAVAILABLE. |
| 5471 | * |
| 5472 | * @pointer_lifetime The returned function pointer is valid until the library |
| 5473 | * is terminated. |
| 5474 | * |
| 5475 | * @thread_safety This function may be called from any thread. |
| 5476 | * |
| 5477 | * @sa @ref vulkan_proc |
| 5478 | * |
| 5479 | * @since Added in version 3.2. |
| 5480 | * |
| 5481 | * @ingroup vulkan |
| 5482 | */ |
| 5483 | GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); |
| 5484 | |
| 5485 | /*! @brief Returns whether the specified queue family can present images. |
| 5486 | * |
| 5487 | * This function returns whether the specified queue family of the specified |
| 5488 | * physical device supports presentation to the platform GLFW was built for. |
| 5489 | * |
| 5490 | * If Vulkan or the required window surface creation instance extensions are |
| 5491 | * not available on the machine, or if the specified instance was not created |
| 5492 | * with the required extensions, this function returns `GLFW_FALSE` and |
| 5493 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5494 | * to check whether Vulkan is at least minimally available and @ref |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5495 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 5496 | * required. |
| 5497 | * |
| 5498 | * @param[in] instance The instance that the physical device belongs to. |
| 5499 | * @param[in] device The physical device that the queue family belongs to. |
| 5500 | * @param[in] queuefamily The index of the queue family to query. |
| 5501 | * @return `GLFW_TRUE` if the queue family supports presentation, or |
| 5502 | * `GLFW_FALSE` otherwise. |
| 5503 | * |
| 5504 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5505 | * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
| 5506 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5507 | * @remark @macos This function currently always returns `GLFW_TRUE`, as the |
| 5508 | * `VK_MVK_macos_surface` extension does not provide |
| 5509 | * a `vkGetPhysicalDevice*PresentationSupport` type function. |
| 5510 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5511 | * @thread_safety This function may be called from any thread. For |
| 5512 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 5513 | * |
| 5514 | * @sa @ref vulkan_present |
| 5515 | * |
| 5516 | * @since Added in version 3.2. |
| 5517 | * |
| 5518 | * @ingroup vulkan |
| 5519 | */ |
| 5520 | GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); |
| 5521 | |
| 5522 | /*! @brief Creates a Vulkan surface for the specified window. |
| 5523 | * |
| 5524 | * This function creates a Vulkan surface for the specified window. |
| 5525 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5526 | * If the Vulkan loader or at least one minimally functional ICD were not found, |
| 5527 | * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref |
| 5528 | * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether |
| 5529 | * Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5530 | * |
| 5531 | * If the required window surface creation instance extensions are not |
| 5532 | * available or if the specified instance was not created with these extensions |
| 5533 | * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and |
| 5534 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref |
| 5535 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 5536 | * required. |
| 5537 | * |
Corentin Wallez | 8a8eefa | 2018-01-30 13:25:17 -0500 | [diff] [blame] | 5538 | * The window surface cannot be shared with another API so the window must |
| 5539 | * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib) |
| 5540 | * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error |
| 5541 | * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`. |
| 5542 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5543 | * The window surface must be destroyed before the specified Vulkan instance. |
| 5544 | * It is the responsibility of the caller to destroy the window surface. GLFW |
| 5545 | * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the |
| 5546 | * surface. |
| 5547 | * |
| 5548 | * @param[in] instance The Vulkan instance to create the surface in. |
| 5549 | * @param[in] window The window to create the surface for. |
| 5550 | * @param[in] allocator The allocator to use, or `NULL` to use the default |
| 5551 | * allocator. |
| 5552 | * @param[out] surface Where to store the handle of the surface. This is set |
| 5553 | * to `VK_NULL_HANDLE` if an error occurred. |
| 5554 | * @return `VK_SUCCESS` if successful, or a Vulkan error code if an |
| 5555 | * [error](@ref error_handling) occurred. |
| 5556 | * |
| 5557 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
Corentin Wallez | 8a8eefa | 2018-01-30 13:25:17 -0500 | [diff] [blame] | 5558 | * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5559 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 5560 | * @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] | 5561 | * the Vulkan error code most appropriate for the error. Appropriate use of |
| 5562 | * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should |
Camilla Berglund | ee33dcd | 2016-03-07 14:42:51 +0100 | [diff] [blame] | 5563 | * eliminate almost all occurrences of these errors. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5564 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5565 | * @remark @macos This function currently only supports the |
| 5566 | * `VK_MVK_macos_surface` extension from MoltenVK. |
| 5567 | * |
| 5568 | * @remark @macos This function creates and sets a `CAMetalLayer` instance for |
| 5569 | * the window content view, which is required for MoltenVK to function. |
| 5570 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5571 | * @thread_safety This function may be called from any thread. For |
| 5572 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 5573 | * |
| 5574 | * @sa @ref vulkan_surface |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5575 | * @sa @ref glfwGetRequiredInstanceExtensions |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5576 | * |
| 5577 | * @since Added in version 3.2. |
| 5578 | * |
| 5579 | * @ingroup vulkan |
| 5580 | */ |
| 5581 | GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); |
| 5582 | |
| 5583 | #endif /*VK_VERSION_1_0*/ |
| 5584 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5585 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5586 | /************************************************************************* |
| 5587 | * Global definition cleanup |
| 5588 | *************************************************************************/ |
| 5589 | |
| 5590 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 5591 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5592 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 5593 | #undef WINGDIAPI |
| 5594 | #undef GLFW_WINGDIAPI_DEFINED |
| 5595 | #endif |
| 5596 | |
| 5597 | #ifdef GLFW_CALLBACK_DEFINED |
| 5598 | #undef CALLBACK |
| 5599 | #undef GLFW_CALLBACK_DEFINED |
| 5600 | #endif |
| 5601 | |
Camilla Löwy | be51c20 | 2017-07-03 14:25:47 +0200 | [diff] [blame] | 5602 | /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally |
| 5603 | * defined by some gl.h variants (OpenBSD) so define it after if needed. |
| 5604 | */ |
| 5605 | #ifndef GLAPIENTRY |
| 5606 | #define GLAPIENTRY APIENTRY |
| 5607 | #endif |
| 5608 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5609 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 5610 | |
| 5611 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5612 | #ifdef __cplusplus |
| 5613 | } |
| 5614 | #endif |
| 5615 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 5616 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5617 | |