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 | /*! @name Boolean values |
| 273 | * @{ */ |
| 274 | /*! @brief One. |
| 275 | * |
| 276 | * One. Seriously. You don't _need_ to use this symbol in your code. It's |
Camilla Löwy | 1be81a1 | 2017-10-22 16:27:17 +0200 | [diff] [blame] | 277 | * semantic sugar for the number 1. You can also use `1` or `true` or `_True` |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 278 | * or `GL_TRUE` or whatever you want. |
| 279 | */ |
| 280 | #define GLFW_TRUE 1 |
| 281 | /*! @brief Zero. |
| 282 | * |
| 283 | * Zero. Seriously. You don't _need_ to use this symbol in your code. It's |
Camilla Löwy | 1be81a1 | 2017-10-22 16:27:17 +0200 | [diff] [blame] | 284 | * semantic sugar for the number 0. You can also use `0` or `false` or |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 285 | * `_False` or `GL_FALSE` or whatever you want. |
| 286 | */ |
| 287 | #define GLFW_FALSE 0 |
| 288 | /*! @} */ |
| 289 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 290 | /*! @name Key and button actions |
| 291 | * @{ */ |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 292 | /*! @brief The key or mouse button was released. |
| 293 | * |
| 294 | * The key or mouse button was released. |
| 295 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 296 | * @ingroup input |
| 297 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 298 | #define GLFW_RELEASE 0 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 299 | /*! @brief The key or mouse button was pressed. |
| 300 | * |
| 301 | * The key or mouse button was pressed. |
| 302 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 303 | * @ingroup input |
| 304 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 305 | #define GLFW_PRESS 1 |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 306 | /*! @brief The key was held down until it repeated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 307 | * |
| 308 | * The key was held down until it repeated. |
| 309 | * |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 310 | * @ingroup input |
| 311 | */ |
| 312 | #define GLFW_REPEAT 2 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 313 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 314 | |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 315 | /*! @defgroup hat_state 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 | ee9dffc | 2018-01-04 13:50:58 +0100 | [diff] [blame^] | 817 | #define GLFW_HOVERED 0x0002000B |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 818 | |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 819 | /*! @brief Framebuffer bit depth hint. |
| 820 | * |
| 821 | * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). |
| 822 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 823 | #define GLFW_RED_BITS 0x00021001 |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 824 | /*! @brief Framebuffer bit depth hint. |
| 825 | * |
| 826 | * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS). |
| 827 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 828 | #define GLFW_GREEN_BITS 0x00021002 |
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_BLUE_BITS). |
| 832 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 833 | #define GLFW_BLUE_BITS 0x00021003 |
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_ALPHA_BITS). |
| 837 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 838 | #define GLFW_ALPHA_BITS 0x00021004 |
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_DEPTH_BITS). |
| 842 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 843 | #define GLFW_DEPTH_BITS 0x00021005 |
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_STENCIL_BITS). |
| 847 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 848 | #define GLFW_STENCIL_BITS 0x00021006 |
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_ACCUM_RED_BITS). |
| 852 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 853 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
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_ACCUM_GREEN_BITS). |
| 857 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 858 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
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_BLUE_BITS). |
| 862 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 863 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
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_ALPHA_BITS). |
| 867 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 868 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 869 | /*! @brief Framebuffer auxiliary buffer hint. |
| 870 | * |
| 871 | * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS). |
| 872 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 873 | #define GLFW_AUX_BUFFERS 0x0002100B |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 874 | /*! @brief OpenGL stereoscopic rendering hint. |
| 875 | * |
| 876 | * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO). |
| 877 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 878 | #define GLFW_STEREO 0x0002100C |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 879 | /*! @brief Framebuffer MSAA samples hint. |
| 880 | * |
| 881 | * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES). |
| 882 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 883 | #define GLFW_SAMPLES 0x0002100D |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 884 | /*! @brief Framebuffer sRGB hint. |
| 885 | * |
| 886 | * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE). |
| 887 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 888 | #define GLFW_SRGB_CAPABLE 0x0002100E |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 889 | /*! @brief Monitor refresh rate hint. |
| 890 | * |
| 891 | * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE). |
| 892 | */ |
Camilla Berglund | 2cd3438 | 2013-05-30 20:42:50 +0200 | [diff] [blame] | 893 | #define GLFW_REFRESH_RATE 0x0002100F |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 894 | /*! @brief Framebuffer double buffering hint. |
| 895 | * |
| 896 | * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER). |
| 897 | */ |
Camilla Berglund | c980858 | 2014-04-24 19:21:10 +0200 | [diff] [blame] | 898 | #define GLFW_DOUBLEBUFFER 0x00021010 |
Bailey Cosier | 93e6666 | 2017-09-19 18:27:45 +0200 | [diff] [blame] | 899 | |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 900 | /*! @brief Context client API hint and attribute. |
| 901 | * |
| 902 | * Context client API [hint](@ref GLFW_CLIENT_API_hint) and |
| 903 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 904 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 905 | #define GLFW_CLIENT_API 0x00022001 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 906 | /*! @brief Context client API major version hint and attribute. |
| 907 | * |
| 908 | * Context client API major version [hint](@ref GLFW_CLIENT_API_hint) and |
| 909 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 910 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 911 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 912 | /*! @brief Context client API minor version hint and attribute. |
| 913 | * |
| 914 | * Context client API minor version [hint](@ref GLFW_CLIENT_API_hint) and |
| 915 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 916 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 917 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 918 | /*! @brief Context client API revision number hint and attribute. |
| 919 | * |
| 920 | * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and |
| 921 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 922 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 923 | #define GLFW_CONTEXT_REVISION 0x00022004 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 924 | /*! @brief Context robustness hint and attribute. |
| 925 | * |
| 926 | * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and |
| 927 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 928 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 929 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 930 | /*! @brief OpenGL forward-compatibility hint and attribute. |
| 931 | * |
| 932 | * OpenGL forward-compatibility [hint](@ref GLFW_CLIENT_API_hint) and |
| 933 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 934 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 935 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 936 | /*! @brief OpenGL debug context hint and attribute. |
| 937 | * |
| 938 | * OpenGL debug context [hint](@ref GLFW_CLIENT_API_hint) and |
| 939 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 940 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 941 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 942 | /*! @brief OpenGL profile hint and attribute. |
| 943 | * |
| 944 | * OpenGL profile [hint](@ref GLFW_CLIENT_API_hint) and |
| 945 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 946 | */ |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 947 | #define GLFW_OPENGL_PROFILE 0x00022008 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 948 | /*! @brief Context flush-on-release hint and attribute. |
| 949 | * |
| 950 | * Context flush-on-release [hint](@ref GLFW_CLIENT_API_hint) and |
| 951 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 952 | */ |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 953 | #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 954 | /*! @brief Context error suppression hint and attribute. |
| 955 | * |
| 956 | * Context error suppression [hint](@ref GLFW_CLIENT_API_hint) and |
| 957 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 958 | */ |
Camilla Berglund | 7be8209 | 2015-08-10 12:46:14 +0200 | [diff] [blame] | 959 | #define GLFW_CONTEXT_NO_ERROR 0x0002200A |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 960 | /*! @brief Context creation API hint and attribute. |
| 961 | * |
| 962 | * Context creation API [hint](@ref GLFW_CLIENT_API_hint) and |
| 963 | * [attribute](@ref GLFW_CLIENT_API_attrib). |
| 964 | */ |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 965 | #define GLFW_CONTEXT_CREATION_API 0x0002200B |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 966 | |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 967 | #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001 |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 968 | #define GLFW_COCOA_FRAME_NAME 0x00023002 |
Camilla Löwy | 77a8f10 | 2017-01-27 12:02:09 +0100 | [diff] [blame] | 969 | #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003 |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 970 | |
| 971 | #define GLFW_X11_CLASS_NAME 0x00024001 |
| 972 | #define GLFW_X11_INSTANCE_NAME 0x00024002 |
Camilla Löwy | 831426c | 2016-12-08 17:08:36 +0100 | [diff] [blame] | 973 | /*! @} */ |
Camilla Löwy | 58ceab5 | 2016-12-07 00:41:54 +0100 | [diff] [blame] | 974 | |
Camilla Berglund | 496f559 | 2015-06-18 14:03:02 +0200 | [diff] [blame] | 975 | #define GLFW_NO_API 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 976 | #define GLFW_OPENGL_API 0x00030001 |
| 977 | #define GLFW_OPENGL_ES_API 0x00030002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 978 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 979 | #define GLFW_NO_ROBUSTNESS 0 |
| 980 | #define GLFW_NO_RESET_NOTIFICATION 0x00031001 |
| 981 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 982 | |
Camilla Berglund | 44e8401 | 2013-06-05 16:13:30 +0200 | [diff] [blame] | 983 | #define GLFW_OPENGL_ANY_PROFILE 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 984 | #define GLFW_OPENGL_CORE_PROFILE 0x00032001 |
| 985 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 986 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 987 | #define GLFW_CURSOR 0x00033001 |
| 988 | #define GLFW_STICKY_KEYS 0x00033002 |
| 989 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 990 | #define GLFW_LOCK_KEY_MODS 0x00033004 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 991 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 992 | #define GLFW_CURSOR_NORMAL 0x00034001 |
| 993 | #define GLFW_CURSOR_HIDDEN 0x00034002 |
| 994 | #define GLFW_CURSOR_DISABLED 0x00034003 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 995 | |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 996 | #define GLFW_ANY_RELEASE_BEHAVIOR 0 |
| 997 | #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 |
| 998 | #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 |
| 999 | |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1000 | #define GLFW_NATIVE_CONTEXT_API 0x00036001 |
| 1001 | #define GLFW_EGL_CONTEXT_API 0x00036002 |
Camilla Löwy | e9560ef | 2017-02-28 19:23:25 +0100 | [diff] [blame] | 1002 | #define GLFW_OSMESA_CONTEXT_API 0x00036003 |
Camilla Berglund | ef80bea | 2016-03-28 13:19:31 +0200 | [diff] [blame] | 1003 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1004 | /*! @defgroup shapes Standard cursor shapes |
Camilla Löwy | 21eabd3 | 2017-02-06 17:31:25 +0100 | [diff] [blame] | 1005 | * @brief Standard system cursor shapes. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1006 | * |
| 1007 | * See [standard cursor creation](@ref cursor_standard) for how these are used. |
| 1008 | * |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 1009 | * @ingroup input |
| 1010 | * @{ */ |
| 1011 | |
| 1012 | /*! @brief The regular arrow cursor shape. |
| 1013 | * |
| 1014 | * The regular arrow cursor. |
| 1015 | */ |
| 1016 | #define GLFW_ARROW_CURSOR 0x00036001 |
| 1017 | /*! @brief The text input I-beam cursor shape. |
| 1018 | * |
| 1019 | * The text input I-beam cursor shape. |
| 1020 | */ |
| 1021 | #define GLFW_IBEAM_CURSOR 0x00036002 |
| 1022 | /*! @brief The crosshair shape. |
| 1023 | * |
| 1024 | * The crosshair shape. |
| 1025 | */ |
| 1026 | #define GLFW_CROSSHAIR_CURSOR 0x00036003 |
| 1027 | /*! @brief The hand shape. |
| 1028 | * |
| 1029 | * The hand shape. |
| 1030 | */ |
| 1031 | #define GLFW_HAND_CURSOR 0x00036004 |
| 1032 | /*! @brief The horizontal resize arrow shape. |
| 1033 | * |
| 1034 | * The horizontal resize arrow shape. |
| 1035 | */ |
| 1036 | #define GLFW_HRESIZE_CURSOR 0x00036005 |
| 1037 | /*! @brief The vertical resize arrow shape. |
| 1038 | * |
| 1039 | * The vertical resize arrow shape. |
| 1040 | */ |
| 1041 | #define GLFW_VRESIZE_CURSOR 0x00036006 |
| 1042 | /*! @} */ |
| 1043 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 1044 | #define GLFW_CONNECTED 0x00040001 |
| 1045 | #define GLFW_DISCONNECTED 0x00040002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1046 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1047 | /*! @addtogroup init |
| 1048 | * @{ */ |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 1049 | #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001 |
| 1050 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1051 | #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001 |
| 1052 | #define GLFW_COCOA_MENUBAR 0x00051002 |
| 1053 | /*! @} */ |
| 1054 | |
Camilla Berglund | 2810130 | 2014-04-08 18:57:43 +0200 | [diff] [blame] | 1055 | #define GLFW_DONT_CARE -1 |
| 1056 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 1057 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1058 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1059 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1060 | *************************************************************************/ |
| 1061 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1062 | /*! @brief Client API function pointer type. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1063 | * |
| 1064 | * Generic function pointer used for returning client API function pointers |
| 1065 | * without forcing a cast from a regular pointer. |
| 1066 | * |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1067 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1068 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | bce20c3 | 2015-11-05 13:58:52 +0100 | [diff] [blame] | 1069 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1070 | * @since Added in version 3.0. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 1071 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 1072 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1073 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 1074 | typedef void (*GLFWglproc)(void); |
| 1075 | |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1076 | /*! @brief Vulkan API function pointer type. |
| 1077 | * |
| 1078 | * Generic function pointer used for returning Vulkan API function pointers |
| 1079 | * without forcing a cast from a regular pointer. |
| 1080 | * |
| 1081 | * @sa @ref vulkan_proc |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1082 | * @sa @ref glfwGetInstanceProcAddress |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 1083 | * |
| 1084 | * @since Added in version 3.2. |
| 1085 | * |
| 1086 | * @ingroup vulkan |
| 1087 | */ |
| 1088 | typedef void (*GLFWvkproc)(void); |
| 1089 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1090 | /*! @brief Opaque monitor object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1091 | * |
| 1092 | * Opaque monitor object. |
| 1093 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1094 | * @see @ref monitor_object |
| 1095 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1096 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1097 | * |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1098 | * @ingroup monitor |
| 1099 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1100 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 1101 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1102 | /*! @brief Opaque window object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1103 | * |
| 1104 | * Opaque window object. |
| 1105 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1106 | * @see @ref window_object |
| 1107 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1108 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1109 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1110 | * @ingroup window |
| 1111 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1112 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1113 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1114 | /*! @brief Opaque cursor object. |
| 1115 | * |
| 1116 | * Opaque cursor object. |
| 1117 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1118 | * @see @ref cursor_object |
| 1119 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1120 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1121 | * |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 1122 | * @ingroup cursor |
| 1123 | */ |
| 1124 | typedef struct GLFWcursor GLFWcursor; |
| 1125 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1126 | /*! @brief The function signature for error callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1127 | * |
| 1128 | * This is the function signature for error callback functions. |
| 1129 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1130 | * @param[in] error An [error code](@ref errors). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1131 | * @param[in] description A UTF-8 encoded string describing the error. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1132 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1133 | * @sa @ref error_handling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1134 | * @sa @ref glfwSetErrorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1135 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1136 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1137 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1138 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1139 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 1140 | typedef void (* GLFWerrorfun)(int,const char*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1141 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1142 | /*! @brief The function signature for window position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1143 | * |
| 1144 | * This is the function signature for window position callback functions. |
| 1145 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1146 | * @param[in] window The window that was moved. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1147 | * @param[in] xpos The new x-coordinate, in screen coordinates, of the |
| 1148 | * upper-left corner of the client area of the window. |
| 1149 | * @param[in] ypos The new y-coordinate, in screen coordinates, of the |
| 1150 | * upper-left corner of the client area of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1151 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1152 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1153 | * @sa @ref glfwSetWindowPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1154 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1155 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1156 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1157 | * @ingroup window |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1158 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1159 | typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1160 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1161 | /*! @brief The function signature for window resize callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1162 | * |
| 1163 | * This is the function signature for window size callback functions. |
| 1164 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1165 | * @param[in] window The window that was resized. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1166 | * @param[in] width The new width, in screen coordinates, of the window. |
| 1167 | * @param[in] height The new height, in screen coordinates, of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1168 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1169 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1170 | * @sa @ref glfwSetWindowSizeCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1171 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1172 | * @since Added in version 1.0. |
| 1173 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1174 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1175 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1176 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1177 | typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1178 | |
| 1179 | /*! @brief The function signature for window close callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1180 | * |
| 1181 | * This is the function signature for window close callback functions. |
| 1182 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1183 | * @param[in] window The window that the user attempted to close. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1184 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1185 | * @sa @ref window_close |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1186 | * @sa @ref glfwSetWindowCloseCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1187 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1188 | * @since Added in version 2.5. |
| 1189 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1190 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1191 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1192 | */ |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1193 | typedef void (* GLFWwindowclosefun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1194 | |
| 1195 | /*! @brief The function signature for window content refresh callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1196 | * |
| 1197 | * This is the function signature for window refresh callback functions. |
| 1198 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1199 | * @param[in] window The window whose content needs to be refreshed. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1200 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1201 | * @sa @ref window_refresh |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1202 | * @sa @ref glfwSetWindowRefreshCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1203 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1204 | * @since Added in version 2.5. |
| 1205 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1206 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1207 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1208 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1209 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1210 | |
| 1211 | /*! @brief The function signature for window focus/defocus callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1212 | * |
| 1213 | * This is the function signature for window focus callback functions. |
| 1214 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1215 | * @param[in] window The window that gained or lost input focus. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1216 | * @param[in] focused `GLFW_TRUE` if the window was given input focus, or |
| 1217 | * `GLFW_FALSE` if it lost it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1218 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1219 | * @sa @ref window_focus |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1220 | * @sa @ref glfwSetWindowFocusCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1221 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1222 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1223 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1224 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1225 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1226 | typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1227 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 1228 | /*! @brief The function signature for window iconify/restore callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1229 | * |
| 1230 | * This is the function signature for window iconify/restore callback |
| 1231 | * functions. |
| 1232 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1233 | * @param[in] window The window that was iconified or restored. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1234 | * @param[in] iconified `GLFW_TRUE` if the window was iconified, or |
| 1235 | * `GLFW_FALSE` if it was restored. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1236 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1237 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1238 | * @sa @ref glfwSetWindowIconifyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1239 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1240 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1241 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1242 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1243 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1244 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1245 | |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 1246 | /*! @brief The function signature for window maximize/restore callbacks. |
| 1247 | * |
| 1248 | * This is the function signature for window maximize/restore callback |
| 1249 | * functions. |
| 1250 | * |
| 1251 | * @param[in] window The window that was maximized or restored. |
| 1252 | * @param[in] iconified `GLFW_TRUE` if the window was maximized, or |
| 1253 | * `GLFW_FALSE` if it was restored. |
| 1254 | * |
| 1255 | * @sa @ref window_maximize |
| 1256 | * @sa glfwSetWindowMaximizeCallback |
| 1257 | * |
| 1258 | * @since Added in version 3.3. |
| 1259 | * |
| 1260 | * @ingroup window |
| 1261 | */ |
| 1262 | typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int); |
| 1263 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1264 | /*! @brief The function signature for framebuffer resize callbacks. |
| 1265 | * |
| 1266 | * This is the function signature for framebuffer resize callback |
| 1267 | * functions. |
| 1268 | * |
| 1269 | * @param[in] window The window whose framebuffer was resized. |
| 1270 | * @param[in] width The new width, in pixels, of the framebuffer. |
| 1271 | * @param[in] height The new height, in pixels, of the framebuffer. |
| 1272 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1273 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1274 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1275 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1276 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1277 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1278 | * @ingroup window |
| 1279 | */ |
| 1280 | typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); |
| 1281 | |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 1282 | /*! @brief The function signature for window content scale callbacks. |
| 1283 | * |
| 1284 | * This is the function signature for window content scale callback |
| 1285 | * functions. |
| 1286 | * |
| 1287 | * @param[in] window The window whose content scale changed. |
| 1288 | * @param[in] xscale The new x-axis content scale of the window. |
| 1289 | * @param[in] yscale The new y-axis content scale of the window. |
| 1290 | * |
| 1291 | * @sa @ref window_scale |
| 1292 | * @sa @ref glfwSetWindowContentScaleCallback |
| 1293 | * |
| 1294 | * @since Added in version 3.3. |
| 1295 | * |
| 1296 | * @ingroup window |
| 1297 | */ |
| 1298 | typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float); |
| 1299 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1300 | /*! @brief The function signature for mouse button callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1301 | * |
| 1302 | * This is the function signature for mouse button callback functions. |
| 1303 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1304 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1305 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
| 1306 | * released. |
| 1307 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1308 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1309 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1310 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1311 | * @sa @ref input_mouse_button |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1312 | * @sa @ref glfwSetMouseButtonCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1313 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1314 | * @since Added in version 1.0. |
| 1315 | * @glfw3 Added window handle and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1316 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1317 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1318 | */ |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 1319 | typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1320 | |
| 1321 | /*! @brief The function signature for cursor position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1322 | * |
| 1323 | * This is the function signature for cursor position callback functions. |
| 1324 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1325 | * @param[in] window The window that received the event. |
Camilla Berglund | 95c44ab | 2016-02-17 14:52:01 +0100 | [diff] [blame] | 1326 | * @param[in] xpos The new cursor x-coordinate, relative to the left edge of |
| 1327 | * the client area. |
| 1328 | * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the |
| 1329 | * client area. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1330 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1331 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1332 | * @sa @ref glfwSetCursorPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1333 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1334 | * @since Added in version 3.0. Replaces `GLFWmouseposfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1335 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1336 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1337 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 1338 | typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1339 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1340 | /*! @brief The function signature for cursor enter/leave callbacks. |
| 1341 | * |
| 1342 | * This is the function signature for cursor enter/leave callback functions. |
| 1343 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1344 | * @param[in] window The window that received the event. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1345 | * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client |
| 1346 | * area, or `GLFW_FALSE` if it left it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1347 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1348 | * @sa @ref cursor_enter |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1349 | * @sa @ref glfwSetCursorEnterCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1350 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1351 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1352 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1353 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1354 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1355 | typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1356 | |
| 1357 | /*! @brief The function signature for scroll callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1358 | * |
| 1359 | * This is the function signature for scroll callback functions. |
| 1360 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1361 | * @param[in] window The window that received the event. |
mewmew | cf2d260 | 2013-06-06 19:49:23 +0200 | [diff] [blame] | 1362 | * @param[in] xoffset The scroll offset along the x-axis. |
| 1363 | * @param[in] yoffset The scroll offset along the y-axis. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1364 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1365 | * @sa @ref scrolling |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1366 | * @sa @ref glfwSetScrollCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1367 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1368 | * @since Added in version 3.0. Replaces `GLFWmousewheelfun`. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1369 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1370 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1371 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1372 | typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1373 | |
| 1374 | /*! @brief The function signature for keyboard key callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1375 | * |
| 1376 | * This is the function signature for keyboard key callback functions. |
| 1377 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1378 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1379 | * @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] | 1380 | * @param[in] scancode The system-specific scancode of the key. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1381 | * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 1382 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1383 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1384 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1385 | * @sa @ref input_key |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1386 | * @sa @ref glfwSetKeyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1387 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1388 | * @since Added in version 1.0. |
| 1389 | * @glfw3 Added window handle, scancode and modifier mask parameters. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1390 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1391 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1392 | */ |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 1393 | typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1394 | |
| 1395 | /*! @brief The function signature for Unicode character callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1396 | * |
| 1397 | * This is the function signature for Unicode character callback functions. |
| 1398 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1399 | * @param[in] window The window that received the event. |
Camilla Berglund | 2c920fb | 2013-10-10 19:41:56 +0200 | [diff] [blame] | 1400 | * @param[in] codepoint The Unicode code point of the character. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1401 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1402 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1403 | * @sa @ref glfwSetCharCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1404 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1405 | * @since Added in version 2.4. |
| 1406 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1407 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1408 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1409 | */ |
Camilla Berglund | 182e0af | 2013-02-25 17:02:28 +0100 | [diff] [blame] | 1410 | typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1411 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1412 | /*! @brief The function signature for Unicode character with modifiers |
| 1413 | * callbacks. |
| 1414 | * |
| 1415 | * This is the function signature for Unicode character with modifiers callback |
| 1416 | * functions. It is called for each input character, regardless of what |
| 1417 | * modifier keys are held down. |
| 1418 | * |
| 1419 | * @param[in] window The window that received the event. |
| 1420 | * @param[in] codepoint The Unicode code point of the character. |
| 1421 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 1422 | * held down. |
| 1423 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1424 | * @sa @ref input_char |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1425 | * @sa @ref glfwSetCharModsCallback |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1426 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 1427 | * @deprecated Scheduled for removal in version 4.0. |
| 1428 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1429 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1430 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 1431 | * @ingroup input |
| 1432 | */ |
| 1433 | typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); |
| 1434 | |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1435 | /*! @brief The function signature for file drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1436 | * |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1437 | * This is the function signature for file drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1438 | * |
| 1439 | * @param[in] window The window that received the event. |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 1440 | * @param[in] count The number of dropped files. |
Camilla Berglund | 93855ae | 2015-01-27 23:04:22 +0100 | [diff] [blame] | 1441 | * @param[in] paths The UTF-8 encoded file and/or directory path names. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1442 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1443 | * @sa @ref path_drop |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1444 | * @sa @ref glfwSetDropCallback |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1445 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1446 | * @since Added in version 3.1. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1447 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1448 | * @ingroup input |
| 1449 | */ |
Camilla Berglund | 8f349e8 | 2013-12-22 19:28:46 +0100 | [diff] [blame] | 1450 | typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**); |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 1451 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1452 | /*! @brief The function signature for monitor configuration callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1453 | * |
| 1454 | * This is the function signature for monitor configuration callback functions. |
| 1455 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1456 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1457 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1458 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1459 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1460 | * @sa @ref glfwSetMonitorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1461 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1462 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1463 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1464 | * @ingroup monitor |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1465 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1466 | typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 1467 | |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1468 | /*! @brief The function signature for joystick configuration callbacks. |
| 1469 | * |
| 1470 | * This is the function signature for joystick configuration callback |
| 1471 | * functions. |
| 1472 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 1473 | * @param[in] jid The joystick that was connected or disconnected. |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1474 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. |
| 1475 | * |
| 1476 | * @sa @ref joystick_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1477 | * @sa @ref glfwSetJoystickCallback |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 1478 | * |
| 1479 | * @since Added in version 3.2. |
| 1480 | * |
| 1481 | * @ingroup input |
| 1482 | */ |
| 1483 | typedef void (* GLFWjoystickfun)(int,int); |
| 1484 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1485 | /*! @brief Video mode type. |
| 1486 | * |
| 1487 | * This describes a single video mode. |
| 1488 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1489 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1490 | * @sa @ref glfwGetVideoMode |
| 1491 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1492 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1493 | * @since Added in version 1.0. |
| 1494 | * @glfw3 Added refresh rate member. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1495 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1496 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1497 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1498 | typedef struct GLFWvidmode |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1499 | { |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1500 | /*! The width, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1501 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1502 | int width; |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1503 | /*! The height, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1504 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1505 | int height; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1506 | /*! The bit depth of the red channel of the video mode. |
| 1507 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1508 | int redBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1509 | /*! The bit depth of the green channel of the video mode. |
| 1510 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1511 | int greenBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1512 | /*! The bit depth of the blue channel of the video mode. |
| 1513 | */ |
Camilla Berglund | 2e8446f | 2013-04-11 01:31:00 +0200 | [diff] [blame] | 1514 | int blueBits; |
Camilla Berglund | 731812c | 2013-05-30 15:52:42 +0200 | [diff] [blame] | 1515 | /*! The refresh rate, in Hz, of the video mode. |
| 1516 | */ |
| 1517 | int refreshRate; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1518 | } GLFWvidmode; |
| 1519 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1520 | /*! @brief Gamma ramp. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1521 | * |
| 1522 | * This describes the gamma ramp for a monitor. |
| 1523 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1524 | * @sa @ref monitor_gamma |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1525 | * @sa @ref glfwGetGammaRamp |
| 1526 | * @sa @ref glfwSetGammaRamp |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1527 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1528 | * @since Added in version 3.0. |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1529 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1530 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1531 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1532 | typedef struct GLFWgammaramp |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1533 | { |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1534 | /*! An array of value describing the response of the red channel. |
| 1535 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1536 | unsigned short* red; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1537 | /*! An array of value describing the response of the green channel. |
| 1538 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1539 | unsigned short* green; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1540 | /*! An array of value describing the response of the blue channel. |
| 1541 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1542 | unsigned short* blue; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1543 | /*! The number of elements in each array. |
| 1544 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1545 | unsigned int size; |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1546 | } GLFWgammaramp; |
| 1547 | |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 1548 | /*! @brief Image data. |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1549 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 1550 | * This describes a single 2D image. See the documentation for each related |
| 1551 | * function what the expected pixel format is. |
| 1552 | * |
Camilla Berglund | 9d71eb4 | 2015-11-05 09:24:16 +0100 | [diff] [blame] | 1553 | * @sa @ref cursor_custom |
Camilla Berglund | fe0317a | 2016-08-01 11:51:30 +0200 | [diff] [blame] | 1554 | * @sa @ref window_icon |
Camilla Berglund | 810bab7 | 2015-12-13 17:38:14 +0100 | [diff] [blame] | 1555 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1556 | * @since Added in version 2.1. |
| 1557 | * @glfw3 Removed format and bytes-per-pixel members. |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 1558 | */ |
| 1559 | typedef struct GLFWimage |
| 1560 | { |
| 1561 | /*! The width, in pixels, of this image. |
| 1562 | */ |
| 1563 | int width; |
| 1564 | /*! The height, in pixels, of this image. |
| 1565 | */ |
| 1566 | int height; |
| 1567 | /*! The pixel data of this image, arranged left-to-right, top-to-bottom. |
| 1568 | */ |
| 1569 | unsigned char* pixels; |
| 1570 | } GLFWimage; |
| 1571 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 1572 | /*! @brief Gamepad input state |
| 1573 | * |
| 1574 | * This describes the input state of a gamepad. |
| 1575 | * |
| 1576 | * @sa @ref gamepad |
| 1577 | * @sa @ref glfwGetGamepadState |
| 1578 | * |
| 1579 | * @since Added in version 3.3. |
| 1580 | */ |
| 1581 | typedef struct GLFWgamepadstate |
| 1582 | { |
| 1583 | /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS` |
| 1584 | * or `GLFW_RELEASE`. |
| 1585 | */ |
Camilla Löwy | 2d8d8f5 | 2017-07-17 21:18:15 +0200 | [diff] [blame] | 1586 | unsigned char buttons[15]; |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 1587 | /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0 |
| 1588 | * to 1.0 inclusive. |
| 1589 | */ |
| 1590 | float axes[6]; |
| 1591 | } GLFWgamepadstate; |
| 1592 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1593 | |
| 1594 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1595 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1596 | *************************************************************************/ |
| 1597 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1598 | /*! @brief Initializes the GLFW library. |
| 1599 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1600 | * This function initializes the GLFW library. Before most GLFW functions can |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1601 | * be used, GLFW must be initialized, and before an application terminates GLFW |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1602 | * should be terminated in order to free any resources allocated during or |
| 1603 | * after initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1604 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1605 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1606 | * succeeds, you should call @ref glfwTerminate before the application exits. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1607 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1608 | * Additional calls to this function after successful initialization but before |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1609 | * termination will return `GLFW_TRUE` immediately. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1610 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1611 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1612 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1613 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1614 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
| 1615 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 1616 | * @remark @macos This function will change the current directory of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1617 | * application to the `Contents/Resources` subdirectory of the application's |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1618 | * bundle, if present. This can be disabled with the @ref |
| 1619 | * GLFW_COCOA_CHDIR_RESOURCES init hint. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1620 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1621 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1622 | * |
| 1623 | * @sa @ref intro_init |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1624 | * @sa @ref glfwTerminate |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1625 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1626 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1627 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1628 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1629 | */ |
| 1630 | GLFWAPI int glfwInit(void); |
| 1631 | |
| 1632 | /*! @brief Terminates the GLFW library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1633 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1634 | * This function destroys all remaining windows and cursors, restores any |
| 1635 | * modified gamma ramps and frees any other allocated resources. Once this |
| 1636 | * function is called, you must again call @ref glfwInit successfully before |
| 1637 | * you will be able to use most GLFW functions. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1638 | * |
| 1639 | * If GLFW has been successfully initialized, this function should be called |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1640 | * before the application exits. If initialization fails, there is no need to |
| 1641 | * call this function, as it is called by @ref glfwInit before it returns |
| 1642 | * failure. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1643 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1644 | * @errors Possible errors include @ref GLFW_PLATFORM_ERROR. |
| 1645 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1646 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1647 | * |
Camilla Berglund | 0df4e06 | 2015-12-13 14:07:27 +0100 | [diff] [blame] | 1648 | * @warning The contexts of any remaining windows must not be current on any |
| 1649 | * other thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1650 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1651 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +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 glfwInit |
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 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1662 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1663 | |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1664 | /*! @brief Sets the specified init hint to the desired value. |
| 1665 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 1666 | * This function sets hints for the next initialization of GLFW. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1667 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 1668 | * The values you set hints to are never reset by GLFW, but they only take |
| 1669 | * effect during initialization. Once GLFW has been initialized, any values |
| 1670 | * you set will be ignored until the library is terminated and initialized |
| 1671 | * again. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1672 | * |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 1673 | * 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] | 1674 | * will only affect their specific platform. Other platforms will ignore them. |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 1675 | * Setting these hints requires no platform specific headers or functions. |
Camilla Löwy | 6d9a58b | 2017-02-14 15:43:31 +0100 | [diff] [blame] | 1676 | * |
| 1677 | * @param[in] hint The [init hint](@ref init_hints) to set. |
| 1678 | * @param[in] value The new value of the init hint. |
| 1679 | * |
| 1680 | * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref |
| 1681 | * GLFW_INVALID_VALUE. |
| 1682 | * |
| 1683 | * @remarks This function may be called before @ref glfwInit. |
| 1684 | * |
| 1685 | * @thread_safety This function must only be called from the main thread. |
| 1686 | * |
| 1687 | * @sa init_hints |
| 1688 | * @sa glfwInit |
| 1689 | * |
| 1690 | * @since Added in version 3.3. |
| 1691 | * |
| 1692 | * @ingroup init |
| 1693 | */ |
| 1694 | GLFWAPI void glfwInitHint(int hint, int value); |
| 1695 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1696 | /*! @brief Retrieves the version of the GLFW library. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1697 | * |
| 1698 | * This function retrieves the major, minor and revision numbers of the GLFW |
| 1699 | * library. It is intended for when you are using GLFW as a shared library and |
| 1700 | * want to ensure that you are using the minimum required version. |
| 1701 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1702 | * Any or all of the version arguments may be `NULL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1703 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1704 | * @param[out] major Where to store the major version number, or `NULL`. |
| 1705 | * @param[out] minor Where to store the minor version number, or `NULL`. |
| 1706 | * @param[out] rev Where to store the revision number, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1707 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1708 | * @errors None. |
| 1709 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1710 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1711 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1712 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1713 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1714 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1715 | * @sa @ref glfwGetVersionString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1716 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1717 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1718 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1719 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1720 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1721 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1722 | |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 1723 | /*! @brief Returns a string describing the compile-time configuration. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1724 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1725 | * This function returns the compile-time generated |
| 1726 | * [version string](@ref intro_version_string) of the GLFW library binary. It |
| 1727 | * describes the version, platform, compiler and any platform-specific |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 1728 | * compile-time options. It should not be confused with the OpenGL or OpenGL |
| 1729 | * ES version string, queried with `glGetString`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1730 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1731 | * __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] | 1732 | * @ref glfwGetVersion function provides the version of the running library |
| 1733 | * binary in numerical format. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1734 | * |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 1735 | * @return The ASCII encoded GLFW version string. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1736 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1737 | * @errors None. |
| 1738 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1739 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1740 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1741 | * @pointer_lifetime The returned string is static and compile-time generated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1742 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1743 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1744 | * |
| 1745 | * @sa @ref intro_version |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1746 | * @sa @ref glfwGetVersion |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1747 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1748 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1749 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1750 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1751 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 1752 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1753 | |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1754 | /*! @brief Returns and clears the last error for the calling thread. |
| 1755 | * |
Camilla Löwy | 2e9aff7 | 2017-07-09 14:46:39 +0200 | [diff] [blame] | 1756 | * 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] | 1757 | * error that occurred on the calling thread, and optionally a UTF-8 encoded |
| 1758 | * 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] | 1759 | * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is |
| 1760 | * set to `NULL`. |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1761 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1762 | * @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] | 1763 | * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR |
| 1764 | * (zero). |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1765 | * |
| 1766 | * @errors None. |
| 1767 | * |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1768 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 1769 | * should not free it yourself. It is guaranteed to be valid only until the |
| 1770 | * next error occurs or the library is terminated. |
| 1771 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1772 | * @remark This function may be called before @ref glfwInit. |
| 1773 | * |
| 1774 | * @thread_safety This function may be called from any thread. |
| 1775 | * |
| 1776 | * @sa @ref error_handling |
| 1777 | * @sa @ref glfwSetErrorCallback |
| 1778 | * |
| 1779 | * @since Added in version 3.3. |
| 1780 | * |
| 1781 | * @ingroup init |
| 1782 | */ |
Camilla Löwy | 14a3fe0 | 2017-05-25 18:23:09 +0200 | [diff] [blame] | 1783 | GLFWAPI int glfwGetError(const char** description); |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1784 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1785 | /*! @brief Sets the error callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1786 | * |
| 1787 | * This function sets the error callback, which is called with an error code |
| 1788 | * and a human-readable description each time a GLFW error occurs. |
| 1789 | * |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1790 | * The error code is set before the callback is called. Calling @ref |
| 1791 | * glfwGetError from the error callback will return the same value as the error |
| 1792 | * code argument. |
| 1793 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1794 | * The error callback is called on the thread where the error occurred. If you |
| 1795 | * are using GLFW from multiple threads, your error callback needs to be |
| 1796 | * written accordingly. |
| 1797 | * |
| 1798 | * Because the description string may have been generated specifically for that |
| 1799 | * error, it is not guaranteed to be valid after the callback has returned. If |
| 1800 | * you wish to use it after the callback returns, you need to make a copy. |
| 1801 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 1802 | * Once set, the error callback remains set even after the library has been |
| 1803 | * terminated. |
| 1804 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1805 | * @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] | 1806 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1807 | * @return The previously set callback, or `NULL` if no callback was set. |
| 1808 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1809 | * @errors None. |
| 1810 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1811 | * @remark This function may be called before @ref glfwInit. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1812 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1813 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1814 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1815 | * @sa @ref error_handling |
Camilla Löwy | 6350641 | 2017-05-01 19:20:57 +0200 | [diff] [blame] | 1816 | * @sa @ref glfwGetError |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1817 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1818 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1819 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1820 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1821 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1822 | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 1823 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1824 | /*! @brief Returns the currently connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1825 | * |
| 1826 | * This function returns an array of handles for all currently connected |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1827 | * monitors. The primary monitor is always first in the returned array. If no |
| 1828 | * monitors were found, this function returns `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1829 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1830 | * @param[out] count Where to store the number of monitors in the returned |
| 1831 | * array. This is set to zero if an error occurred. |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1832 | * @return An array of monitor handles, or `NULL` if no monitors were found or |
| 1833 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1834 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1835 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 1836 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1837 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 1838 | * should not free it yourself. It is guaranteed to be valid only until the |
| 1839 | * monitor configuration changes or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1840 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1841 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1842 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1843 | * @sa @ref monitor_monitors |
| 1844 | * @sa @ref monitor_event |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1845 | * @sa @ref glfwGetPrimaryMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1846 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1847 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1848 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1849 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1850 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1851 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1852 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1853 | /*! @brief Returns the primary monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1854 | * |
| 1855 | * This function returns the primary monitor. This is usually the monitor |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1856 | * where elements like the task bar or global menu bar are located. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1857 | * |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1858 | * @return The primary monitor, or `NULL` if no monitors were found or if an |
| 1859 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1860 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1861 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 1862 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1863 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1864 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1865 | * @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] | 1866 | * glfwGetMonitors. |
| 1867 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1868 | * @sa @ref monitor_monitors |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 1869 | * @sa @ref glfwGetMonitors |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1870 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1871 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1872 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1873 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1874 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1875 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1876 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1877 | /*! @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] | 1878 | * |
| 1879 | * This function returns the position, in screen coordinates, of the upper-left |
| 1880 | * corner of the specified monitor. |
| 1881 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1882 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 1883 | * non-`NULL` position arguments will be set to zero. |
| 1884 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1885 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1886 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 1887 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1888 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1889 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 1890 | * GLFW_PLATFORM_ERROR. |
| 1891 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1892 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1893 | * |
| 1894 | * @sa @ref monitor_properties |
| 1895 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1896 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1897 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1898 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1899 | */ |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1900 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
| 1901 | |
| 1902 | /*! @brief Returns the physical size of the monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1903 | * |
| 1904 | * This function returns the size, in millimetres, of the display area of the |
| 1905 | * specified monitor. |
| 1906 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1907 | * Some systems do not provide accurate monitor size information, either |
| 1908 | * because the monitor |
| 1909 | * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) |
| 1910 | * data is incorrect or because the driver does not report it accurately. |
| 1911 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1912 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 1913 | * non-`NULL` size arguments will be set to zero. |
| 1914 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1915 | * @param[in] monitor The monitor to query. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1916 | * @param[out] widthMM Where to store the width, in millimetres, of the |
| 1917 | * monitor's display area, or `NULL`. |
| 1918 | * @param[out] heightMM Where to store the height, in millimetres, of the |
| 1919 | * monitor's display area, 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. |
| 1922 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1923 | * @remark @win32 calculates the returned physical size from the |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1924 | * current resolution and system DPI instead of querying the monitor EDID data. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1925 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1926 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1927 | * |
| 1928 | * @sa @ref monitor_properties |
| 1929 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1930 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1931 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1932 | * @ingroup monitor |
| 1933 | */ |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1934 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1935 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 1936 | /*! @brief Retrieves the content scale for the specified monitor. |
| 1937 | * |
| 1938 | * This function retrieves the content scale for the specified monitor. The |
| 1939 | * content scale is the ratio between the current DPI and the platform's |
| 1940 | * default DPI. If you scale all pixel dimensions by this scale then your |
| 1941 | * content should appear at an appropriate size. This is especially important |
| 1942 | * for text and any UI elements. |
| 1943 | * |
| 1944 | * The content scale may depend on both the monitor resolution and pixel |
| 1945 | * density and on user settings. It may be very different from the raw DPI |
| 1946 | * calculated from the physical size and current resolution. |
| 1947 | * |
| 1948 | * @param[in] monitor The monitor to query. |
| 1949 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 1950 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 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_scale |
| 1958 | * @sa @ref glfwGetWindowContentScale |
| 1959 | * |
| 1960 | * @since Added in version 3.3. |
| 1961 | * |
| 1962 | * @ingroup monitor |
| 1963 | */ |
| 1964 | GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale); |
| 1965 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1966 | /*! @brief Returns the name of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1967 | * |
| 1968 | * 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] | 1969 | * specified monitor. The name typically reflects the make and model of the |
| 1970 | * monitor and is not guaranteed to be unique among the connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1971 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1972 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1973 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an |
| 1974 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1975 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 1976 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 1977 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1978 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 1979 | * should not free it yourself. It is valid until the specified monitor is |
| 1980 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1981 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 1982 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1983 | * |
| 1984 | * @sa @ref monitor_properties |
| 1985 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 1986 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1987 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1988 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1989 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1990 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1991 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 1992 | /*! @brief Sets the user pointer of the specified monitor. |
| 1993 | * |
| 1994 | * This function sets the user-defined pointer of the specified monitor. The |
| 1995 | * current value is retained until the monitor is disconnected. The initial |
| 1996 | * value is `NULL`. |
| 1997 | * |
| 1998 | * This function may be called from the monitor callback, even for a monitor |
| 1999 | * that is being disconnected. |
| 2000 | * |
| 2001 | * @param[in] monitor The monitor whose pointer to set. |
| 2002 | * @param[in] pointer The new value. |
| 2003 | * |
| 2004 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2005 | * |
| 2006 | * @thread_safety This function may be called from any thread. Access is not |
| 2007 | * synchronized. |
| 2008 | * |
| 2009 | * @sa @ref monitor_userptr |
| 2010 | * @sa @ref glfwGetMonitorUserPointer |
| 2011 | * |
| 2012 | * @since Added in version 3.3. |
| 2013 | * |
| 2014 | * @ingroup monitor |
| 2015 | */ |
| 2016 | GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); |
| 2017 | |
| 2018 | /*! @brief Returns the user pointer of the specified monitor. |
| 2019 | * |
| 2020 | * This function returns the current value of the user-defined pointer of the |
| 2021 | * specified monitor. The initial value is `NULL`. |
| 2022 | * |
| 2023 | * This function may be called from the monitor callback, even for a monitor |
| 2024 | * that is being disconnected. |
| 2025 | * |
| 2026 | * @param[in] monitor The monitor whose pointer to return. |
| 2027 | * |
| 2028 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2029 | * |
| 2030 | * @thread_safety This function may be called from any thread. Access is not |
| 2031 | * synchronized. |
| 2032 | * |
| 2033 | * @sa @ref monitor_userptr |
| 2034 | * @sa @ref glfwSetMonitorUserPointer |
| 2035 | * |
| 2036 | * @since Added in version 3.3. |
| 2037 | * |
| 2038 | * @ingroup monitor |
| 2039 | */ |
| 2040 | GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); |
| 2041 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2042 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2043 | * |
| 2044 | * This function sets the monitor configuration callback, or removes the |
| 2045 | * currently set callback. This is called when a monitor is connected to or |
| 2046 | * disconnected from the system. |
| 2047 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2048 | * @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] | 2049 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2050 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2051 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2052 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2053 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2054 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2055 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2056 | * |
| 2057 | * @sa @ref monitor_event |
| 2058 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2059 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2060 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2061 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2062 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2063 | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 2064 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2065 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2066 | * |
| 2067 | * 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] | 2068 | * monitor. The returned array is sorted in ascending order, first by color |
| 2069 | * bit depth (the sum of all channel depths) and then by resolution area (the |
| 2070 | * product of width and height). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2071 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2072 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2073 | * @param[out] count Where to store the number of video modes in the returned |
| 2074 | * array. This is set to zero if an error occurred. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2075 | * @return An array of video modes, or `NULL` if an |
| 2076 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2077 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2078 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2079 | * GLFW_PLATFORM_ERROR. |
| 2080 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2081 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2082 | * should not free it yourself. It is valid until the specified monitor is |
| 2083 | * disconnected, this function is called again for that monitor or the library |
| 2084 | * is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2085 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2086 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2087 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2088 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2089 | * @sa @ref glfwGetVideoMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2090 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2091 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2092 | * @glfw3 Changed to return an array of modes for a specific monitor. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2093 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2094 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2095 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2096 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2097 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2098 | /*! @brief Returns the current mode of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2099 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2100 | * This function returns the current video mode of the specified monitor. If |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2101 | * you have created a full screen window for that monitor, the return value |
| 2102 | * will depend on whether that window is iconified. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2103 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2104 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2105 | * @return The current mode of the monitor, or `NULL` if an |
| 2106 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2107 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2108 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2109 | * GLFW_PLATFORM_ERROR. |
| 2110 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2111 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 2112 | * should not free it yourself. It is valid until the specified monitor is |
| 2113 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2114 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2115 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2116 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2117 | * @sa @ref monitor_modes |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2118 | * @sa @ref glfwGetVideoModes |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2119 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2120 | * @since Added in version 3.0. Replaces `glfwGetDesktopMode`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2121 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2122 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2123 | */ |
Camilla Berglund | ce1e84d | 2013-05-22 22:16:43 +0200 | [diff] [blame] | 2124 | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2125 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2126 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2127 | * |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2128 | * This function generates a 256-element gamma ramp from the specified exponent |
Camilla Berglund | 5bbc2b4 | 2015-03-15 15:40:43 +0100 | [diff] [blame] | 2129 | * and then calls @ref glfwSetGammaRamp with it. The value must be a finite |
| 2130 | * number greater than zero. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2131 | * |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2132 | * The software controlled gamma ramp is applied _in addition_ to the hardware |
| 2133 | * gamma correction, which today is usually an approximation of sRGB gamma. |
| 2134 | * This means that setting a perfectly linear ramp, or gamma 1.0, will produce |
| 2135 | * the default (usually sRGB-like) behavior. |
| 2136 | * |
| 2137 | * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref |
| 2138 | * GLFW_SRGB_CAPABLE hint. |
| 2139 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2140 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 2141 | * @param[in] gamma The desired exponent. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 2142 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2143 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2144 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 2145 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2146 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2147 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +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 | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2150 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2151 | * @sa @ref monitor_gamma |
| 2152 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2153 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2154 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2155 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2156 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2157 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2158 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2159 | /*! @brief Returns the current gamma ramp for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2160 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2161 | * This function returns the current gamma ramp of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2162 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2163 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2164 | * @return The current gamma ramp, or `NULL` if an |
| 2165 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2166 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2167 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2168 | * GLFW_PLATFORM_ERROR. |
| 2169 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2170 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2171 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while |
| 2172 | * returning `NULL`. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2173 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2174 | * @pointer_lifetime The returned structure and its arrays are allocated and |
| 2175 | * freed by GLFW. You should not free them yourself. They are valid until the |
| 2176 | * specified monitor is disconnected, this function is called again for that |
| 2177 | * monitor or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2178 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2179 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2180 | * |
| 2181 | * @sa @ref monitor_gamma |
| 2182 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2183 | * @since Added in version 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2184 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2185 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2186 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 2187 | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2188 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2189 | /*! @brief Sets the current gamma ramp for the specified monitor. |
| 2190 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2191 | * This function sets the current gamma ramp for the specified monitor. The |
| 2192 | * original gamma ramp for that monitor is saved by GLFW the first time this |
| 2193 | * function is called and is restored by @ref glfwTerminate. |
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 | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2204 | * @param[in] ramp The gamma ramp to use. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +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 and @ref |
| 2207 | * GLFW_PLATFORM_ERROR. |
| 2208 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2209 | * @remark Gamma ramp sizes other than 256 are not supported by all platforms |
Camilla Berglund | 76fff4d | 2015-03-10 19:02:28 +0100 | [diff] [blame] | 2210 | * or graphics hardware. |
| 2211 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2212 | * @remark @win32 The gamma ramp size must be 256. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2213 | * |
Emmanuel Gil Peyrot | 9c51334 | 2017-11-17 12:17:43 +0000 | [diff] [blame] | 2214 | * @remark @wayland Gamma handling is a priviledged protocol, this function |
| 2215 | * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2216 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2217 | * @pointer_lifetime The specified gamma ramp is copied before this function |
| 2218 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2219 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2220 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2221 | * |
| 2222 | * @sa @ref monitor_gamma |
| 2223 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2224 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2225 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 2226 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2227 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 2228 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 2229 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2230 | /*! @brief Resets all window hints to their default values. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2231 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2232 | * This function resets all window hints to their |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2233 | * [default values](@ref window_hints_values). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2234 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2235 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2236 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2237 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2238 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2239 | * @sa @ref window_hints |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2240 | * @sa @ref glfwWindowHint |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2241 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2242 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2243 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2244 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2245 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2246 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 2247 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2248 | |
| 2249 | /*! @brief Sets the specified window hint to the desired value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2250 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 2251 | * 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] | 2252 | * hints, once set, retain their values until changed by a call to this |
| 2253 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 2254 | * |
| 2255 | * Only integer value hints can be set with this function. String value hints |
| 2256 | * are set with @ref glfwWindowHintString. |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 2257 | * |
Camilla Berglund | d6e0a43 | 2016-02-09 07:41:48 +0100 | [diff] [blame] | 2258 | * This function does not check whether the specified hint values are valid. |
| 2259 | * If you set hints to invalid values this will instead be reported by the next |
| 2260 | * call to @ref glfwCreateWindow. |
| 2261 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2262 | * Some hints are platform specific. These may be set on any platform but they |
| 2263 | * will only affect their specific platform. Other platforms will ignore them. |
| 2264 | * Setting these hints requires no platform specific headers or functions. |
| 2265 | * |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 2266 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 2267 | * @param[in] value The new value of the window hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +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_INVALID_ENUM. |
| 2271 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2272 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 2273 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2274 | * @sa @ref window_hints |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2275 | * @sa @ref glfwWindowHintString |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2276 | * @sa @ref glfwDefaultWindowHints |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2277 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2278 | * @since Added in version 3.0. Replaces `glfwOpenWindowHint`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2279 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2280 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2281 | */ |
Camilla Berglund | d0649e6 | 2016-01-27 03:25:21 +0100 | [diff] [blame] | 2282 | GLFWAPI void glfwWindowHint(int hint, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2283 | |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2284 | /*! @brief Sets the specified window hint to the desired value. |
| 2285 | * |
| 2286 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 2287 | * hints, once set, retain their values until changed by a call to this |
| 2288 | * function or @ref glfwDefaultWindowHints, or until the library is terminated. |
| 2289 | * |
| 2290 | * Only string type hints can be set with this function. Integer value hints |
| 2291 | * are set with @ref glfwWindowHint. |
| 2292 | * |
| 2293 | * This function does not check whether the specified hint values are valid. |
| 2294 | * If you set hints to invalid values this will instead be reported by the next |
| 2295 | * call to @ref glfwCreateWindow. |
| 2296 | * |
| 2297 | * Some hints are platform specific. These may be set on any platform but they |
| 2298 | * will only affect their specific platform. Other platforms will ignore them. |
| 2299 | * Setting these hints requires no platform specific headers or functions. |
| 2300 | * |
| 2301 | * @param[in] hint The [window hint](@ref window_hints) to set. |
| 2302 | * @param[in] value The new value of the window hint. |
| 2303 | * |
| 2304 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2305 | * GLFW_INVALID_ENUM. |
| 2306 | * |
| 2307 | * @pointer_lifetime The specified string is copied before this function |
| 2308 | * returns. |
| 2309 | * |
| 2310 | * @thread_safety This function must only be called from the main thread. |
| 2311 | * |
| 2312 | * @sa @ref window_hints |
| 2313 | * @sa @ref glfwWindowHint |
| 2314 | * @sa @ref glfwDefaultWindowHints |
| 2315 | * |
| 2316 | * @since Added in version 3.3. |
| 2317 | * |
| 2318 | * @ingroup window |
| 2319 | */ |
| 2320 | GLFWAPI void glfwWindowHintString(int hint, const char* value); |
| 2321 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2322 | /*! @brief Creates a window and its associated context. |
| 2323 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2324 | * This function creates a window and its associated OpenGL or OpenGL ES |
| 2325 | * context. Most of the options controlling how the window and its context |
| 2326 | * should be created are specified with [window hints](@ref window_hints). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2327 | * |
| 2328 | * Successful creation does not change which context is current. Before you |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2329 | * can use the newly created context, you need to |
| 2330 | * [make it current](@ref context_current). For information about the `share` |
| 2331 | * parameter, see @ref context_sharing. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2332 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2333 | * The created window, framebuffer and context may differ from what you |
| 2334 | * requested, as not all parameters and hints are |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 2335 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2336 | * window, especially for full screen windows. To query the actual attributes |
Camilla Berglund | e8bceaa | 2015-04-07 14:37:42 +0200 | [diff] [blame] | 2337 | * of the created window, framebuffer and context, see @ref |
| 2338 | * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2339 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2340 | * 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] | 2341 | * will cover. If no monitor is specified, the window will be windowed mode. |
| 2342 | * Unless you have a way for the user to choose a specific monitor, it is |
| 2343 | * recommended that you pick the primary monitor. For more information on how |
| 2344 | * to query connected monitors, see @ref monitor_monitors. |
Camilla Berglund | 4b7ae49 | 2013-07-07 12:06:59 +0200 | [diff] [blame] | 2345 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2346 | * For full screen windows, the specified size becomes the resolution of the |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2347 | * window's _desired video mode_. As long as a full screen window is not |
| 2348 | * iconified, the supported video mode most closely matching the desired video |
| 2349 | * mode is set for the specified monitor. For more information about full |
| 2350 | * screen windows, including the creation of so called _windowed full screen_ |
| 2351 | * or _borderless full screen_ windows, see @ref window_windowed_full_screen. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2352 | * |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 2353 | * 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] | 2354 | * full screen mode with @ref glfwSetWindowMonitor. This will not affect its |
| 2355 | * OpenGL or OpenGL ES context. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 2356 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2357 | * By default, newly created windows use the placement recommended by the |
| 2358 | * 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] | 2359 | * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2360 | * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) |
| 2361 | * it. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2362 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2363 | * As long as at least one full screen window is not iconified, the screensaver |
| 2364 | * is prohibited from starting. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2365 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2366 | * Window systems put limits on window sizes. Very large or very small window |
| 2367 | * dimensions may be overridden by the window system on creation. Check the |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2368 | * actual [size](@ref window_size) after creation. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2369 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2370 | * 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] | 2371 | * the initial value may vary depending on driver settings and defaults. |
| 2372 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2373 | * @param[in] width The desired width, in screen coordinates, of the window. |
| 2374 | * This must be greater than zero. |
| 2375 | * @param[in] height The desired height, in screen coordinates, of the window. |
| 2376 | * This must be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2377 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2378 | * @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] | 2379 | * windowed mode. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2380 | * @param[in] share The window whose context to share resources with, or `NULL` |
| 2381 | * to not share resources. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2382 | * @return The handle of the created window, or `NULL` if an |
| 2383 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2384 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2385 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2386 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref |
| 2387 | * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref |
| 2388 | * GLFW_PLATFORM_ERROR. |
| 2389 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2390 | * @remark @win32 Window creation will fail if the Microsoft GDI software |
| 2391 | * OpenGL implementation is the only one available. |
Camilla Berglund | 07db5da | 2013-09-26 19:15:36 +0200 | [diff] [blame] | 2392 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 2393 | * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it |
| 2394 | * 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] | 2395 | * the `IDI_APPLICATION` icon will be used instead. To set a different icon, |
| 2396 | * see @ref glfwSetWindowIcon. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2397 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2398 | * @remark @win32 The context to share resources with must not be current on |
| 2399 | * any other thread. |
Camilla Berglund | b19fb4c | 2014-12-27 21:14:41 +0100 | [diff] [blame] | 2400 | * |
Camilla Löwy | fd127d5 | 2016-12-03 19:32:00 +0100 | [diff] [blame] | 2401 | * @remark @macos The OS only supports forward-compatible core profile contexts |
| 2402 | * for OpenGL versions 3.2 and later. Before creating an OpenGL context of |
| 2403 | * version 3.2 or later you must set the |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2404 | * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and |
| 2405 | * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly. |
| 2406 | * 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] | 2407 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2408 | * @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] | 2409 | * 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] | 2410 | * For more information on bundles, see the |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2411 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 2412 | * in the Mac Developer Library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2413 | * |
Camilla Löwy | c50aba1 | 2017-03-01 04:09:51 +0100 | [diff] [blame] | 2414 | * @remark @macos The first time a window is created the menu bar is created. |
| 2415 | * If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu |
| 2416 | * bar. Otherwise a minimal menu bar is created manually with common commands |
| 2417 | * like Hide, Quit and About. The About entry opens a minimal about dialog |
| 2418 | * with information from the application's bundle. Menu bar creation can be |
| 2419 | * disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2420 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2421 | * @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] | 2422 | * at full resolution on Retina displays unless the |
| 2423 | * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) |
| 2424 | * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the |
| 2425 | * application bundle's `Info.plist`. For more information, see |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 2426 | * [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] | 2427 | * in the Mac Developer Library. The GLFW test and example programs use |
| 2428 | * a custom `Info.plist` template for this, which can be found as |
| 2429 | * `CMake/MacOSXBundleInfo.plist.in` in the source tree. |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 2430 | * |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 2431 | * @remark @macos When activating frame autosaving with |
Camilla Löwy | 9da2285 | 2017-12-12 16:45:38 +0100 | [diff] [blame] | 2432 | * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified |
| 2433 | * window size and position may be overriden by previously saved values. |
Camilla Löwy | 4661315 | 2017-01-01 19:41:50 +0100 | [diff] [blame] | 2434 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2435 | * @remark @x11 Some window managers will not respect the placement of |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2436 | * initially hidden windows. |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 2437 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2438 | * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for |
| 2439 | * a window to reach its requested state. This means you may not be able to |
| 2440 | * query the final size, position or other attributes directly after window |
| 2441 | * creation. |
Camilla Berglund | 20ed0a1 | 2015-08-12 21:31:54 +0200 | [diff] [blame] | 2442 | * |
Camilla Löwy | 6158801 | 2017-12-12 10:54:18 +0100 | [diff] [blame] | 2443 | * @remark @x11 The class part of the `WM_CLASS` window property will by |
| 2444 | * default be set to the window title passed to this function. The instance |
| 2445 | * part will use the contents of the `RESOURCE_NAME` environment variable, if |
| 2446 | * present and not empty, or fall back to the window title. Set the @ref |
| 2447 | * GLFW_X11_CLASS_NAME and @ref GLFW_X11_INSTANCE_NAME window hints to override |
| 2448 | * this. |
Camilla Löwy | 213dd2d | 2017-07-25 01:55:08 +0200 | [diff] [blame] | 2449 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2450 | * @remark @wayland The window frame is currently unimplemented, as if |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2451 | * [GLFW_DECORATED](@ref GLFW_DECORATED_hint) was always set to `GLFW_FALSE`. |
| 2452 | * A compositor can still emit close, resize or maximize events, using for |
| 2453 | * example a keybind mechanism. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2454 | * |
| 2455 | * @remark @wayland A full screen window will not attempt to change the mode, |
| 2456 | * no matter what the requested size or refresh rate. |
| 2457 | * |
| 2458 | * @remark @wayland The wl_shell protocol does not support window |
| 2459 | * icons, the window will inherit the one defined in the application's |
| 2460 | * desktop file, so this function emits @ref GLFW_PLATFORM_ERROR. |
| 2461 | * |
Emmanuel Gil Peyrot | 6516685 | 2017-02-17 15:52:50 +0000 | [diff] [blame] | 2462 | * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol |
| 2463 | * to be implemented in the user's compositor. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2464 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2465 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2466 | * |
| 2467 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2468 | * @sa @ref glfwDestroyWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2469 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2470 | * @since Added in version 3.0. Replaces `glfwOpenWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2471 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2472 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2473 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2474 | 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] | 2475 | |
| 2476 | /*! @brief Destroys the specified window and its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2477 | * |
| 2478 | * This function destroys the specified window and its context. On calling |
| 2479 | * this function, no further callbacks will be called for that window. |
| 2480 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2481 | * If the context of the specified window is current on the main thread, it is |
| 2482 | * detached before being destroyed. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2483 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2484 | * @param[in] window The window to destroy. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2485 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2486 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2487 | * GLFW_PLATFORM_ERROR. |
| 2488 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2489 | * @note The context of the specified window must not be current on any other |
| 2490 | * thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2491 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2492 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 2493 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2494 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2495 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2496 | * @sa @ref window_creation |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2497 | * @sa @ref glfwCreateWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2498 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2499 | * @since Added in version 3.0. Replaces `glfwCloseWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2500 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2501 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2502 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2503 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2504 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2505 | /*! @brief Checks the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2506 | * |
| 2507 | * This function returns the value of the close flag of the specified window. |
| 2508 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2509 | * @param[in] window The window to query. |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2510 | * @return The value of the close flag. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2511 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2512 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2513 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2514 | * @thread_safety This function may be called from any thread. Access is not |
| 2515 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2516 | * |
| 2517 | * @sa @ref window_close |
| 2518 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2519 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 2520 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2521 | * @ingroup window |
| 2522 | */ |
| 2523 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
| 2524 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2525 | /*! @brief Sets the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2526 | * |
| 2527 | * This function sets the value of the close flag of the specified window. |
| 2528 | * This can be used to override the user's attempt to close the window, or |
| 2529 | * to signal that it should be closed. |
| 2530 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 2531 | * @param[in] window The window whose flag to change. |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2532 | * @param[in] value The new value. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2533 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2534 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 2535 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2536 | * @thread_safety This function may be called from any thread. Access is not |
| 2537 | * synchronized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2538 | * |
| 2539 | * @sa @ref window_close |
| 2540 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2541 | * @since Added in version 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 2542 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2543 | * @ingroup window |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 2544 | */ |
| 2545 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
| 2546 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2547 | /*! @brief Sets the title of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2548 | * |
| 2549 | * This function sets the window title, encoded as UTF-8, of the specified |
| 2550 | * window. |
| 2551 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2552 | * @param[in] window The window whose title to change. |
| 2553 | * @param[in] title The UTF-8 encoded window title. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2554 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2555 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2556 | * GLFW_PLATFORM_ERROR. |
| 2557 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2558 | * @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] | 2559 | * process events. |
Camilla Berglund | 6412dcb | 2015-04-07 21:52:29 +0200 | [diff] [blame] | 2560 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2561 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2562 | * |
| 2563 | * @sa @ref window_title |
| 2564 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2565 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2566 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2567 | * |
| 2568 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2569 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2570 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2571 | |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2572 | /*! @brief Sets the icon for the specified window. |
| 2573 | * |
| 2574 | * This function sets the icon of the specified window. If passed an array of |
| 2575 | * candidate images, those of or closest to the sizes desired by the system are |
| 2576 | * selected. If no images are specified, the window reverts to its default |
| 2577 | * icon. |
| 2578 | * |
Camilla Löwy | beaeb0d | 2017-06-06 18:17:58 +0200 | [diff] [blame] | 2579 | * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight |
| 2580 | * bits per channel with the red channel first. They are arranged canonically |
| 2581 | * as packed sequential rows, starting from the top-left corner. |
| 2582 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2583 | * The desired image sizes varies depending on platform and system settings. |
| 2584 | * The selected images will be rescaled as needed. Good sizes include 16x16, |
| 2585 | * 32x32 and 48x48. |
| 2586 | * |
| 2587 | * @param[in] window The window whose icon to set. |
| 2588 | * @param[in] count The number of images in the specified array, or zero to |
| 2589 | * revert to the default window icon. |
| 2590 | * @param[in] images The images to create the icon from. This is ignored if |
| 2591 | * count is zero. |
| 2592 | * |
| 2593 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2594 | * GLFW_PLATFORM_ERROR. |
| 2595 | * |
| 2596 | * @pointer_lifetime The specified image data is copied before this function |
| 2597 | * returns. |
| 2598 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 2599 | * @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] | 2600 | * window, so this function does nothing. The dock icon will be the same as |
| 2601 | * the application bundle's icon. For more information on bundles, see the |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2602 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 2603 | * in the Mac Developer Library. |
| 2604 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2605 | * @remark @wayland The wl_shell protocol does not support icons, the window |
| 2606 | * will inherit the one defined in the application's desktop file, so this |
| 2607 | * function emits @ref GLFW_PLATFORM_ERROR. |
| 2608 | * |
Camilla Berglund | b823f71 | 2016-03-07 14:55:30 +0100 | [diff] [blame] | 2609 | * @thread_safety This function must only be called from the main thread. |
| 2610 | * |
| 2611 | * @sa @ref window_icon |
| 2612 | * |
| 2613 | * @since Added in version 3.2. |
| 2614 | * |
| 2615 | * @ingroup window |
| 2616 | */ |
| 2617 | GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images); |
| 2618 | |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2619 | /*! @brief Retrieves the position of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2620 | * |
| 2621 | * This function retrieves the position, in screen coordinates, of the |
| 2622 | * upper-left corner of the client area of the specified window. |
| 2623 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2624 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 2625 | * non-`NULL` position arguments will be set to zero. |
| 2626 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2627 | * @param[in] window The window to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2628 | * @param[out] xpos Where to store the x-coordinate of the upper-left corner of |
| 2629 | * the client area, or `NULL`. |
| 2630 | * @param[out] ypos Where to store the y-coordinate of the upper-left corner of |
| 2631 | * the client area, or `NULL`. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2632 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2633 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2634 | * GLFW_PLATFORM_ERROR. |
| 2635 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2636 | * @remark @wayland There is no way for an application to retrieve the global |
| 2637 | * position of its windows, this function will always emit @ref |
| 2638 | * GLFW_PLATFORM_ERROR. |
| 2639 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2640 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2641 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2642 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2643 | * @sa @ref glfwSetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2644 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2645 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2646 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2647 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2648 | */ |
| 2649 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
| 2650 | |
| 2651 | /*! @brief Sets the position of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2652 | * |
| 2653 | * This function sets the position, in screen coordinates, of the upper-left |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2654 | * corner of the client area of the specified windowed mode window. If the |
| 2655 | * window is a full screen window, this function does nothing. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2656 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2657 | * __Do not use this function__ to move an already visible window unless you |
| 2658 | * have very good reasons for doing so, as it will confuse and annoy the user. |
| 2659 | * |
| 2660 | * The window manager may put limits on what positions are allowed. GLFW |
| 2661 | * cannot and should not override these limits. |
| 2662 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2663 | * @param[in] window The window to query. |
| 2664 | * @param[in] xpos The x-coordinate of the upper-left corner of the client area. |
| 2665 | * @param[in] ypos The y-coordinate of the upper-left corner of the client area. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2666 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2667 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2668 | * GLFW_PLATFORM_ERROR. |
| 2669 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2670 | * @remark @wayland There is no way for an application to set the global |
| 2671 | * position of its windows, this function will always emit @ref |
| 2672 | * GLFW_PLATFORM_ERROR. |
| 2673 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2674 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2675 | * |
| 2676 | * @sa @ref window_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2677 | * @sa @ref glfwGetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2678 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2679 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2680 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2681 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2682 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2683 | */ |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 2684 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 2685 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2686 | /*! @brief Retrieves the size of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2687 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2688 | * This function retrieves the size, in screen coordinates, of the client area |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 2689 | * 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] | 2690 | * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2691 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2692 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2693 | * non-`NULL` size arguments will be set to zero. |
| 2694 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2695 | * @param[in] window The window whose size to retrieve. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2696 | * @param[out] width Where to store the width, in screen coordinates, of the |
| 2697 | * client area, or `NULL`. |
| 2698 | * @param[out] height Where to store the height, in screen coordinates, of the |
| 2699 | * client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2700 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2701 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2702 | * GLFW_PLATFORM_ERROR. |
| 2703 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2704 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2705 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2706 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2707 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2708 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2709 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2710 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2711 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2712 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2713 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2714 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2715 | |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2716 | /*! @brief Sets the size limits of the specified window. |
| 2717 | * |
| 2718 | * This function sets the size limits of the client area of the specified |
Emmanuel Gil Peyrot | f0f5d9f | 2016-04-09 00:42:58 +0100 | [diff] [blame] | 2719 | * 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] | 2720 | * once it is made windowed. If the window is not resizable, this function |
| 2721 | * does nothing. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2722 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2723 | * The size limits are applied immediately to a windowed mode window and may |
| 2724 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2725 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 2726 | * The maximum dimensions must be greater than or equal to the minimum |
| 2727 | * dimensions and all must be greater than or equal to zero. |
| 2728 | * |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2729 | * @param[in] window The window to set limits for. |
| 2730 | * @param[in] minwidth The minimum width, in screen coordinates, of the client |
| 2731 | * area, or `GLFW_DONT_CARE`. |
| 2732 | * @param[in] minheight The minimum height, in screen coordinates, of the |
| 2733 | * client area, or `GLFW_DONT_CARE`. |
| 2734 | * @param[in] maxwidth The maximum width, in screen coordinates, of the client |
| 2735 | * area, or `GLFW_DONT_CARE`. |
| 2736 | * @param[in] maxheight The maximum height, in screen coordinates, of the |
| 2737 | * client area, or `GLFW_DONT_CARE`. |
| 2738 | * |
Camilla Berglund | 12a6956 | 2016-05-04 16:28:08 +0200 | [diff] [blame] | 2739 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2740 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2741 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2742 | * @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] | 2743 | * results are undefined. |
| 2744 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2745 | * @remark @wayland The size limits will not be applied until the window is |
| 2746 | * actually resized, either by the user or by the compositor. |
| 2747 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2748 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2749 | * |
| 2750 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2751 | * @sa @ref glfwSetWindowAspectRatio |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2752 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2753 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2754 | * |
| 2755 | * @ingroup window |
| 2756 | */ |
| 2757 | GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); |
| 2758 | |
| 2759 | /*! @brief Sets the aspect ratio of the specified window. |
| 2760 | * |
| 2761 | * This function sets the required aspect ratio of the client area of the |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2762 | * specified window. If the window is full screen, the aspect ratio only takes |
| 2763 | * 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] | 2764 | * function does nothing. |
| 2765 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 2766 | * The aspect ratio is specified as a numerator and a denominator and both |
| 2767 | * values must be greater than zero. For example, the common 16:9 aspect ratio |
| 2768 | * is specified as 16 and 9, respectively. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2769 | * |
Camilla Berglund | af5b82a | 2015-10-19 16:01:42 +0200 | [diff] [blame] | 2770 | * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect |
| 2771 | * ratio limit is disabled. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2772 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2773 | * The aspect ratio is applied immediately to a windowed mode window and may |
| 2774 | * cause it to be resized. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2775 | * |
| 2776 | * @param[in] window The window to set limits for. |
| 2777 | * @param[in] numer The numerator of the desired aspect ratio, or |
| 2778 | * `GLFW_DONT_CARE`. |
| 2779 | * @param[in] denom The denominator of the desired aspect ratio, or |
| 2780 | * `GLFW_DONT_CARE`. |
| 2781 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2782 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 2783 | * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 2784 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2785 | * @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] | 2786 | * results are undefined. |
| 2787 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2788 | * @remark @wayland The aspect ratio will not be applied until the window is |
| 2789 | * actually resized, either by the user or by the compositor. |
| 2790 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2791 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2792 | * |
| 2793 | * @sa @ref window_sizelimits |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2794 | * @sa @ref glfwSetWindowSizeLimits |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2795 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2796 | * @since Added in version 3.2. |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame] | 2797 | * |
| 2798 | * @ingroup window |
| 2799 | */ |
| 2800 | GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); |
| 2801 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2802 | /*! @brief Sets the size of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2803 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2804 | * This function sets the size, in screen coordinates, of the client area of |
| 2805 | * the specified window. |
| 2806 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2807 | * For full screen windows, this function updates the resolution of its desired |
| 2808 | * video mode and switches to the video mode closest to it, without affecting |
| 2809 | * the window's context. As the context is unaffected, the bit depths of the |
| 2810 | * framebuffer remain unchanged. |
| 2811 | * |
| 2812 | * If you wish to update the refresh rate of the desired video mode in addition |
| 2813 | * to its resolution, see @ref glfwSetWindowMonitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2814 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 2815 | * The window manager may put limits on what sizes are allowed. GLFW cannot |
| 2816 | * and should not override these limits. |
| 2817 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2818 | * @param[in] window The window to resize. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 2819 | * @param[in] width The desired width, in screen coordinates, of the window |
| 2820 | * client area. |
| 2821 | * @param[in] height The desired height, in screen coordinates, of the window |
| 2822 | * client area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2823 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2824 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2825 | * GLFW_PLATFORM_ERROR. |
| 2826 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2827 | * @remark @wayland A full screen window will not attempt to change the mode, |
| 2828 | * no matter what the requested size. |
| 2829 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2830 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2831 | * |
| 2832 | * @sa @ref window_size |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2833 | * @sa @ref glfwGetWindowSize |
| 2834 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2835 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2836 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2837 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2838 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2839 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2840 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2841 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2842 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2843 | /*! @brief Retrieves the size of the framebuffer of the specified window. |
| 2844 | * |
| 2845 | * This function retrieves the size, in pixels, of the framebuffer of the |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 2846 | * specified window. If you wish to retrieve the size of the window in screen |
| 2847 | * coordinates, see @ref glfwGetWindowSize. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2848 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2849 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2850 | * non-`NULL` size arguments will be set to zero. |
| 2851 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2852 | * @param[in] window The window whose framebuffer to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2853 | * @param[out] width Where to store the width, in pixels, of the framebuffer, |
| 2854 | * or `NULL`. |
| 2855 | * @param[out] height Where to store the height, in pixels, of the framebuffer, |
| 2856 | * or `NULL`. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2857 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2858 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2859 | * GLFW_PLATFORM_ERROR. |
| 2860 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2861 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2862 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2863 | * @sa @ref window_fbsize |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 2864 | * @sa @ref glfwSetFramebufferSizeCallback |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2865 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2866 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2867 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2868 | * @ingroup window |
| 2869 | */ |
| 2870 | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); |
| 2871 | |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2872 | /*! @brief Retrieves the size of the frame of the window. |
| 2873 | * |
| 2874 | * This function retrieves the size, in screen coordinates, of each edge of the |
| 2875 | * frame of the specified window. This size includes the title bar, if the |
| 2876 | * window has one. The size of the frame may vary depending on the |
| 2877 | * [window-related hints](@ref window_hints_wnd) used to create it. |
| 2878 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2879 | * Because this function retrieves the size of each window frame edge and not |
| 2880 | * the offset along a particular coordinate axis, the retrieved values will |
| 2881 | * always be zero or positive. |
| 2882 | * |
| 2883 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 2884 | * non-`NULL` size arguments will be set to zero. |
| 2885 | * |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2886 | * @param[in] window The window whose frame size to query. |
| 2887 | * @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] | 2888 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2889 | * @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] | 2890 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2891 | * @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] | 2892 | * right edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2893 | * @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] | 2894 | * bottom edge of the window frame, or `NULL`. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2895 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 2896 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2897 | * GLFW_PLATFORM_ERROR. |
| 2898 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2899 | * @remark @wayland The window frame is currently unimplemented, as if |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 2900 | * [GLFW_DECORATED](@ref GLFW_DECORATED_hint) was always set to `GLFW_FALSE`, |
| 2901 | * so the returned values will always be zero. |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 2902 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 2903 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2904 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2905 | * @sa @ref window_size |
| 2906 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 2907 | * @since Added in version 3.1. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2908 | * |
| 2909 | * @ingroup window |
| 2910 | */ |
| 2911 | GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); |
| 2912 | |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2913 | /*! @brief Retrieves the content scale for the specified window. |
| 2914 | * |
| 2915 | * This function retrieves the content scale for the specified window. The |
| 2916 | * content scale is the ratio between the current DPI and the platform's |
| 2917 | * default DPI. If you scale all pixel dimensions by this scale then your |
| 2918 | * content should appear at an appropriate size. This is especially important |
| 2919 | * for text and any UI elements. |
| 2920 | * |
| 2921 | * On systems where each monitors can have its own content scale, the window |
| 2922 | * content scale will depend on which monitor the system considers the window |
| 2923 | * to be on. |
| 2924 | * |
| 2925 | * @param[in] window The window to query. |
| 2926 | * @param[out] xscale Where to store the x-axis content scale, or `NULL`. |
| 2927 | * @param[out] yscale Where to store the y-axis content scale, or `NULL`. |
| 2928 | * |
| 2929 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2930 | * GLFW_PLATFORM_ERROR. |
| 2931 | * |
| 2932 | * @thread_safety This function must only be called from the main thread. |
| 2933 | * |
| 2934 | * @sa @ref window_scale |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 2935 | * @sa @ref glfwSetWindowContentScaleCallback |
Camilla Löwy | 16bf872 | 2017-08-29 19:19:00 +0200 | [diff] [blame] | 2936 | * @sa @ref glfwGetMonitorContentScale |
| 2937 | * |
| 2938 | * @since Added in version 3.3. |
| 2939 | * |
| 2940 | * @ingroup window |
| 2941 | */ |
| 2942 | GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale); |
| 2943 | |
Camilla Löwy | 11e47f0 | 2017-09-25 23:14:45 +0200 | [diff] [blame] | 2944 | /*! @brief Returns the opacity of the whole window. |
| 2945 | * |
| 2946 | * This function returns the opacity of the window, including any decorations. |
| 2947 | * |
| 2948 | * The opacity (or alpha) value is a positive finite number between zero and |
| 2949 | * one, where zero is fully transparent and one is fully opaque. If the system |
| 2950 | * does not support whole window transparency, this function always returns one. |
| 2951 | * |
| 2952 | * The initial opacity value for newly created windows is one. |
| 2953 | * |
| 2954 | * @param[in] window The window to query. |
| 2955 | * @return The opacity value of the specified window. |
| 2956 | * |
| 2957 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2958 | * GLFW_PLATFORM_ERROR. |
| 2959 | * |
| 2960 | * @thread_safety This function must only be called from the main thread. |
| 2961 | * |
| 2962 | * @sa @ref window_transparency |
| 2963 | * @sa @ref glfwSetWindowOpacity |
| 2964 | * |
| 2965 | * @since Added in version 3.3. |
| 2966 | * |
| 2967 | * @ingroup window |
| 2968 | */ |
| 2969 | GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window); |
| 2970 | |
| 2971 | /*! @brief Sets the opacity of the whole window. |
| 2972 | * |
| 2973 | * This function sets the opacity of the window, including any decorations. |
| 2974 | * |
| 2975 | * The opacity (or alpha) value is a positive finite number between zero and |
| 2976 | * one, where zero is fully transparent and one is fully opaque. |
| 2977 | * |
| 2978 | * The initial opacity value for newly created windows is one. |
| 2979 | * |
| 2980 | * A window created with framebuffer transparency may not use whole window |
| 2981 | * transparency. The results of doing this are undefined. |
| 2982 | * |
| 2983 | * @param[in] window The window to set the opacity for. |
| 2984 | * @param[in] opacity The desired opacity of the specified window. |
| 2985 | * |
| 2986 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 2987 | * GLFW_PLATFORM_ERROR. |
| 2988 | * |
| 2989 | * @thread_safety This function must only be called from the main thread. |
| 2990 | * |
| 2991 | * @sa @ref window_transparency |
| 2992 | * @sa @ref glfwGetWindowOpacity |
| 2993 | * |
| 2994 | * @since Added in version 3.3. |
| 2995 | * |
| 2996 | * @ingroup window |
| 2997 | */ |
| 2998 | GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); |
| 2999 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3000 | /*! @brief Iconifies the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3001 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3002 | * This function iconifies (minimizes) the specified window if it was |
| 3003 | * previously restored. If the window is already iconified, this function does |
| 3004 | * nothing. |
| 3005 | * |
| 3006 | * If the specified window is a full screen window, the original monitor |
| 3007 | * resolution is restored until the window is restored. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3008 | * |
| 3009 | * @param[in] window The window to iconify. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3010 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3011 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3012 | * GLFW_PLATFORM_ERROR. |
| 3013 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3014 | * @remark @wayland There is no concept of iconification in wl_shell, this |
| 3015 | * function will always emit @ref GLFW_PLATFORM_ERROR. |
| 3016 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3017 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3018 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3019 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3020 | * @sa @ref glfwRestoreWindow |
| 3021 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3022 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3023 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3024 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3025 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3026 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3027 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3028 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3029 | |
| 3030 | /*! @brief Restores the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3031 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3032 | * This function restores the specified window if it was previously iconified |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3033 | * (minimized) or maximized. If the window is already restored, this function |
| 3034 | * does nothing. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3035 | * |
| 3036 | * If the specified window is a full screen window, the resolution chosen for |
| 3037 | * the window is restored on the selected monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3038 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3039 | * @param[in] window The window to restore. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3040 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3041 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3042 | * GLFW_PLATFORM_ERROR. |
| 3043 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3044 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3045 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3046 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3047 | * @sa @ref glfwIconifyWindow |
| 3048 | * @sa @ref glfwMaximizeWindow |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3049 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3050 | * @since Added in version 2.1. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3051 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3052 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3053 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3054 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3055 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3056 | |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3057 | /*! @brief Maximizes the specified window. |
| 3058 | * |
| 3059 | * This function maximizes the specified window if it was previously not |
| 3060 | * maximized. If the window is already maximized, this function does nothing. |
| 3061 | * |
| 3062 | * If the specified window is a full screen window, this function does nothing. |
| 3063 | * |
| 3064 | * @param[in] window The window to maximize. |
| 3065 | * |
Camilla Berglund | f5b71f5 | 2016-05-27 14:20:39 +0200 | [diff] [blame] | 3066 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3067 | * GLFW_PLATFORM_ERROR. |
| 3068 | * |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3069 | * @par Thread Safety |
| 3070 | * This function may only be called from the main thread. |
| 3071 | * |
| 3072 | * @sa @ref window_iconify |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3073 | * @sa @ref glfwIconifyWindow |
| 3074 | * @sa @ref glfwRestoreWindow |
Camilla Berglund | a10caa4 | 2015-10-13 12:50:59 +0200 | [diff] [blame] | 3075 | * |
| 3076 | * @since Added in GLFW 3.2. |
| 3077 | * |
| 3078 | * @ingroup window |
| 3079 | */ |
| 3080 | GLFWAPI void glfwMaximizeWindow(GLFWwindow* window); |
| 3081 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3082 | /*! @brief Makes the specified window visible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3083 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3084 | * This function makes the specified window visible if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3085 | * 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] | 3086 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3087 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3088 | * @param[in] window The window to make visible. |
| 3089 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3090 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3091 | * GLFW_PLATFORM_ERROR. |
| 3092 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3093 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3094 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3095 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3096 | * @sa @ref glfwHideWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3097 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3098 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3099 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3100 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3101 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3102 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3103 | |
| 3104 | /*! @brief Hides the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3105 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3106 | * This function hides the specified window if it was previously visible. If |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3107 | * 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] | 3108 | * nothing. |
| 3109 | * |
| 3110 | * @param[in] window The window to hide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3111 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3112 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3113 | * GLFW_PLATFORM_ERROR. |
| 3114 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3115 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3116 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3117 | * @sa @ref window_hide |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3118 | * @sa @ref glfwShowWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3119 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3120 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3121 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3122 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3123 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3124 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3125 | |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3126 | /*! @brief Brings the specified window to front and sets input focus. |
| 3127 | * |
| 3128 | * This function brings the specified window to front and sets input focus. |
| 3129 | * The window should already be visible and not iconified. |
| 3130 | * |
| 3131 | * 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] | 3132 | * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to |
| 3133 | * disable this behavior. |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3134 | * |
| 3135 | * __Do not use this function__ to steal focus from other applications unless |
| 3136 | * you are certain that is what the user wants. Focus stealing can be |
| 3137 | * extremely disruptive. |
| 3138 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3139 | * For a less disruptive way of getting the user's attention, see |
| 3140 | * [attention requests](@ref window_attention). |
| 3141 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3142 | * @param[in] window The window to give input focus. |
| 3143 | * |
| 3144 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3145 | * GLFW_PLATFORM_ERROR. |
| 3146 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3147 | * @remark @wayland It is not possible for an application to bring its windows |
| 3148 | * to front, this function will always emit @ref GLFW_PLATFORM_ERROR. |
| 3149 | * |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3150 | * @thread_safety This function must only be called from the main thread. |
| 3151 | * |
| 3152 | * @sa @ref window_focus |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3153 | * @sa @ref window_attention |
Camilla Berglund | baf5744 | 2016-02-21 15:42:49 +0100 | [diff] [blame] | 3154 | * |
| 3155 | * @since Added in version 3.2. |
| 3156 | * |
| 3157 | * @ingroup window |
| 3158 | */ |
| 3159 | GLFWAPI void glfwFocusWindow(GLFWwindow* window); |
| 3160 | |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3161 | /*! @brief Requests user attention to the specified window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3162 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3163 | * This function requests user attention to the specified window. On |
| 3164 | * platforms where this is not supported, attention is requested to the |
| 3165 | * application as a whole. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3166 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3167 | * Once the user has given attention, usually by focusing the window or |
| 3168 | * application, the system will end the request automatically. |
| 3169 | * |
| 3170 | * @param[in] window The window to request attention to. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3171 | * |
| 3172 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3173 | * GLFW_PLATFORM_ERROR. |
| 3174 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3175 | * @remark @macos Attention is requested to the application as a whole, not the |
| 3176 | * specific window. |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3177 | * |
| 3178 | * @thread_safety This function must only be called from the main thread. |
| 3179 | * |
Camilla Löwy | baa9cd8 | 2017-05-11 14:36:56 +0200 | [diff] [blame] | 3180 | * @sa @ref window_attention |
| 3181 | * |
Felipe Ferreira da Silva | 412eb6a | 2017-03-21 10:02:57 -0300 | [diff] [blame] | 3182 | * @since Added in version 3.3. |
| 3183 | * |
| 3184 | * @ingroup window |
| 3185 | */ |
| 3186 | GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window); |
| 3187 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3188 | /*! @brief Returns the monitor that the window uses for full screen mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3189 | * |
| 3190 | * 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] | 3191 | * in full screen on. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3192 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 3193 | * @param[in] window The window to query. |
Camilla Berglund | 999f355 | 2016-08-17 16:48:22 +0200 | [diff] [blame] | 3194 | * @return The monitor, or `NULL` if the window is in windowed mode or an |
| 3195 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3196 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3197 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3198 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3199 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3200 | * |
| 3201 | * @sa @ref window_monitor |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3202 | * @sa @ref glfwSetWindowMonitor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3203 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3204 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3205 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 3206 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3207 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3208 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 3209 | |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3210 | /*! @brief Sets the mode, monitor, video mode and placement of a window. |
| 3211 | * |
| 3212 | * This function sets the monitor that the window uses for full screen mode or, |
| 3213 | * if the monitor is `NULL`, makes it windowed mode. |
| 3214 | * |
| 3215 | * When setting a monitor, this function updates the width, height and refresh |
| 3216 | * rate of the desired video mode and switches to the video mode closest to it. |
| 3217 | * The window position is ignored when setting a monitor. |
| 3218 | * |
| 3219 | * When the monitor is `NULL`, the position, width and height are used to |
| 3220 | * place the window client area. The refresh rate is ignored when no monitor |
| 3221 | * is specified. |
| 3222 | * |
| 3223 | * If you only wish to update the resolution of a full screen window or the |
| 3224 | * size of a windowed mode window, see @ref glfwSetWindowSize. |
| 3225 | * |
| 3226 | * When a window transitions from full screen to windowed mode, this function |
| 3227 | * restores any previous window settings such as whether it is decorated, |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3228 | * floating, resizable, has size or aspect ratio limits, etc. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3229 | * |
| 3230 | * @param[in] window The window whose monitor, size or video mode to set. |
| 3231 | * @param[in] monitor The desired monitor, or `NULL` to set windowed mode. |
| 3232 | * @param[in] xpos The desired x-coordinate of the upper-left corner of the |
| 3233 | * client area. |
| 3234 | * @param[in] ypos The desired y-coordinate of the upper-left corner of the |
| 3235 | * client area. |
| 3236 | * @param[in] width The desired with, in screen coordinates, of the client area |
| 3237 | * or video mode. |
| 3238 | * @param[in] height The desired height, in screen coordinates, of the client |
| 3239 | * area or video mode. |
Camilla Berglund | 325729d | 2016-05-22 14:25:04 +0200 | [diff] [blame] | 3240 | * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode, |
| 3241 | * or `GLFW_DONT_CARE`. |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3242 | * |
| 3243 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3244 | * GLFW_PLATFORM_ERROR. |
| 3245 | * |
Camilla Berglund | ec17161 | 2016-10-28 06:20:20 +0200 | [diff] [blame] | 3246 | * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise |
| 3247 | * affected by any resizing or mode switching, although you may need to update |
| 3248 | * your viewport if the framebuffer size has changed. |
| 3249 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3250 | * @remark @wayland The desired window position is ignored, as there is no way |
| 3251 | * for an application to set this property. |
| 3252 | * |
| 3253 | * @remark @wayland Setting the window to full screen will not attempt to |
| 3254 | * change the mode, no matter what the requested size or refresh rate. |
| 3255 | * |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3256 | * @thread_safety This function must only be called from the main thread. |
| 3257 | * |
| 3258 | * @sa @ref window_monitor |
| 3259 | * @sa @ref window_full_screen |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3260 | * @sa @ref glfwGetWindowMonitor |
| 3261 | * @sa @ref glfwSetWindowSize |
Camilla Berglund | 6570d0c | 2016-02-23 12:26:42 +0100 | [diff] [blame] | 3262 | * |
| 3263 | * @since Added in version 3.2. |
| 3264 | * |
| 3265 | * @ingroup window |
| 3266 | */ |
| 3267 | GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); |
| 3268 | |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 3269 | /*! @brief Returns an attribute of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3270 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3271 | * This function returns the value of an attribute of the specified window or |
| 3272 | * its OpenGL or OpenGL ES context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3273 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3274 | * @param[in] window The window to query. |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 3275 | * @param[in] attrib The [window attribute](@ref window_attribs) whose value to |
| 3276 | * return. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3277 | * @return The value of the attribute, or zero if an |
| 3278 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 3279 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3280 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3281 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 3282 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3283 | * @remark Framebuffer related hints are not window attributes. See @ref |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 3284 | * window_attribs_fb for more information. |
| 3285 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3286 | * @remark Zero is a valid value for many window and context related |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 3287 | * attributes so you cannot use a return value of zero as an indication of |
| 3288 | * errors. However, this function should not fail as long as it is passed |
| 3289 | * valid arguments and the library has been [initialized](@ref intro_init). |
| 3290 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3291 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3292 | * |
| 3293 | * @sa @ref window_attribs |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3294 | * @sa @ref glfwSetWindowAttrib |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3295 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3296 | * @since Added in version 3.0. Replaces `glfwGetWindowParam` and |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3297 | * `glfwGetGLVersion`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3298 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3299 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3300 | */ |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 3301 | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3302 | |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3303 | /*! @brief Sets an attribute of the specified window. |
| 3304 | * |
| 3305 | * This function sets the value of an attribute of the specified window. |
| 3306 | * |
| 3307 | * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), |
| 3308 | * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), |
| 3309 | * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) and |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 3310 | * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib). |
Camilla Löwy | 9e56099 | 2016-09-30 01:52:22 +0200 | [diff] [blame] | 3311 | * |
| 3312 | * Some of these attributes are ignored for full screen windows. The new |
| 3313 | * value will take effect if the window is later made windowed. |
| 3314 | * |
| 3315 | * Some of these attributes are ignored for windowed mode windows. The new |
| 3316 | * value will take effect if the window is later made full screen. |
| 3317 | * |
| 3318 | * @param[in] window The window to set the attribute for. |
| 3319 | * @param[in] attrib A supported window attribute. |
| 3320 | * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`. |
| 3321 | * |
| 3322 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3323 | * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. |
| 3324 | * |
| 3325 | * @remark Calling @ref glfwGetWindowAttrib will always return the latest |
| 3326 | * value, even if that value is ignored by the current mode of the window. |
| 3327 | * |
| 3328 | * @thread_safety This function must only be called from the main thread. |
| 3329 | * |
| 3330 | * @sa @ref window_attribs |
| 3331 | * @sa @ref glfwGetWindowAttrib |
| 3332 | * |
| 3333 | * @since Added in version 3.3. |
| 3334 | * |
| 3335 | * @ingroup window |
| 3336 | */ |
| 3337 | GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value); |
| 3338 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3339 | /*! @brief Sets the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3340 | * |
| 3341 | * This function sets the user-defined pointer of the specified window. The |
| 3342 | * current value is retained until the window is destroyed. The initial value |
| 3343 | * is `NULL`. |
| 3344 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3345 | * @param[in] window The window whose pointer to set. |
| 3346 | * @param[in] pointer The new value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +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. |
| 3349 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3350 | * @thread_safety This function may be called from any thread. Access is not |
| 3351 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3352 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3353 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3354 | * @sa @ref glfwGetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3355 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3356 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3357 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3358 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3359 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3360 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3361 | |
| 3362 | /*! @brief Returns the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3363 | * |
| 3364 | * This function returns the current value of the user-defined pointer of the |
| 3365 | * specified window. The initial value is `NULL`. |
| 3366 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3367 | * @param[in] window The window whose pointer to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3368 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3369 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3370 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3371 | * @thread_safety This function may be called from any thread. Access is not |
| 3372 | * synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3373 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3374 | * @sa @ref window_userptr |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3375 | * @sa @ref glfwSetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3376 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3377 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3378 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3379 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3380 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3381 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3382 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3383 | /*! @brief Sets the position callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3384 | * |
| 3385 | * 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] | 3386 | * called when the window is moved. The callback is provided with the |
| 3387 | * position, in screen coordinates, of the upper-left corner of the client area |
| 3388 | * of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3389 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3390 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3391 | * @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] | 3392 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3393 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3394 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3395 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3396 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3397 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3398 | * @remark @wayland This callback will never be called, as there is no way for |
| 3399 | * an application to know its global position. |
| 3400 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3401 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3402 | * |
| 3403 | * @sa @ref window_pos |
| 3404 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3405 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3406 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3407 | * @ingroup window |
| 3408 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3409 | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 3410 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3411 | /*! @brief Sets the size callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3412 | * |
| 3413 | * This function sets the size callback of the specified window, which is |
| 3414 | * called when the window is resized. The callback is provided with the size, |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3415 | * in screen coordinates, of the client area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3416 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3417 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3418 | * @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] | 3419 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3420 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3421 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3422 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3423 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3424 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3425 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3426 | * |
| 3427 | * @sa @ref window_size |
| 3428 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3429 | * @since Added in version 1.0. |
| 3430 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3431 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3432 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3433 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3434 | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3435 | |
| 3436 | /*! @brief Sets the close callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3437 | * |
| 3438 | * This function sets the close callback of the specified window, which is |
| 3439 | * called when the user attempts to close the window, for example by clicking |
| 3440 | * the close widget in the title bar. |
| 3441 | * |
| 3442 | * The close flag is set before this callback is called, but you can modify it |
| 3443 | * at any time with @ref glfwSetWindowShouldClose. |
| 3444 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3445 | * The close callback is not triggered by @ref glfwDestroyWindow. |
| 3446 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3447 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3448 | * @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] | 3449 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3450 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3451 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3452 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3453 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3454 | * |
Camilla Berglund | 8d6f265 | 2016-10-20 00:50:54 +0200 | [diff] [blame] | 3455 | * @remark @macos Selecting Quit from the application menu will trigger the |
| 3456 | * close callback for all windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3457 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3458 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3459 | * |
| 3460 | * @sa @ref window_close |
| 3461 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3462 | * @since Added in version 2.5. |
| 3463 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3464 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3465 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3466 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3467 | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3468 | |
| 3469 | /*! @brief Sets the refresh callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3470 | * |
| 3471 | * This function sets the refresh callback of the specified window, which is |
| 3472 | * called when the client area of the window needs to be redrawn, for example |
| 3473 | * if the window has been exposed after having been covered by another window. |
| 3474 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3475 | * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where |
| 3476 | * the window contents are saved off-screen, this callback may be called only |
| 3477 | * very infrequently or never at all. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3478 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3479 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3480 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3481 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3482 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3483 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3484 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3485 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3486 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3487 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3488 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3489 | * @sa @ref window_refresh |
| 3490 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3491 | * @since Added in version 2.5. |
| 3492 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 3493 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3494 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3495 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3496 | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3497 | |
| 3498 | /*! @brief Sets the focus callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3499 | * |
| 3500 | * This function sets the focus callback of the specified window, which is |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3501 | * called when the window gains or loses input focus. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3502 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3503 | * After the focus callback is called for a window that lost input focus, |
| 3504 | * synthetic key and mouse button release events will be generated for all such |
| 3505 | * that had been pressed. For more information, see @ref glfwSetKeyCallback |
| 3506 | * and @ref glfwSetMouseButtonCallback. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 3507 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3508 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3509 | * @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] | 3510 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3511 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3512 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3513 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3514 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3515 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3516 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3517 | * |
| 3518 | * @sa @ref window_focus |
| 3519 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3520 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3521 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3522 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3523 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3524 | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3525 | |
| 3526 | /*! @brief Sets the iconify callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3527 | * |
| 3528 | * This function sets the iconification callback of the specified window, which |
| 3529 | * is called when the window is iconified or restored. |
| 3530 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3531 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3532 | * @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] | 3533 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3534 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3535 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3536 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3537 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3538 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 3539 | * @remark @wayland The wl_shell protocol has no concept of iconification, |
| 3540 | * this callback will never be called. |
| 3541 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3542 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3543 | * |
| 3544 | * @sa @ref window_iconify |
| 3545 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3546 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3547 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3548 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3549 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3550 | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 3551 | |
Camilla Berglund | c156b50 | 2016-06-16 13:09:28 +0200 | [diff] [blame] | 3552 | /*! @brief Sets the maximize callback for the specified window. |
| 3553 | * |
| 3554 | * This function sets the maximization callback of the specified window, which |
| 3555 | * is called when the window is maximized or restored. |
| 3556 | * |
| 3557 | * @param[in] window The window whose callback to set. |
| 3558 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3559 | * callback. |
| 3560 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3561 | * library had not been [initialized](@ref intro_init). |
| 3562 | * |
| 3563 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3564 | * |
| 3565 | * @thread_safety This function must only be called from the main thread. |
| 3566 | * |
| 3567 | * @sa @ref window_maximize |
| 3568 | * |
| 3569 | * @since Added in version 3.3. |
| 3570 | * |
| 3571 | * @ingroup window |
| 3572 | */ |
| 3573 | GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun); |
| 3574 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3575 | /*! @brief Sets the framebuffer resize callback for the specified window. |
| 3576 | * |
| 3577 | * This function sets the framebuffer resize callback of the specified window, |
| 3578 | * which is called when the framebuffer of the specified window is resized. |
| 3579 | * |
| 3580 | * @param[in] window The window whose callback to set. |
| 3581 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3582 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3583 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3584 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3585 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3586 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3587 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3588 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3589 | * |
| 3590 | * @sa @ref window_fbsize |
| 3591 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3592 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3593 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 3594 | * @ingroup window |
| 3595 | */ |
| 3596 | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun); |
| 3597 | |
Camilla Löwy | 370eac3 | 2017-12-11 21:26:40 +0100 | [diff] [blame] | 3598 | /*! @brief Sets the window content scale callback for the specified window. |
| 3599 | * |
| 3600 | * This function sets the window content scale callback of the specified window, |
| 3601 | * which is called when the content scale of the specified window changes. |
| 3602 | * |
| 3603 | * @param[in] window The window whose callback to set. |
| 3604 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 3605 | * callback. |
| 3606 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3607 | * library had not been [initialized](@ref intro_init). |
| 3608 | * |
| 3609 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 3610 | * |
| 3611 | * @thread_safety This function must only be called from the main thread. |
| 3612 | * |
| 3613 | * @sa @ref window_scale |
| 3614 | * @sa @ref glfwGetWindowContentScale |
| 3615 | * |
| 3616 | * @since Added in version 3.3. |
| 3617 | * |
| 3618 | * @ingroup window |
| 3619 | */ |
| 3620 | GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun cbfun); |
| 3621 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3622 | /*! @brief Processes all pending events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3623 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3624 | * This function processes only those events that are already in the event |
| 3625 | * queue and then returns immediately. Processing events will cause the window |
| 3626 | * and input callbacks associated with those events to be called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3627 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3628 | * On some platforms, a window move, resize or menu operation will cause event |
| 3629 | * processing to block. This is due to how event processing is designed on |
| 3630 | * those platforms. You can use the |
| 3631 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3632 | * your window when necessary during such operations. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3633 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3634 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3635 | * event processing functions like this one. While it is necessary to poll for |
| 3636 | * events, window systems that require GLFW to register callbacks of its own |
| 3637 | * can pass events to GLFW in response to many window system function calls. |
| 3638 | * GLFW will pass those events on to the application callbacks before |
| 3639 | * returning. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 3640 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3641 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3642 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3643 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3644 | * GLFW_PLATFORM_ERROR. |
| 3645 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3646 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 3647 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3648 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 3649 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3650 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3651 | * @sa @ref glfwWaitEvents |
| 3652 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3653 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3654 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3655 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3656 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3657 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 3658 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3659 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3660 | /*! @brief Waits until events are queued and processes them. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3661 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3662 | * This function puts the calling thread to sleep until at least one event is |
| 3663 | * available in the event queue. Once one or more events are available, |
| 3664 | * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue |
| 3665 | * are processed and the function then returns immediately. Processing events |
| 3666 | * will cause the window and input callbacks associated with those events to be |
| 3667 | * called. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 3668 | * |
| 3669 | * Since not all events are associated with callbacks, this function may return |
| 3670 | * without a callback having been called even if you are monitoring all |
| 3671 | * callbacks. |
| 3672 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3673 | * On some platforms, a window move, resize or menu operation will cause event |
| 3674 | * processing to block. This is due to how event processing is designed on |
| 3675 | * those platforms. You can use the |
| 3676 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3677 | * your window when necessary during such operations. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3678 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3679 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3680 | * event processing functions like this one. While it is necessary to poll for |
| 3681 | * events, window systems that require GLFW to register callbacks of its own |
| 3682 | * can pass events to GLFW in response to many window system function calls. |
| 3683 | * GLFW will pass those events on to the application callbacks before |
| 3684 | * returning. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3685 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3686 | * If no windows exist, this function returns immediately. For synchronization |
| 3687 | * of threads in applications that do not create windows, use your threading |
| 3688 | * library of choice. |
Camilla Berglund | 2ae46fa | 2013-12-04 19:12:24 +0100 | [diff] [blame] | 3689 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3690 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 3691 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3692 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3693 | * GLFW_PLATFORM_ERROR. |
| 3694 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3695 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 3696 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3697 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3698 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3699 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3700 | * @sa @ref glfwPollEvents |
| 3701 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3702 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3703 | * @since Added in version 2.5. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3704 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3705 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3706 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 3707 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 3708 | |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3709 | /*! @brief Waits with timeout until events are queued and processes them. |
| 3710 | * |
| 3711 | * This function puts the calling thread to sleep until at least one event is |
| 3712 | * available in the event queue, or until the specified timeout is reached. If |
| 3713 | * one or more events are available, it behaves exactly like @ref |
| 3714 | * glfwPollEvents, i.e. the events in the queue are processed and the function |
| 3715 | * then returns immediately. Processing events will cause the window and input |
| 3716 | * callbacks associated with those events to be called. |
| 3717 | * |
| 3718 | * The timeout value must be a positive finite number. |
| 3719 | * |
| 3720 | * Since not all events are associated with callbacks, this function may return |
| 3721 | * without a callback having been called even if you are monitoring all |
| 3722 | * callbacks. |
| 3723 | * |
| 3724 | * On some platforms, a window move, resize or menu operation will cause event |
| 3725 | * processing to block. This is due to how event processing is designed on |
| 3726 | * those platforms. You can use the |
| 3727 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 3728 | * your window when necessary during such operations. |
| 3729 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3730 | * Do not assume that callbacks you set will _only_ be called in response to |
| 3731 | * event processing functions like this one. While it is necessary to poll for |
| 3732 | * events, window systems that require GLFW to register callbacks of its own |
| 3733 | * can pass events to GLFW in response to many window system function calls. |
| 3734 | * GLFW will pass those events on to the application callbacks before |
| 3735 | * returning. |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3736 | * |
| 3737 | * If no windows exist, this function returns immediately. For synchronization |
| 3738 | * of threads in applications that do not create windows, use your threading |
| 3739 | * library of choice. |
| 3740 | * |
| 3741 | * Event processing is not required for joystick input to work. |
| 3742 | * |
| 3743 | * @param[in] timeout The maximum amount of time, in seconds, to wait. |
| 3744 | * |
| 3745 | * @reentrancy This function must not be called from a callback. |
| 3746 | * |
| 3747 | * @thread_safety This function must only be called from the main thread. |
| 3748 | * |
| 3749 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3750 | * @sa @ref glfwPollEvents |
| 3751 | * @sa @ref glfwWaitEvents |
Camilla Berglund | 5620895 | 2016-02-02 21:11:16 +0100 | [diff] [blame] | 3752 | * |
| 3753 | * @since Added in version 3.2. |
| 3754 | * |
| 3755 | * @ingroup window |
| 3756 | */ |
| 3757 | GLFWAPI void glfwWaitEventsTimeout(double timeout); |
| 3758 | |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3759 | /*! @brief Posts an empty event to the event queue. |
| 3760 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3761 | * 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] | 3762 | * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3763 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3764 | * If no windows exist, this function returns immediately. For synchronization |
| 3765 | * of threads in applications that do not create windows, use your threading |
| 3766 | * library of choice. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3767 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3768 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3769 | * GLFW_PLATFORM_ERROR. |
| 3770 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3771 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3772 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3773 | * @sa @ref events |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3774 | * @sa @ref glfwWaitEvents |
| 3775 | * @sa @ref glfwWaitEventsTimeout |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3776 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3777 | * @since Added in version 3.1. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3778 | * |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 3779 | * @ingroup window |
| 3780 | */ |
| 3781 | GLFWAPI void glfwPostEmptyEvent(void); |
| 3782 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3783 | /*! @brief Returns the value of an input option for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3784 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3785 | * 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] | 3786 | * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, |
| 3787 | * @ref GLFW_STICKY_MOUSE_BUTTONS or @ref GLFW_LOCK_KEY_MODS. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3788 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3789 | * @param[in] window The window to query. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3790 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
| 3791 | * `GLFW_STICKY_MOUSE_BUTTONS` or `GLFW_LOCK_KEY_MODS`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3792 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3793 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3794 | * GLFW_INVALID_ENUM. |
| 3795 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3796 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3797 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3798 | * @sa @ref glfwSetInputMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3799 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3800 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3801 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3802 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3803 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3804 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3805 | |
| 3806 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3807 | * |
| 3808 | * 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] | 3809 | * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS, |
| 3810 | * @ref GLFW_STICKY_MOUSE_BUTTONS or @ref GLFW_LOCK_KEY_MODS. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3811 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3812 | * 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] | 3813 | * modes: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 3814 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
| 3815 | * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3816 | * area of the window but does not restrict the cursor from leaving. |
Camilla Berglund | a18b187 | 2013-12-05 03:27:12 +0100 | [diff] [blame] | 3817 | * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual |
| 3818 | * and unlimited cursor movement. This is useful for implementing for |
| 3819 | * example 3D camera controls. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3820 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 3821 | * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to |
| 3822 | * 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] | 3823 | * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` |
| 3824 | * the next time it is called even if the key had been released before the |
| 3825 | * call. This is useful when you are only interested in whether keys have been |
| 3826 | * pressed but not when or in which order. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3827 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3828 | * 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] | 3829 | * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. |
| 3830 | * If sticky mouse buttons are enabled, a mouse button press will ensure that |
| 3831 | * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even |
| 3832 | * if the mouse button had been released before the call. This is useful when |
| 3833 | * you are only interested in whether mouse buttons have been pressed but not |
| 3834 | * when or in which order. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3835 | * |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3836 | * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to |
| 3837 | * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled, |
| 3838 | * callbacks that receive modifier bits will also have the @ref |
| 3839 | * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on, |
| 3840 | * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on. |
| 3841 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3842 | * @param[in] window The window whose input mode to set. |
Camilla Löwy | 0e8c4ea | 2017-11-29 20:42:37 +0100 | [diff] [blame] | 3843 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`, |
| 3844 | * `GLFW_STICKY_MOUSE_BUTTONS` or `GLFW_LOCK_KEY_MODS`. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3845 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 3846 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3847 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3848 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 3849 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3850 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3851 | * |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 3852 | * @sa @ref glfwGetInputMode |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3853 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3854 | * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3855 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3856 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3857 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3858 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3859 | |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 3860 | /*! @brief Returns the layout-specific name of the specified printable key. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3861 | * |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 3862 | * This function returns the name of the specified printable key, encoded as |
| 3863 | * UTF-8. This is typically the character that key would produce without any |
| 3864 | * modifier keys, intended for displaying key bindings to the user. For dead |
| 3865 | * keys, it is typically the diacritic it would add to a character. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3866 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 3867 | * __Do not use this function__ for [text input](@ref input_char). You will |
| 3868 | * 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] | 3869 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 3870 | * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key, |
| 3871 | * otherwise the scancode is ignored. If you specify a non-printable key, or |
| 3872 | * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this |
| 3873 | * function returns `NULL` but does not emit an error. |
| 3874 | * |
| 3875 | * This behavior allows you to always pass in the arguments in the |
Camilla Berglund | 70ffae7 | 2016-02-22 11:54:56 +0100 | [diff] [blame] | 3876 | * [key callback](@ref input_key) without modification. |
| 3877 | * |
| 3878 | * The printable keys are: |
| 3879 | * - `GLFW_KEY_APOSTROPHE` |
| 3880 | * - `GLFW_KEY_COMMA` |
| 3881 | * - `GLFW_KEY_MINUS` |
| 3882 | * - `GLFW_KEY_PERIOD` |
| 3883 | * - `GLFW_KEY_SLASH` |
| 3884 | * - `GLFW_KEY_SEMICOLON` |
| 3885 | * - `GLFW_KEY_EQUAL` |
| 3886 | * - `GLFW_KEY_LEFT_BRACKET` |
| 3887 | * - `GLFW_KEY_RIGHT_BRACKET` |
| 3888 | * - `GLFW_KEY_BACKSLASH` |
| 3889 | * - `GLFW_KEY_WORLD_1` |
| 3890 | * - `GLFW_KEY_WORLD_2` |
| 3891 | * - `GLFW_KEY_0` to `GLFW_KEY_9` |
| 3892 | * - `GLFW_KEY_A` to `GLFW_KEY_Z` |
| 3893 | * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9` |
| 3894 | * - `GLFW_KEY_KP_DECIMAL` |
| 3895 | * - `GLFW_KEY_KP_DIVIDE` |
| 3896 | * - `GLFW_KEY_KP_MULTIPLY` |
| 3897 | * - `GLFW_KEY_KP_SUBTRACT` |
| 3898 | * - `GLFW_KEY_KP_ADD` |
| 3899 | * - `GLFW_KEY_KP_EQUAL` |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3900 | * |
Camilla Löwy | 071a049 | 2017-02-28 22:29:10 +0100 | [diff] [blame] | 3901 | * Names for printable keys depend on keyboard layout, while names for |
| 3902 | * non-printable keys are the same across layouts but depend on the application |
| 3903 | * language and should be localized along with other user interface text. |
| 3904 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3905 | * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`. |
| 3906 | * @param[in] scancode The scancode of the key to query. |
Camilla Löwy | 9558b85 | 2017-04-04 18:05:36 +0200 | [diff] [blame] | 3907 | * @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] | 3908 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3909 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3910 | * GLFW_PLATFORM_ERROR. |
| 3911 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3912 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 3913 | * should not free it yourself. It is valid until the next call to @ref |
| 3914 | * glfwGetKeyName, or until the library is terminated. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3915 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3916 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3917 | * |
| 3918 | * @sa @ref input_key_name |
| 3919 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3920 | * @since Added in version 3.2. |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3921 | * |
| 3922 | * @ingroup input |
| 3923 | */ |
| 3924 | GLFWAPI const char* glfwGetKeyName(int key, int scancode); |
| 3925 | |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3926 | /*! @brief Returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 3927 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3928 | * This function returns the platform-specific scancode of the specified key. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 3929 | * |
| 3930 | * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this |
| 3931 | * method will return `-1`. |
| 3932 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3933 | * @param[in] key Any [named key](@ref keys). |
| 3934 | * @return The platform-specific scancode for the key, or `-1` if an |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 3935 | * [error](@ref error_handling) occurred. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 3936 | * |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 3937 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 3938 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 3939 | * |
| 3940 | * @thread_safety This function may be called from any thread. |
| 3941 | * |
Camilla Löwy | 766a9dc | 2016-12-06 23:26:53 +0100 | [diff] [blame] | 3942 | * @sa @ref input_key |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 3943 | * |
| 3944 | * @since Added in version 3.3. |
| 3945 | * |
| 3946 | * @ingroup input |
| 3947 | */ |
Camilla Berglund | bb3cb8f | 2016-09-06 15:40:31 +0200 | [diff] [blame] | 3948 | GLFWAPI int glfwGetKeyScancode(int key); |
Michael Stocker | e745b0d | 2016-08-11 19:11:40 +0200 | [diff] [blame] | 3949 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3950 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 3951 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3952 | * |
| 3953 | * This function returns the last state reported for the specified key to the |
| 3954 | * specified window. The returned state is one of `GLFW_PRESS` or |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3955 | * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3956 | * the key callback. |
| 3957 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 3958 | * 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] | 3959 | * `GLFW_PRESS` the first time you call it for a key that was pressed, even if |
| 3960 | * that key has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3961 | * |
| 3962 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 3963 | * named after their use on the standard US keyboard layout. If you want to |
| 3964 | * input text, use the Unicode character callback instead. |
| 3965 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3966 | * The [modifier key bit masks](@ref mods) are not key tokens and cannot be |
| 3967 | * used with this function. |
| 3968 | * |
Camilla Berglund | 9c31541 | 2015-07-02 14:24:50 +0200 | [diff] [blame] | 3969 | * __Do not use this function__ to implement [text input](@ref input_char). |
| 3970 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3971 | * @param[in] window The desired window. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3972 | * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is |
| 3973 | * not a valid key for this function. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3974 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3975 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 3976 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 3977 | * GLFW_INVALID_ENUM. |
| 3978 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3979 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3980 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3981 | * @sa @ref input_key |
| 3982 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 3983 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 3984 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 3985 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3986 | * @ingroup input |
| 3987 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3988 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3989 | |
| 3990 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 3991 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3992 | * |
| 3993 | * This function returns the last state reported for the specified mouse button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3994 | * 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] | 3995 | * `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3996 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 3997 | * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3998 | * `GLFW_PRESS` the first time you call it for a mouse button that was pressed, |
| 3999 | * even if that mouse button has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4000 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4001 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4002 | * @param[in] button The desired [mouse button](@ref buttons). |
| 4003 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4004 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4005 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4006 | * GLFW_INVALID_ENUM. |
| 4007 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4008 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4009 | * |
| 4010 | * @sa @ref input_mouse_button |
| 4011 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4012 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4013 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4014 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4015 | * @ingroup input |
| 4016 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4017 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4018 | |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 4019 | /*! @brief Retrieves the position of the cursor relative to the client area of |
| 4020 | * the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4021 | * |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 4022 | * This function returns the position of the cursor, in screen coordinates, |
| 4023 | * relative to the upper-left corner of the client area of the specified |
| 4024 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4025 | * |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4026 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
| 4027 | * position is unbounded and limited only by the minimum and maximum values of |
| 4028 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4029 | * |
Camilla Berglund | 3ec2925 | 2013-04-25 18:03:15 +0200 | [diff] [blame] | 4030 | * The coordinate can be converted to their integer equivalents with the |
| 4031 | * `floor` function. Casting directly to an integer type works for positive |
| 4032 | * coordinates, but fails for negative ones. |
| 4033 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4034 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 4035 | * non-`NULL` position arguments will be set to zero. |
| 4036 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4037 | * @param[in] window The desired window. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4038 | * @param[out] xpos Where to store the cursor x-coordinate, relative to the |
| 4039 | * left edge of the client area, or `NULL`. |
| 4040 | * @param[out] ypos Where to store the cursor y-coordinate, relative to the to |
| 4041 | * top edge of the client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4042 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4043 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4044 | * GLFW_PLATFORM_ERROR. |
| 4045 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4046 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4047 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4048 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4049 | * @sa @ref glfwSetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4050 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4051 | * @since Added in version 3.0. Replaces `glfwGetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4052 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4053 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4054 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4055 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4056 | |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 4057 | /*! @brief Sets the position of the cursor, relative to the client area of the |
| 4058 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4059 | * |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 4060 | * This function sets the position, in screen coordinates, of the cursor |
| 4061 | * relative to the upper-left corner of the client area of the specified |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4062 | * window. The window must have input focus. If the window does not have |
| 4063 | * input focus when this function is called, it fails silently. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4064 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 4065 | * __Do not use this function__ to implement things like camera controls. GLFW |
| 4066 | * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the |
| 4067 | * cursor, transparently re-centers it and provides unconstrained cursor |
| 4068 | * motion. See @ref glfwSetInputMode for more information. |
| 4069 | * |
| 4070 | * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is |
| 4071 | * unconstrained and limited only by the minimum and maximum values of |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 4072 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4073 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4074 | * @param[in] window The desired window. |
| 4075 | * @param[in] xpos The desired x-coordinate, relative to the left edge of the |
Camilla Berglund | bb55816 | 2013-09-09 23:31:59 +0200 | [diff] [blame] | 4076 | * client area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4077 | * @param[in] ypos The desired y-coordinate, relative to the top edge of the |
Camilla Berglund | bb55816 | 2013-09-09 23:31:59 +0200 | [diff] [blame] | 4078 | * client area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4079 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4080 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4081 | * GLFW_PLATFORM_ERROR. |
| 4082 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4083 | * @remark @wayland This function will only work when the cursor mode is |
| 4084 | * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing. |
| 4085 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4086 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4087 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4088 | * @sa @ref cursor_pos |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4089 | * @sa @ref glfwGetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4090 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4091 | * @since Added in version 3.0. Replaces `glfwSetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4092 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4093 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4094 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 4095 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4096 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4097 | /*! @brief Creates a custom cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4098 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4099 | * Creates a new custom cursor image that can be set for a window with @ref |
| 4100 | * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. |
| 4101 | * Any remaining cursors are destroyed by @ref glfwTerminate. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4102 | * |
Camilla Berglund | 85a01bf | 2015-08-17 21:04:19 +0200 | [diff] [blame] | 4103 | * 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] | 4104 | * bits per channel with the red channel first. They are arranged canonically |
| 4105 | * as packed sequential rows, starting from the top-left corner. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4106 | * |
| 4107 | * The cursor hotspot is specified in pixels, relative to the upper-left corner |
| 4108 | * of the cursor image. Like all other coordinate systems in GLFW, the X-axis |
| 4109 | * points to the right and the Y-axis points down. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4110 | * |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 4111 | * @param[in] image The desired cursor image. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4112 | * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. |
| 4113 | * @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] | 4114 | * @return The handle of the created cursor, or `NULL` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4115 | * [error](@ref error_handling) occurred. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4116 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4117 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4118 | * GLFW_PLATFORM_ERROR. |
| 4119 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4120 | * @pointer_lifetime The specified image data is copied before this function |
| 4121 | * returns. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4122 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4123 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4124 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4125 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4126 | * @sa @ref glfwDestroyCursor |
| 4127 | * @sa @ref glfwCreateStandardCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4128 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4129 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4130 | * |
| 4131 | * @ingroup input |
| 4132 | */ |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 4133 | GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4134 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4135 | /*! @brief Creates a cursor with a standard shape. |
| 4136 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4137 | * Returns a cursor with a [standard shape](@ref shapes), that can be set for |
| 4138 | * a window with @ref glfwSetCursor. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4139 | * |
| 4140 | * @param[in] shape One of the [standard shapes](@ref shapes). |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4141 | * @return A new cursor ready to use or `NULL` if an |
| 4142 | * [error](@ref error_handling) occurred. |
| 4143 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4144 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4145 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4146 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4147 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4148 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4149 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4150 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4151 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4152 | * @since Added in version 3.1. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 4153 | * |
| 4154 | * @ingroup input |
| 4155 | */ |
| 4156 | GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); |
| 4157 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4158 | /*! @brief Destroys a cursor. |
| 4159 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4160 | * This function destroys a cursor previously created with @ref |
| 4161 | * glfwCreateCursor. Any remaining cursors will be destroyed by @ref |
| 4162 | * glfwTerminate. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4163 | * |
Camilla Löwy | 4639307 | 2017-02-20 13:45:11 +0100 | [diff] [blame] | 4164 | * If the specified cursor is current for any window, that window will be |
| 4165 | * reverted to the default cursor. This does not affect the cursor mode. |
| 4166 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4167 | * @param[in] cursor The cursor object to destroy. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4168 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4169 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4170 | * GLFW_PLATFORM_ERROR. |
| 4171 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4172 | * @reentrancy This function must not be called from a callback. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4173 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4174 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4175 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4176 | * @sa @ref cursor_object |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4177 | * @sa @ref glfwCreateCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4178 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4179 | * @since Added in version 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4180 | * |
| 4181 | * @ingroup input |
| 4182 | */ |
| 4183 | GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); |
| 4184 | |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4185 | /*! @brief Sets the cursor for the window. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4186 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4187 | * This function sets the cursor image to be used when the cursor is over the |
| 4188 | * client area of the specified window. The set cursor will only be visible |
| 4189 | * when the [cursor mode](@ref cursor_mode) of the window is |
| 4190 | * `GLFW_CURSOR_NORMAL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4191 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4192 | * On some platforms, the set cursor may not be visible unless the window also |
| 4193 | * has input focus. |
| 4194 | * |
| 4195 | * @param[in] window The window to set the cursor for. |
| 4196 | * @param[in] cursor The cursor to set, or `NULL` to switch back to the default |
| 4197 | * arrow cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4198 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4199 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4200 | * GLFW_PLATFORM_ERROR. |
| 4201 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4202 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4203 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4204 | * @sa @ref cursor_object |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4205 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4206 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4207 | * |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 4208 | * @ingroup input |
| 4209 | */ |
| 4210 | GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); |
| 4211 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4212 | /*! @brief Sets the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4213 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4214 | * 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] | 4215 | * when a key is pressed, repeated or released. |
| 4216 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 4217 | * The key functions deal with physical keys, with layout independent |
| 4218 | * [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] | 4219 | * layout. If you want to input text, use the |
| 4220 | * [character callback](@ref glfwSetCharCallback) instead. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4221 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4222 | * When a window loses input focus, it will generate synthetic key release |
| 4223 | * events for all pressed keys. You can tell these events from user-generated |
| 4224 | * events by the fact that the synthetic ones are generated after the focus |
| 4225 | * loss event has been processed, i.e. after the |
| 4226 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 4227 | * |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 4228 | * The scancode of a key is specific to that platform or sometimes even to that |
| 4229 | * machine. Scancodes are intended to allow users to bind keys that don't have |
| 4230 | * 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] | 4231 | * 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] | 4232 | * |
| 4233 | * Sometimes GLFW needs to generate synthetic key events, in which case the |
| 4234 | * scancode may be zero. |
| 4235 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4236 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4237 | * @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] | 4238 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4239 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4240 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4241 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4242 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4243 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4244 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4245 | * |
| 4246 | * @sa @ref input_key |
| 4247 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4248 | * @since Added in version 1.0. |
| 4249 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4250 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4251 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4252 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4253 | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4254 | |
| 4255 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4256 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4257 | * This function sets the character callback of the specified window, which is |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4258 | * called when a Unicode character is input. |
| 4259 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4260 | * The character callback is intended for Unicode text input. As it deals with |
| 4261 | * characters, it is keyboard layout dependent, whereas the |
| 4262 | * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 |
| 4263 | * to physical keys, as a key may produce zero, one or more characters. If you |
| 4264 | * want to know whether a specific physical key was pressed or released, see |
| 4265 | * the key callback instead. |
| 4266 | * |
| 4267 | * The character callback behaves as system text input normally does and will |
| 4268 | * 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] | 4269 | * input on that platform, for example a Super (Command) key on macOS or Alt key |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4270 | * on Windows. There is a |
| 4271 | * [character with modifiers callback](@ref glfwSetCharModsCallback) that |
| 4272 | * receives these events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4273 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4274 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4275 | * @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] | 4276 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4277 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4278 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4279 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4280 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4281 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4282 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4283 | * |
| 4284 | * @sa @ref input_char |
| 4285 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4286 | * @since Added in version 2.4. |
| 4287 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4288 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4289 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4290 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4291 | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4292 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4293 | /*! @brief Sets the Unicode character with modifiers callback. |
| 4294 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4295 | * This function sets the character with modifiers callback of the specified |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4296 | * window, which is called when a Unicode character is input regardless of what |
| 4297 | * modifier keys are used. |
| 4298 | * |
| 4299 | * The character with modifiers callback is intended for implementing custom |
| 4300 | * Unicode character input. For regular Unicode text input, see the |
| 4301 | * [character callback](@ref glfwSetCharCallback). Like the character |
| 4302 | * callback, the character with modifiers callback deals with characters and is |
| 4303 | * keyboard layout dependent. Characters do not map 1:1 to physical keys, as |
| 4304 | * a key may produce zero, one or more characters. If you want to know whether |
| 4305 | * a specific physical key was pressed or released, see the |
| 4306 | * [key callback](@ref glfwSetKeyCallback) instead. |
| 4307 | * |
| 4308 | * @param[in] window The window whose callback to set. |
| 4309 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 4310 | * callback. |
| 4311 | * @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] | 4312 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4313 | * |
Camilla Löwy | adebcc7 | 2017-11-14 23:28:12 +0100 | [diff] [blame] | 4314 | * @deprecated Scheduled for removal in version 4.0. |
| 4315 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4316 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4317 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4318 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4319 | * |
| 4320 | * @sa @ref input_char |
| 4321 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4322 | * @since Added in version 3.1. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 4323 | * |
| 4324 | * @ingroup input |
| 4325 | */ |
| 4326 | GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun); |
| 4327 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4328 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4329 | * |
| 4330 | * This function sets the mouse button callback of the specified window, which |
| 4331 | * is called when a mouse button is pressed or released. |
| 4332 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4333 | * When a window loses input focus, it will generate synthetic mouse button |
| 4334 | * release events for all pressed mouse buttons. You can tell these events |
| 4335 | * from user-generated events by the fact that the synthetic ones are generated |
| 4336 | * after the focus loss event has been processed, i.e. after the |
| 4337 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 4338 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4339 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4340 | * @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] | 4341 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4342 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4343 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4344 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4345 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4346 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4347 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4348 | * |
| 4349 | * @sa @ref input_mouse_button |
| 4350 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4351 | * @since Added in version 1.0. |
| 4352 | * @glfw3 Added window handle parameter and return value. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4353 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4354 | * @ingroup input |
| 4355 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4356 | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4357 | |
| 4358 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4359 | * |
| 4360 | * This function sets the cursor position callback of the specified window, |
| 4361 | * 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] | 4362 | * position, in screen coordinates, relative to the upper-left corner of the |
| 4363 | * client area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4364 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4365 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4366 | * @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] | 4367 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4368 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4369 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4370 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4371 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4372 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4373 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4374 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4375 | * @sa @ref cursor_pos |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4376 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4377 | * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4378 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4379 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4380 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4381 | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4382 | |
| 4383 | /*! @brief Sets the cursor enter/exit callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4384 | * |
| 4385 | * This function sets the cursor boundary crossing callback of the specified |
| 4386 | * window, which is called when the cursor enters or leaves the client area of |
| 4387 | * the window. |
| 4388 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4389 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4390 | * @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] | 4391 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4392 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4393 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4394 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4395 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4396 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4397 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4398 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4399 | * @sa @ref cursor_enter |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4400 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4401 | * @since Added in version 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4402 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4403 | * @ingroup input |
| 4404 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4405 | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4406 | |
| 4407 | /*! @brief Sets the scroll callback. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4408 | * |
| 4409 | * This function sets the scroll callback of the specified window, which is |
| 4410 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
| 4411 | * area of a touchpad. |
| 4412 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4413 | * The scroll callback receives all scrolling input, like that from a mouse |
| 4414 | * wheel or a touchpad scrolling area. |
| 4415 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 4416 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4417 | * @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] | 4418 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4419 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4420 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4421 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4422 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4423 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4424 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4425 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4426 | * @sa @ref scrolling |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4427 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4428 | * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4429 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 4430 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4431 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 4432 | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4433 | |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4434 | /*! @brief Sets the file drop callback. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4435 | * |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4436 | * This function sets the file drop callback of the specified window, which is |
| 4437 | * called when one or more dragged files are dropped on the window. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4438 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4439 | * Because the path array and its strings may have been generated specifically |
| 4440 | * for that event, they are not guaranteed to be valid after the callback has |
| 4441 | * returned. If you wish to use them after the callback returns, you need to |
| 4442 | * make a deep copy. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4443 | * |
| 4444 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 4445 | * @param[in] cbfun The new file drop callback, or `NULL` to remove the |
| 4446 | * currently set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 4447 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4448 | * library had not been [initialized](@ref intro_init). |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4449 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4450 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4451 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4452 | * @remark @wayland File drop is currently unimplemented. |
| 4453 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4454 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4455 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4456 | * @sa @ref path_drop |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4457 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4458 | * @since Added in version 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4459 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 4460 | * @ingroup input |
| 4461 | */ |
| 4462 | GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun); |
| 4463 | |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 4464 | /*! @brief Returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4465 | * |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 4466 | * This function returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4467 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4468 | * There is no need to call this function before other functions that accept |
| 4469 | * a joystick ID, as they all check for presence before performing any other |
| 4470 | * work. |
| 4471 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4472 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 4473 | * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4474 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4475 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4476 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4477 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4478 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4479 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4480 | * @sa @ref joystick |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4481 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4482 | * @since Added in version 3.0. Replaces `glfwGetJoystickParam`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4483 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4484 | * @ingroup input |
| 4485 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4486 | GLFWAPI int glfwJoystickPresent(int jid); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4487 | |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4488 | /*! @brief Returns the values of all axes of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4489 | * |
| 4490 | * This function returns the values of all axes of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4491 | * 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] | 4492 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4493 | * 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] | 4494 | * but will not generate an error. This can be used instead of first calling |
| 4495 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4496 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4497 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4498 | * @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] | 4499 | * array. This is set to zero if the joystick is not present or an error |
| 4500 | * occurred. |
| 4501 | * @return An array of axis values, or `NULL` if the joystick is not present or |
| 4502 | * an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4503 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4504 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4505 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4506 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4507 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 4508 | * 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] | 4509 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4510 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4511 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4512 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4513 | * @sa @ref joystick_axis |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4514 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4515 | * @since Added in version 3.0. Replaces `glfwGetJoystickPos`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4516 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4517 | * @ingroup input |
| 4518 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4519 | GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4520 | |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 4521 | /*! @brief Returns the state of all buttons of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4522 | * |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 4523 | * This function returns the state of all buttons of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4524 | * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 4525 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4526 | * For backward compatibility with earlier versions that did not have @ref |
| 4527 | * glfwGetJoystickHats, the button array also includes all hats, each |
| 4528 | * represented as four buttons. The hats are in the same order as returned by |
| 4529 | * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and |
| 4530 | * _left_. To disable these extra buttons, set the @ref |
| 4531 | * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization. |
| 4532 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4533 | * 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] | 4534 | * but will not generate an error. This can be used instead of first calling |
| 4535 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4536 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4537 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4538 | * @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] | 4539 | * array. This is set to zero if the joystick is not present or an error |
| 4540 | * occurred. |
| 4541 | * @return An array of button states, or `NULL` if the joystick is not present |
| 4542 | * or an [error](@ref error_handling) occurred. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 4543 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4544 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4545 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4546 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4547 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 4548 | * 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] | 4549 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 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 | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4552 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4553 | * @sa @ref joystick_button |
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 2.2. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4556 | * @glfw3 Changed to return a dynamic array. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4557 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4558 | * @ingroup input |
| 4559 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4560 | GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4561 | |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4562 | /*! @brief Returns the state of all hats of the specified joystick. |
| 4563 | * |
| 4564 | * 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] | 4565 | * Each element in the array is one of the following values: |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4566 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4567 | * Name | Value |
| 4568 | * --------------------- | -------------------------------- |
| 4569 | * `GLFW_HAT_CENTERED` | 0 |
| 4570 | * `GLFW_HAT_UP` | 1 |
| 4571 | * `GLFW_HAT_RIGHT` | 2 |
| 4572 | * `GLFW_HAT_DOWN` | 4 |
| 4573 | * `GLFW_HAT_LEFT` | 8 |
| 4574 | * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP` |
| 4575 | * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN` |
| 4576 | * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP` |
| 4577 | * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN` |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4578 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4579 | * The diagonal directions are bitwise combinations of the primary (up, right, |
| 4580 | * down and left) directions and you can test for these individually by ANDing |
| 4581 | * it with the corresponding direction. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4582 | * |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4583 | * @code |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 4584 | * if (hats[2] & GLFW_HAT_RIGHT) |
| 4585 | * { |
| 4586 | * // State of hat 2 could be right-up, right or right-down |
| 4587 | * } |
Camilla Löwy | 798d7c6 | 2017-03-01 23:27:20 +0100 | [diff] [blame] | 4588 | * @endcode |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [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. |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [diff] [blame] | 4593 | * |
| 4594 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4595 | * @param[out] count Where to store the number of hat states in the returned |
| 4596 | * array. This is set to zero if the joystick is not present or an error |
| 4597 | * occurred. |
| 4598 | * @return An array of hat states, or `NULL` if the joystick is not present |
| 4599 | * or an [error](@ref error_handling) occurred. |
| 4600 | * |
| 4601 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4602 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4603 | * |
IntellectualKitty | 368dec7 | 2016-11-25 20:56:24 -0700 | [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 |
| 4606 | * disconnected, this function is called again for that joystick or the library |
| 4607 | * is terminated. |
| 4608 | * |
| 4609 | * @thread_safety This function must only be called from the main thread. |
| 4610 | * |
| 4611 | * @sa @ref joystick_hat |
| 4612 | * |
| 4613 | * @since Added in version 3.3. |
| 4614 | * |
| 4615 | * @ingroup input |
| 4616 | */ |
| 4617 | GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count); |
| 4618 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 4619 | /*! @brief Returns the name of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4620 | * |
| 4621 | * 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] | 4622 | * The returned string is allocated and freed by GLFW. You should not free it |
| 4623 | * yourself. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4624 | * |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4625 | * 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] | 4626 | * but will not generate an error. This can be used instead of first calling |
| 4627 | * @ref glfwJoystickPresent. |
Camilla Berglund | 386b603 | 2016-02-10 13:48:49 +0100 | [diff] [blame] | 4628 | * |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4629 | * @param[in] jid The [joystick](@ref joysticks) to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4630 | * @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] | 4631 | * is not present or an [error](@ref error_handling) occurred. |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 4632 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4633 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4634 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4635 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4636 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4637 | * 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] | 4638 | * disconnected or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 4639 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4640 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 4641 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4642 | * @sa @ref joystick_name |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4643 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4644 | * @since Added in version 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4645 | * |
| 4646 | * @ingroup input |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 4647 | */ |
Camilla Berglund | efc6b35 | 2016-10-10 03:24:07 +0200 | [diff] [blame] | 4648 | GLFWAPI const char* glfwGetJoystickName(int jid); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4649 | |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4650 | /*! @brief Returns the SDL comaptible GUID of the specified joystick. |
| 4651 | * |
| 4652 | * This function returns the SDL compatible GUID, as a UTF-8 encoded |
| 4653 | * hexadecimal string, of the specified joystick. The returned string is |
| 4654 | * allocated and freed by GLFW. You should not free it yourself. |
| 4655 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4656 | * The GUID is what connects a joystick to a gamepad mapping. A connected |
| 4657 | * joystick will always have a GUID even if there is no gamepad mapping |
| 4658 | * assigned to it. |
| 4659 | * |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4660 | * 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] | 4661 | * but will not generate an error. This can be used instead of first calling |
| 4662 | * @ref glfwJoystickPresent. |
Camilla Löwy | 5b7281b | 2017-07-23 16:34:11 +0200 | [diff] [blame] | 4663 | * |
| 4664 | * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to |
| 4665 | * uniquely identify the make and model of a joystick but does not identify |
| 4666 | * a specific unit, e.g. all wired Xbox 360 controllers will have the same |
| 4667 | * GUID on that platform. The GUID for a unit may vary between platforms |
| 4668 | * depending on what hardware information the platform specific APIs provide. |
| 4669 | * |
| 4670 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4671 | * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick |
| 4672 | * is not present or an [error](@ref error_handling) occurred. |
| 4673 | * |
| 4674 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 4675 | * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. |
| 4676 | * |
| 4677 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4678 | * should not free it yourself. It is valid until the specified joystick is |
| 4679 | * disconnected or the library is terminated. |
| 4680 | * |
| 4681 | * @thread_safety This function must only be called from the main thread. |
| 4682 | * |
| 4683 | * @sa @ref gamepad |
| 4684 | * |
| 4685 | * @since Added in version 3.3. |
| 4686 | * |
| 4687 | * @ingroup input |
| 4688 | */ |
| 4689 | GLFWAPI const char* glfwGetJoystickGUID(int jid); |
| 4690 | |
Camilla Löwy | 7c2c785 | 2017-12-07 16:19:57 +0100 | [diff] [blame] | 4691 | /*! @brief Sets the user pointer of the specified joystick. |
| 4692 | * |
| 4693 | * This function sets the user-defined pointer of the specified joystick. The |
| 4694 | * current value is retained until the joystick is disconnected. The initial |
| 4695 | * value is `NULL`. |
| 4696 | * |
| 4697 | * This function may be called from the joystick callback, even for a joystick |
| 4698 | * that is being disconnected. |
| 4699 | * |
| 4700 | * @param[in] joystick The joystick whose pointer to set. |
| 4701 | * @param[in] pointer The new value. |
| 4702 | * |
| 4703 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4704 | * |
| 4705 | * @thread_safety This function may be called from any thread. Access is not |
| 4706 | * synchronized. |
| 4707 | * |
| 4708 | * @sa @ref joystick_userptr |
| 4709 | * @sa @ref glfwGetJoystickUserPointer |
| 4710 | * |
| 4711 | * @since Added in version 3.3. |
| 4712 | * |
| 4713 | * @ingroup input |
| 4714 | */ |
| 4715 | GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer); |
| 4716 | |
| 4717 | /*! @brief Returns the user pointer of the specified joystick. |
| 4718 | * |
| 4719 | * This function returns the current value of the user-defined pointer of the |
| 4720 | * specified joystick. The initial value is `NULL`. |
| 4721 | * |
| 4722 | * This function may be called from the joystick callback, even for a joystick |
| 4723 | * that is being disconnected. |
| 4724 | * |
| 4725 | * @param[in] joystick The joystick whose pointer to return. |
| 4726 | * |
| 4727 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4728 | * |
| 4729 | * @thread_safety This function may be called from any thread. Access is not |
| 4730 | * synchronized. |
| 4731 | * |
| 4732 | * @sa @ref joystick_userptr |
| 4733 | * @sa @ref glfwSetJoystickUserPointer |
| 4734 | * |
| 4735 | * @since Added in version 3.3. |
| 4736 | * |
| 4737 | * @ingroup input |
| 4738 | */ |
| 4739 | GLFWAPI void* glfwGetJoystickUserPointer(int jid); |
| 4740 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4741 | /*! @brief Returns whether the specified joystick has a gamepad mapping. |
| 4742 | * |
| 4743 | * This function returns whether the specified joystick is both present and has |
| 4744 | * a gamepad mapping. |
| 4745 | * |
| 4746 | * If the specified joystick is present but does not have a gamepad mapping |
| 4747 | * 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] | 4748 | * @ref glfwJoystickPresent to check if a joystick is present regardless of |
| 4749 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4750 | * |
| 4751 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4752 | * @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping, |
| 4753 | * or `GLFW_FALSE` otherwise. |
| 4754 | * |
| 4755 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4756 | * GLFW_INVALID_ENUM. |
| 4757 | * |
| 4758 | * @thread_safety This function must only be called from the main thread. |
| 4759 | * |
| 4760 | * @sa @ref gamepad |
| 4761 | * @sa @ref glfwGetGamepadState |
| 4762 | * |
| 4763 | * @since Added in version 3.3. |
| 4764 | * |
| 4765 | * @ingroup input |
| 4766 | */ |
| 4767 | GLFWAPI int glfwJoystickIsGamepad(int jid); |
| 4768 | |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 4769 | /*! @brief Sets the joystick configuration callback. |
| 4770 | * |
| 4771 | * This function sets the joystick configuration callback, or removes the |
| 4772 | * currently set callback. This is called when a joystick is connected to or |
| 4773 | * disconnected from the system. |
| 4774 | * |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 4775 | * For joystick connection and disconnection events to be delivered on all |
| 4776 | * platforms, you need to call one of the [event processing](@ref events) |
| 4777 | * functions. Joystick disconnection may also be detected and the callback |
| 4778 | * called by joystick functions. The function will then return whatever it |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4779 | * returns if the joystick is not present. |
Camilla Löwy | a46c95c | 2017-02-01 04:55:46 +0100 | [diff] [blame] | 4780 | * |
Camilla Berglund | 8a7fa30 | 2015-12-13 17:38:50 +0100 | [diff] [blame] | 4781 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 4782 | * callback. |
| 4783 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 4784 | * library had not been [initialized](@ref intro_init). |
| 4785 | * |
| 4786 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4787 | * |
| 4788 | * @thread_safety This function must only be called from the main thread. |
| 4789 | * |
| 4790 | * @sa @ref joystick_event |
| 4791 | * |
| 4792 | * @since Added in version 3.2. |
| 4793 | * |
| 4794 | * @ingroup input |
| 4795 | */ |
| 4796 | GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun); |
| 4797 | |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4798 | /*! @brief Adds the specified SDL_GameControllerDB gamepad mappings. |
| 4799 | * |
| 4800 | * This function parses the specified ASCII encoded string and updates the |
| 4801 | * internal list with any gamepad mappings it finds. This string may |
| 4802 | * contain either a single gamepad mapping or many mappings separated by |
| 4803 | * newlines. The parser supports the full format of the `gamecontrollerdb.txt` |
| 4804 | * source file including empty lines and comments. |
| 4805 | * |
| 4806 | * See @ref gamepad_mapping for a description of the format. |
| 4807 | * |
| 4808 | * If there is already a gamepad mapping for a given GUID in the internal list, |
| 4809 | * it will be replaced by the one passed to this function. If the library is |
| 4810 | * terminated and re-initialized the internal list will revert to the built-in |
| 4811 | * default. |
| 4812 | * |
| 4813 | * @param[in] string The string containing the gamepad mappings. |
| 4814 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
| 4815 | * [error](@ref error_handling) occurred. |
| 4816 | * |
| 4817 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4818 | * GLFW_INVALID_VALUE. |
| 4819 | * |
| 4820 | * @thread_safety This function must only be called from the main thread. |
| 4821 | * |
| 4822 | * @sa @ref gamepad |
| 4823 | * @sa @ref glfwJoystickIsGamepad |
| 4824 | * @sa @ref glfwGetGamepadName |
| 4825 | * |
| 4826 | * @since Added in version 3.3. |
| 4827 | * |
| 4828 | * @ingroup input |
| 4829 | */ |
| 4830 | GLFWAPI int glfwUpdateGamepadMappings(const char* string); |
| 4831 | |
| 4832 | /*! @brief Returns the human-readable gamepad name for the specified joystick. |
| 4833 | * |
| 4834 | * This function returns the human-readable name of the gamepad from the |
| 4835 | * gamepad mapping assigned to the specified joystick. |
| 4836 | * |
| 4837 | * 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] | 4838 | * this function will return `NULL` but will not generate an error. Call |
| 4839 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 4840 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4841 | * |
| 4842 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4843 | * @return The UTF-8 encoded name of the gamepad, or `NULL` if the |
| 4844 | * joystick is not present, does not have a mapping or an |
| 4845 | * [error](@ref error_handling) occurred. |
| 4846 | * |
| 4847 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4848 | * should not free it yourself. It is valid until the specified joystick is |
| 4849 | * disconnected, the gamepad mappings are updated or the library is terminated. |
| 4850 | * |
| 4851 | * @thread_safety This function must only be called from the main thread. |
| 4852 | * |
| 4853 | * @sa @ref gamepad |
| 4854 | * @sa @ref glfwJoystickIsGamepad |
| 4855 | * |
| 4856 | * @since Added in version 3.3. |
| 4857 | * |
| 4858 | * @ingroup input |
| 4859 | */ |
| 4860 | GLFWAPI const char* glfwGetGamepadName(int jid); |
| 4861 | |
| 4862 | /*! @brief Retrieves the state of the specified joystick remapped as a gamepad. |
| 4863 | * |
| 4864 | * This function retrives the state of the specified joystick remapped to |
| 4865 | * an Xbox-like gamepad. |
| 4866 | * |
Camilla Löwy | 5bc1c38 | 2017-08-04 01:00:36 +0200 | [diff] [blame] | 4867 | * If the specified joystick is not present or does not have a gamepad mapping |
| 4868 | * this function will return `GLFW_FALSE` but will not generate an error. Call |
| 4869 | * @ref glfwJoystickPresent to check whether it is present regardless of |
| 4870 | * whether it has a mapping. |
Camilla Löwy | 953106e | 2017-06-18 15:13:25 +0200 | [diff] [blame] | 4871 | * |
| 4872 | * The Guide button may not be available for input as it is often hooked by the |
| 4873 | * system or the Steam client. |
| 4874 | * |
| 4875 | * Not all devices have all the buttons or axes provided by @ref |
| 4876 | * GLFWgamepadstate. Unavailable buttons and axes will always report |
| 4877 | * `GLFW_RELEASE` and 1.0 respectively. |
| 4878 | * |
| 4879 | * @param[in] jid The [joystick](@ref joysticks) to query. |
| 4880 | * @param[out] state The gamepad input state of the joystick. |
| 4881 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is |
| 4882 | * connected, it has no gamepad mapping or an [error](@ref error_handling) |
| 4883 | * occurred. |
| 4884 | * |
| 4885 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4886 | * GLFW_INVALID_ENUM. |
| 4887 | * |
| 4888 | * @sa @ref gamepad |
| 4889 | * @sa @ref glfwUpdateGamepadMappings |
| 4890 | * @sa @ref glfwJoystickIsGamepad |
| 4891 | * |
| 4892 | * @since Added in version 3.3. |
| 4893 | * |
| 4894 | * @ingroup input |
| 4895 | */ |
| 4896 | GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); |
| 4897 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4898 | /*! @brief Sets the clipboard to the specified string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4899 | * |
| 4900 | * This function sets the system clipboard to the specified, UTF-8 encoded |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4901 | * string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4902 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 4903 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4904 | * @param[in] string A UTF-8 encoded string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4905 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4906 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4907 | * GLFW_PLATFORM_ERROR. |
| 4908 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4909 | * @remark @wayland Clipboard is currently unimplemented. |
| 4910 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4911 | * @pointer_lifetime The specified string is copied before this function |
| 4912 | * returns. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 4913 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4914 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4915 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4916 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4917 | * @sa @ref glfwGetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4918 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4919 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4920 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 4921 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4922 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4923 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4924 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4925 | /*! @brief Returns the contents of the clipboard as a string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4926 | * |
| 4927 | * This function returns the contents of the system clipboard, if it contains |
Camilla Berglund | cf9079c | 2015-09-16 18:51:49 +0200 | [diff] [blame] | 4928 | * 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] | 4929 | * if its contents cannot be converted, `NULL` is returned and a @ref |
| 4930 | * GLFW_FORMAT_UNAVAILABLE error is generated. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4931 | * |
Camilla Löwy | 31cbb20 | 2017-11-04 21:11:58 +0100 | [diff] [blame] | 4932 | * @param[in] window Deprecated. Any valid window or `NULL`. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 4933 | * @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] | 4934 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4935 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4936 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4937 | * GLFW_PLATFORM_ERROR. |
| 4938 | * |
linkmauve | bc8b048 | 2016-10-16 15:52:39 +0100 | [diff] [blame] | 4939 | * @remark @wayland Clipboard is currently unimplemented. |
| 4940 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4941 | * @pointer_lifetime The returned string is allocated and freed by GLFW. You |
| 4942 | * 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] | 4943 | * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library |
| 4944 | * is terminated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4945 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4946 | * @thread_safety This function must only be called from the main thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4947 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4948 | * @sa @ref clipboard |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 4949 | * @sa @ref glfwSetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4950 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4951 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4952 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 4953 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4954 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 4955 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 4956 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4957 | /*! @brief Returns the value of the GLFW timer. |
| 4958 | * |
| 4959 | * This function returns the value of the GLFW timer. Unless the timer has |
| 4960 | * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW |
| 4961 | * was initialized. |
| 4962 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4963 | * The resolution of the timer is system dependent, but is usually on the order |
| 4964 | * of a few micro- or nanoseconds. It uses the highest-resolution monotonic |
| 4965 | * time source on each supported platform. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4966 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4967 | * @return The current value, in seconds, or zero if an |
| 4968 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4969 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4970 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 4971 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 4972 | * @thread_safety This function may be called from any thread. Reading and |
| 4973 | * writing of the internal timer offset is not atomic, so it needs to be |
| 4974 | * externally synchronized with calls to @ref glfwSetTime. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4975 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 4976 | * @sa @ref time |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4977 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 4978 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 4979 | * |
| 4980 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4981 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 4982 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 4983 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4984 | /*! @brief Sets the GLFW timer. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4985 | * |
| 4986 | * 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] | 4987 | * up from that value. The value must be a positive finite number less than |
| 4988 | * or equal to 18446744073.0, which is approximately 584.5 years. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 4989 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4990 | * @param[in] time The new value, in seconds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 4991 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 4992 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 4993 | * GLFW_INVALID_VALUE. |
| 4994 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 4995 | * @remark The upper limit of the timer is calculated as |
Camilla Berglund | 6e20cda | 2015-03-10 12:01:38 +0100 | [diff] [blame] | 4996 | * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations |
| 4997 | * storing nanoseconds in 64 bits. The limit may be increased in the future. |
| 4998 | * |
Camilla Berglund | 20bce15 | 2016-05-30 16:04:37 +0200 | [diff] [blame] | 4999 | * @thread_safety This function may be called from any thread. Reading and |
| 5000 | * writing of the internal timer offset is not atomic, so it needs to be |
| 5001 | * externally synchronized with calls to @ref glfwGetTime. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 5002 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5003 | * @sa @ref time |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5004 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5005 | * @since Added in version 2.2. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5006 | * |
| 5007 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5008 | */ |
| 5009 | GLFWAPI void glfwSetTime(double time); |
| 5010 | |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5011 | /*! @brief Returns the current value of the raw timer. |
| 5012 | * |
Camilla Berglund | 337c77a | 2016-03-06 14:11:14 +0100 | [diff] [blame] | 5013 | * This function returns the current value of the raw timer, measured in |
| 5014 | * 1 / frequency seconds. To get the frequency, call @ref |
| 5015 | * glfwGetTimerFrequency. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5016 | * |
Emmanuel Gil Peyrot | c3cba58 | 2017-11-17 03:34:18 +0000 | [diff] [blame] | 5017 | * @return The value of the timer, or zero if an |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5018 | * [error](@ref error_handling) occurred. |
| 5019 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 5020 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5021 | * |
| 5022 | * @thread_safety This function may be called from any thread. |
| 5023 | * |
| 5024 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5025 | * @sa @ref glfwGetTimerFrequency |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5026 | * |
| 5027 | * @since Added in version 3.2. |
| 5028 | * |
| 5029 | * @ingroup input |
| 5030 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 5031 | GLFWAPI uint64_t glfwGetTimerValue(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5032 | |
| 5033 | /*! @brief Returns the frequency, in Hz, of the raw timer. |
| 5034 | * |
Camilla Berglund | defaea3 | 2016-03-07 13:36:54 +0100 | [diff] [blame] | 5035 | * This function returns the frequency, in Hz, of the raw timer. |
| 5036 | * |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5037 | * @return The frequency of the timer, in Hz, or zero if an |
| 5038 | * [error](@ref error_handling) occurred. |
| 5039 | * |
Camilla Berglund | 46fce40 | 2016-03-07 13:35:37 +0100 | [diff] [blame] | 5040 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5041 | * |
| 5042 | * @thread_safety This function may be called from any thread. |
| 5043 | * |
| 5044 | * @sa @ref time |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5045 | * @sa @ref glfwGetTimerValue |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5046 | * |
| 5047 | * @since Added in version 3.2. |
| 5048 | * |
| 5049 | * @ingroup input |
| 5050 | */ |
Camilla Berglund | 5661d03 | 2016-03-23 10:09:07 +0100 | [diff] [blame] | 5051 | GLFWAPI uint64_t glfwGetTimerFrequency(void); |
Camilla Berglund | 31f67dd | 2016-03-06 11:38:55 +0100 | [diff] [blame] | 5052 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5053 | /*! @brief Makes the context of the specified window current for the calling |
| 5054 | * thread. |
| 5055 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5056 | * 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] | 5057 | * 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] | 5058 | * a single thread at a time and each thread can have only a single current |
| 5059 | * context at a time. |
| 5060 | * |
Camilla Löwy | f2756d0 | 2017-11-02 19:30:12 +0100 | [diff] [blame] | 5061 | * When moving a context between threads, you must make it non-current on the |
| 5062 | * old thread before making it current on the new one. |
| 5063 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5064 | * By default, making a context non-current implicitly forces a pipeline flush. |
| 5065 | * On machines that support `GL_KHR_context_flush_control`, you can control |
| 5066 | * whether a context performs this flush by setting the |
Camilla Löwy | ce161c2 | 2016-12-06 01:14:23 +0100 | [diff] [blame] | 5067 | * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) |
| 5068 | * hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5069 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 5070 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 5071 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 5072 | * error. |
| 5073 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5074 | * @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] | 5075 | * detach the current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5076 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5077 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5078 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5079 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5080 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5081 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5082 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5083 | * @sa @ref glfwGetCurrentContext |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5084 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5085 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5086 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5087 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5088 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5089 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5090 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5091 | /*! @brief Returns the window whose context is current on the calling thread. |
| 5092 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5093 | * This function returns the window whose OpenGL or OpenGL ES context is |
| 5094 | * current on the calling thread. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5095 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 5096 | * @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] | 5097 | * context is current. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5098 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5099 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5100 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5101 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5102 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5103 | * @sa @ref context_current |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5104 | * @sa @ref glfwMakeContextCurrent |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5105 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5106 | * @since Added in version 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5107 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5108 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5109 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5110 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5111 | |
| 5112 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5113 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5114 | * This function swaps the front and back buffers of the specified window when |
| 5115 | * rendering with OpenGL or OpenGL ES. If the swap interval is greater than |
| 5116 | * zero, the GPU driver waits the specified number of screen updates before |
| 5117 | * swapping the buffers. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5118 | * |
Camilla Berglund | 98b478f | 2015-11-05 13:44:15 +0100 | [diff] [blame] | 5119 | * The specified window must have an OpenGL or OpenGL ES context. Specifying |
| 5120 | * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT |
| 5121 | * error. |
| 5122 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5123 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5124 | * see `vkQueuePresentKHR` instead. |
| 5125 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 5126 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5127 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5128 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5129 | * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5130 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5131 | * @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] | 5132 | * calling thread. |
| 5133 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5134 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 5135 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5136 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5137 | * @sa @ref glfwSwapInterval |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5138 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5139 | * @since Added in version 1.0. |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5140 | * @glfw3 Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5141 | * |
| 5142 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5143 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 5144 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5145 | |
| 5146 | /*! @brief Sets the swap interval for the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5147 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5148 | * This function sets the swap interval for the current OpenGL or OpenGL ES |
| 5149 | * context, i.e. the number of screen updates to wait from the time @ref |
| 5150 | * glfwSwapBuffers was called before swapping the buffers and returning. This |
| 5151 | * is sometimes called _vertical synchronization_, _vertical retrace |
| 5152 | * synchronization_ or just _vsync_. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5153 | * |
Camilla Löwy | 8094a1c | 2017-11-27 15:53:59 +0100 | [diff] [blame] | 5154 | * 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] | 5155 | * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap |
| 5156 | * intervals, which allows the driver to swap immediately even if a frame |
| 5157 | * arrives a little bit late. You can check for these extensions with @ref |
| 5158 | * glfwExtensionSupported. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 5159 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5160 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5161 | * 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] | 5162 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5163 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5164 | * see the present mode of your swapchain instead. |
| 5165 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 5166 | * @param[in] interval The minimum number of screen updates to wait for |
| 5167 | * until the buffers are swapped by @ref glfwSwapBuffers. |
| 5168 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5169 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5170 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5171 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5172 | * @remark This function is not called during context creation, leaving the |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5173 | * 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] | 5174 | * because some swap interval extensions used by GLFW do not allow the swap |
| 5175 | * interval to be reset to zero once it has been set to a non-zero value. |
| 5176 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5177 | * @remark Some GPU drivers do not honor the requested swap interval, either |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5178 | * because of a user setting that overrides the application's request or due to |
| 5179 | * bugs in the driver. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 5180 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5181 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5182 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 5183 | * @sa @ref buffer_swap |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5184 | * @sa @ref glfwSwapBuffers |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5185 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5186 | * @since Added in version 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5187 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5188 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5189 | */ |
| 5190 | GLFWAPI void glfwSwapInterval(int interval); |
| 5191 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5192 | /*! @brief Returns whether the specified extension is available. |
| 5193 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 5194 | * This function returns whether the specified |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5195 | * [API extension](@ref context_glext) is supported by the current OpenGL or |
| 5196 | * OpenGL ES context. It searches both for client API extension and context |
| 5197 | * creation API extensions. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5198 | * |
| 5199 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5200 | * 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] | 5201 | * |
| 5202 | * As this functions retrieves and searches one or more extension strings each |
| 5203 | * call, it is recommended that you cache its results if it is going to be used |
| 5204 | * frequently. The extension strings will not change during the lifetime of |
| 5205 | * a context, so there is no danger in doing this. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5206 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5207 | * This function does not apply to Vulkan. If you are using Vulkan, see @ref |
| 5208 | * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties` |
| 5209 | * and `vkEnumerateDeviceExtensionProperties` instead. |
| 5210 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5211 | * @param[in] extension The ASCII encoded name of the extension. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 5212 | * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` |
| 5213 | * otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5214 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5215 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5216 | * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref |
| 5217 | * GLFW_PLATFORM_ERROR. |
| 5218 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5219 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5220 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5221 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5222 | * @sa @ref glfwGetProcAddress |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5223 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5224 | * @since Added in version 1.0. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 5225 | * |
| 5226 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5227 | */ |
| 5228 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 5229 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5230 | /*! @brief Returns the address of the specified function for the current |
| 5231 | * context. |
| 5232 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5233 | * This function returns the address of the specified OpenGL or OpenGL ES |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5234 | * [core or extension function](@ref context_glext), if it is supported |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 5235 | * by the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5236 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5237 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 5238 | * 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] | 5239 | * |
Camilla Berglund | 001c50c | 2016-02-19 09:13:56 +0100 | [diff] [blame] | 5240 | * This function does not apply to Vulkan. If you are rendering with Vulkan, |
| 5241 | * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and |
| 5242 | * `vkGetDeviceProcAddr` instead. |
| 5243 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5244 | * @param[in] procname The ASCII encoded name of the function. |
Camilla Berglund | a36e3a2 | 2015-11-05 17:14:26 +0100 | [diff] [blame] | 5245 | * @return The address of the function, or `NULL` if an |
| 5246 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5247 | * |
Camilla Berglund | f51cf81 | 2016-02-05 00:51:40 +0100 | [diff] [blame] | 5248 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5249 | * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR. |
| 5250 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5251 | * @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] | 5252 | * between contexts. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5253 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5254 | * @remark This function may return a non-`NULL` address despite the |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5255 | * associated version or extension not being available. Always check the |
Camilla Berglund | c8e0687 | 2015-08-27 21:40:22 +0200 | [diff] [blame] | 5256 | * context version or extension string first. |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 5257 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5258 | * @pointer_lifetime The returned function pointer is valid until the context |
| 5259 | * is destroyed or the library is terminated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5260 | * |
Camilla Berglund | 951a958 | 2016-01-31 21:32:14 +0100 | [diff] [blame] | 5261 | * @thread_safety This function may be called from any thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5262 | * |
| 5263 | * @sa @ref context_glext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5264 | * @sa @ref glfwExtensionSupported |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 5265 | * |
Camilla Berglund | 832c2ff | 2016-01-31 22:35:11 +0100 | [diff] [blame] | 5266 | * @since Added in version 1.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 5267 | * |
| 5268 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 5269 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 5270 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5271 | |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5272 | /*! @brief Returns whether the Vulkan loader and an ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5273 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5274 | * This function returns whether the Vulkan loader and any minimally functional |
| 5275 | * ICD have been found. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5276 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5277 | * The availability of a Vulkan loader and even an ICD does not by itself |
| 5278 | * guarantee that surface creation or even instance creation is possible. |
| 5279 | * For example, on Fermi systems Nvidia will install an ICD that provides no |
| 5280 | * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check |
| 5281 | * whether the extensions necessary for Vulkan surface creation are available |
| 5282 | * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue |
| 5283 | * family of a physical device supports image presentation. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5284 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5285 | * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` |
| 5286 | * otherwise. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5287 | * |
| 5288 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. |
| 5289 | * |
| 5290 | * @thread_safety This function may be called from any thread. |
| 5291 | * |
| 5292 | * @sa @ref vulkan_support |
| 5293 | * |
| 5294 | * @since Added in version 3.2. |
| 5295 | * |
| 5296 | * @ingroup vulkan |
| 5297 | */ |
| 5298 | GLFWAPI int glfwVulkanSupported(void); |
| 5299 | |
| 5300 | /*! @brief Returns the Vulkan instance extensions required by GLFW. |
| 5301 | * |
| 5302 | * This function returns an array of names of Vulkan instance extensions required |
| 5303 | * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the |
| 5304 | * list will always contains `VK_KHR_surface`, so if you don't require any |
| 5305 | * additional extensions you can pass this list directly to the |
| 5306 | * `VkInstanceCreateInfo` struct. |
| 5307 | * |
| 5308 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 5309 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5310 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5311 | * |
| 5312 | * If Vulkan is available but no set of extensions allowing window surface |
| 5313 | * creation was found, this function returns `NULL`. You may still use Vulkan |
| 5314 | * for off-screen rendering and compute work. |
| 5315 | * |
| 5316 | * @param[out] count Where to store the number of extensions in the returned |
| 5317 | * array. This is set to zero if an error occurred. |
| 5318 | * @return An array of ASCII encoded extension names, or `NULL` if an |
| 5319 | * [error](@ref error_handling) occurred. |
| 5320 | * |
| 5321 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5322 | * GLFW_API_UNAVAILABLE. |
| 5323 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 5324 | * @remark Additional extensions may be required by future versions of GLFW. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5325 | * You should check if any extensions you wish to enable are already in the |
| 5326 | * returned array, as it is an error to specify an extension more than once in |
| 5327 | * the `VkInstanceCreateInfo` struct. |
| 5328 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5329 | * @remark @macos This function currently only supports the |
| 5330 | * `VK_MVK_macos_surface` extension from MoltenVK. |
| 5331 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5332 | * @pointer_lifetime The returned array is allocated and freed by GLFW. You |
| 5333 | * should not free it yourself. It is guaranteed to be valid only until the |
| 5334 | * library is terminated. |
| 5335 | * |
| 5336 | * @thread_safety This function may be called from any thread. |
| 5337 | * |
| 5338 | * @sa @ref vulkan_ext |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5339 | * @sa @ref glfwCreateWindowSurface |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5340 | * |
| 5341 | * @since Added in version 3.2. |
| 5342 | * |
| 5343 | * @ingroup vulkan |
| 5344 | */ |
Camilla Berglund | 7ab7d8b | 2016-03-23 10:24:01 +0100 | [diff] [blame] | 5345 | GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count); |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5346 | |
| 5347 | #if defined(VK_VERSION_1_0) |
| 5348 | |
| 5349 | /*! @brief Returns the address of the specified Vulkan instance function. |
| 5350 | * |
| 5351 | * This function returns the address of the specified Vulkan core or extension |
| 5352 | * function for the specified instance. If instance is set to `NULL` it can |
| 5353 | * return any function exported from the Vulkan loader, including at least the |
| 5354 | * following functions: |
| 5355 | * |
| 5356 | * - `vkEnumerateInstanceExtensionProperties` |
| 5357 | * - `vkEnumerateInstanceLayerProperties` |
| 5358 | * - `vkCreateInstance` |
| 5359 | * - `vkGetInstanceProcAddr` |
| 5360 | * |
| 5361 | * If Vulkan is not available on the machine, this function returns `NULL` and |
| 5362 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5363 | * to check whether Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5364 | * |
| 5365 | * This function is equivalent to calling `vkGetInstanceProcAddr` with |
| 5366 | * a platform-specific query of the Vulkan loader as a fallback. |
| 5367 | * |
| 5368 | * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve |
| 5369 | * functions related to instance creation. |
| 5370 | * @param[in] procname The ASCII encoded name of the function. |
| 5371 | * @return The address of the function, or `NULL` if an |
| 5372 | * [error](@ref error_handling) occurred. |
| 5373 | * |
| 5374 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref |
| 5375 | * GLFW_API_UNAVAILABLE. |
| 5376 | * |
| 5377 | * @pointer_lifetime The returned function pointer is valid until the library |
| 5378 | * is terminated. |
| 5379 | * |
| 5380 | * @thread_safety This function may be called from any thread. |
| 5381 | * |
| 5382 | * @sa @ref vulkan_proc |
| 5383 | * |
| 5384 | * @since Added in version 3.2. |
| 5385 | * |
| 5386 | * @ingroup vulkan |
| 5387 | */ |
| 5388 | GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname); |
| 5389 | |
| 5390 | /*! @brief Returns whether the specified queue family can present images. |
| 5391 | * |
| 5392 | * This function returns whether the specified queue family of the specified |
| 5393 | * physical device supports presentation to the platform GLFW was built for. |
| 5394 | * |
| 5395 | * If Vulkan or the required window surface creation instance extensions are |
| 5396 | * not available on the machine, or if the specified instance was not created |
| 5397 | * with the required extensions, this function returns `GLFW_FALSE` and |
| 5398 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5399 | * to check whether Vulkan is at least minimally available and @ref |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5400 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 5401 | * required. |
| 5402 | * |
| 5403 | * @param[in] instance The instance that the physical device belongs to. |
| 5404 | * @param[in] device The physical device that the queue family belongs to. |
| 5405 | * @param[in] queuefamily The index of the queue family to query. |
| 5406 | * @return `GLFW_TRUE` if the queue family supports presentation, or |
| 5407 | * `GLFW_FALSE` otherwise. |
| 5408 | * |
| 5409 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5410 | * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
| 5411 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5412 | * @remark @macos This function currently always returns `GLFW_TRUE`, as the |
| 5413 | * `VK_MVK_macos_surface` extension does not provide |
| 5414 | * a `vkGetPhysicalDevice*PresentationSupport` type function. |
| 5415 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5416 | * @thread_safety This function may be called from any thread. For |
| 5417 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 5418 | * |
| 5419 | * @sa @ref vulkan_present |
| 5420 | * |
| 5421 | * @since Added in version 3.2. |
| 5422 | * |
| 5423 | * @ingroup vulkan |
| 5424 | */ |
| 5425 | GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); |
| 5426 | |
| 5427 | /*! @brief Creates a Vulkan surface for the specified window. |
| 5428 | * |
| 5429 | * This function creates a Vulkan surface for the specified window. |
| 5430 | * |
Camilla Löwy | 98bdd36 | 2017-02-07 20:56:48 +0100 | [diff] [blame] | 5431 | * If the Vulkan loader or at least one minimally functional ICD were not found, |
| 5432 | * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref |
| 5433 | * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether |
| 5434 | * Vulkan is at least minimally available. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5435 | * |
| 5436 | * If the required window surface creation instance extensions are not |
| 5437 | * available or if the specified instance was not created with these extensions |
| 5438 | * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and |
| 5439 | * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref |
| 5440 | * glfwGetRequiredInstanceExtensions to check what instance extensions are |
| 5441 | * required. |
| 5442 | * |
| 5443 | * The window surface must be destroyed before the specified Vulkan instance. |
| 5444 | * It is the responsibility of the caller to destroy the window surface. GLFW |
| 5445 | * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the |
| 5446 | * surface. |
| 5447 | * |
| 5448 | * @param[in] instance The Vulkan instance to create the surface in. |
| 5449 | * @param[in] window The window to create the surface for. |
| 5450 | * @param[in] allocator The allocator to use, or `NULL` to use the default |
| 5451 | * allocator. |
| 5452 | * @param[out] surface Where to store the handle of the surface. This is set |
| 5453 | * to `VK_NULL_HANDLE` if an error occurred. |
| 5454 | * @return `VK_SUCCESS` if successful, or a Vulkan error code if an |
| 5455 | * [error](@ref error_handling) occurred. |
| 5456 | * |
| 5457 | * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref |
| 5458 | * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. |
| 5459 | * |
Camilla Berglund | 67931bd | 2016-10-26 16:58:56 +0200 | [diff] [blame] | 5460 | * @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] | 5461 | * the Vulkan error code most appropriate for the error. Appropriate use of |
| 5462 | * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should |
Camilla Berglund | ee33dcd | 2016-03-07 14:42:51 +0100 | [diff] [blame] | 5463 | * eliminate almost all occurrences of these errors. |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5464 | * |
Camilla Berglund | e94d166 | 2016-10-14 01:46:56 +0200 | [diff] [blame] | 5465 | * @remark @macos This function currently only supports the |
| 5466 | * `VK_MVK_macos_surface` extension from MoltenVK. |
| 5467 | * |
| 5468 | * @remark @macos This function creates and sets a `CAMetalLayer` instance for |
| 5469 | * the window content view, which is required for MoltenVK to function. |
| 5470 | * |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5471 | * @thread_safety This function may be called from any thread. For |
| 5472 | * synchronization details of Vulkan objects, see the Vulkan specification. |
| 5473 | * |
| 5474 | * @sa @ref vulkan_surface |
Camilla Berglund | 7e9e321 | 2016-09-14 20:17:26 +0200 | [diff] [blame] | 5475 | * @sa @ref glfwGetRequiredInstanceExtensions |
Camilla Berglund | 9b75bff | 2015-08-10 20:19:04 +0200 | [diff] [blame] | 5476 | * |
| 5477 | * @since Added in version 3.2. |
| 5478 | * |
| 5479 | * @ingroup vulkan |
| 5480 | */ |
| 5481 | GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); |
| 5482 | |
| 5483 | #endif /*VK_VERSION_1_0*/ |
| 5484 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5485 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5486 | /************************************************************************* |
| 5487 | * Global definition cleanup |
| 5488 | *************************************************************************/ |
| 5489 | |
| 5490 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 5491 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5492 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 5493 | #undef WINGDIAPI |
| 5494 | #undef GLFW_WINGDIAPI_DEFINED |
| 5495 | #endif |
| 5496 | |
| 5497 | #ifdef GLFW_CALLBACK_DEFINED |
| 5498 | #undef CALLBACK |
| 5499 | #undef GLFW_CALLBACK_DEFINED |
| 5500 | #endif |
| 5501 | |
Camilla Löwy | be51c20 | 2017-07-03 14:25:47 +0200 | [diff] [blame] | 5502 | /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally |
| 5503 | * defined by some gl.h variants (OpenBSD) so define it after if needed. |
| 5504 | */ |
| 5505 | #ifndef GLAPIENTRY |
| 5506 | #define GLAPIENTRY APIENTRY |
| 5507 | #endif |
| 5508 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 5509 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 5510 | |
| 5511 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5512 | #ifdef __cplusplus |
| 5513 | } |
| 5514 | #endif |
| 5515 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 5516 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5517 | |