Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 1 | /************************************************************************* |
Camilla Berglund | 95a07f3 | 2015-06-01 22:55:06 +0200 | [diff] [blame] | 2 | * GLFW 3.2 - 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 Berglund | f8105ed | 2010-11-09 02:57:46 +0100 | [diff] [blame] | 6 | * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.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 | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 41 | /*! @defgroup context Context handling |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 42 | * |
| 43 | * This is the reference documentation for context related functions. For more |
| 44 | * information, see the @ref context. |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 45 | */ |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 46 | /*! @defgroup init Initialization, version and errors |
| 47 | * |
| 48 | * This is the reference documentation for initialization and termination of |
| 49 | * the library, version management and error handling. For more information, |
| 50 | * see the @ref intro. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 51 | */ |
| 52 | /*! @defgroup input Input handling |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 53 | * |
| 54 | * This is the reference documentation for input related functions and types. |
| 55 | * For more information, see the @ref input. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 56 | */ |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 57 | /*! @defgroup monitor Monitor handling |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 58 | * |
| 59 | * This is the reference documentation for monitor related functions and types. |
| 60 | * For more information, see the @ref monitor. |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 61 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 62 | /*! @defgroup window Window handling |
| 63 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 64 | * This is the reference documentation for window related functions and types, |
| 65 | * including creation, deletion and event polling. For more information, see |
| 66 | * the @ref window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 67 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 68 | |
| 69 | |
| 70 | /************************************************************************* |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 71 | * Compiler- and platform-specific preprocessor work |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 72 | *************************************************************************/ |
| 73 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 74 | /* 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] | 75 | */ |
Camilla Berglund | e8ce4ab | 2015-02-22 18:18:43 +0100 | [diff] [blame] | 76 | #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 77 | #define _WIN32 |
| 78 | #endif /* _WIN32 */ |
| 79 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 80 | /* It is customary to use APIENTRY for OpenGL function pointer declarations on |
| 81 | * all platforms. Additionally, the Windows OpenGL header needs APIENTRY. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 82 | */ |
| 83 | #ifndef APIENTRY |
| 84 | #ifdef _WIN32 |
| 85 | #define APIENTRY __stdcall |
| 86 | #else |
| 87 | #define APIENTRY |
| 88 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 89 | #endif /* APIENTRY */ |
| 90 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 91 | /* Some Windows OpenGL headers need this. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 92 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 93 | #if !defined(WINGDIAPI) && defined(_WIN32) |
Camilla Berglund | c535364 | 2015-02-22 18:14:30 +0100 | [diff] [blame] | 94 | #define WINGDIAPI __declspec(dllimport) |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 95 | #define GLFW_WINGDIAPI_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 96 | #endif /* WINGDIAPI */ |
| 97 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 98 | /* Some Windows GLU headers need this. |
| 99 | */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 100 | #if !defined(CALLBACK) && defined(_WIN32) |
Camilla Berglund | d586fe6 | 2015-02-22 18:17:34 +0100 | [diff] [blame] | 101 | #define CALLBACK __stdcall |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 102 | #define GLFW_CALLBACK_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 103 | #endif /* CALLBACK */ |
| 104 | |
Camilla Berglund | 8d910d7 | 2015-02-22 18:35:10 +0100 | [diff] [blame] | 105 | /* Most Windows GLU headers need wchar_t. |
| 106 | * The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h. |
| 107 | */ |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 108 | #if !defined(GLFW_INCLUDE_NONE) |
| 109 | #include <stddef.h> |
| 110 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 111 | |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 112 | /* Include the chosen client API headers. |
| 113 | */ |
| 114 | #if defined(__APPLE_CC__) |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 115 | #if defined(GLFW_INCLUDE_GLCOREARB) |
| 116 | #include <OpenGL/gl3.h> |
| 117 | #if defined(GLFW_INCLUDE_GLEXT) |
| 118 | #include <OpenGL/gl3ext.h> |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 119 | #endif |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 120 | #elif !defined(GLFW_INCLUDE_NONE) |
| 121 | #if !defined(GLFW_INCLUDE_GLEXT) |
| 122 | #define GL_GLEXT_LEGACY |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 123 | #endif |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 124 | #include <OpenGL/gl.h> |
| 125 | #endif |
| 126 | #if defined(GLFW_INCLUDE_GLU) |
| 127 | #include <OpenGL/glu.h> |
| 128 | #endif |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 129 | #else |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 130 | #if defined(GLFW_INCLUDE_GLCOREARB) |
| 131 | #include <GL/glcorearb.h> |
| 132 | #elif defined(GLFW_INCLUDE_ES1) |
| 133 | #include <GLES/gl.h> |
| 134 | #if defined(GLFW_INCLUDE_GLEXT) |
| 135 | #include <GLES/glext.h> |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 136 | #endif |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 137 | #elif defined(GLFW_INCLUDE_ES2) |
| 138 | #include <GLES2/gl2.h> |
| 139 | #if defined(GLFW_INCLUDE_GLEXT) |
| 140 | #include <GLES2/gl2ext.h> |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 141 | #endif |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 142 | #elif defined(GLFW_INCLUDE_ES3) |
| 143 | #include <GLES3/gl3.h> |
| 144 | #if defined(GLFW_INCLUDE_GLEXT) |
| 145 | #include <GLES3/gl2ext.h> |
| 146 | #endif |
| 147 | #elif defined(GLFW_INCLUDE_ES31) |
| 148 | #include <GLES3/gl31.h> |
| 149 | #if defined(GLFW_INCLUDE_GLEXT) |
| 150 | #include <GLES3/gl2ext.h> |
| 151 | #endif |
| 152 | #elif !defined(GLFW_INCLUDE_NONE) |
| 153 | #include <GL/gl.h> |
| 154 | #if defined(GLFW_INCLUDE_GLEXT) |
| 155 | #include <GL/glext.h> |
| 156 | #endif |
| 157 | #endif |
| 158 | #if defined(GLFW_INCLUDE_GLU) |
| 159 | #include <GL/glu.h> |
| 160 | #endif |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 161 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 162 | |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 163 | #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 164 | /* GLFW_DLL must be defined by applications that are linking against the DLL |
| 165 | * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW |
| 166 | * configuration header when compiling the DLL version of the library. |
Camilla Berglund | bd2d571 | 2013-07-23 01:59:27 +0200 | [diff] [blame] | 167 | */ |
Camilla Berglund | 8f08661 | 2015-03-17 16:33:21 +0100 | [diff] [blame] | 168 | #error "You may not have both GLFW_DLL and _GLFW_BUILD_DLL defined" |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 169 | #endif |
| 170 | |
Camilla Berglund | 1591caa | 2015-01-08 06:56:17 +0100 | [diff] [blame] | 171 | /* GLFWAPI is used to declare public API functions for export |
| 172 | * from the DLL / shared library / dynamic library. |
| 173 | */ |
Camilla Berglund | 2588c9b | 2012-03-25 17:40:30 +0200 | [diff] [blame] | 174 | #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 175 | /* We are building GLFW as a Win32 DLL */ |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 176 | #define GLFWAPI __declspec(dllexport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 177 | #elif defined(_WIN32) && defined(GLFW_DLL) |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 178 | /* We are calling GLFW as a Win32 DLL */ |
Camilla Berglund | 1247fc0 | 2015-02-22 18:10:20 +0100 | [diff] [blame] | 179 | #define GLFWAPI __declspec(dllimport) |
John Bartholomew | 93f4eff | 2013-05-01 13:08:09 +0100 | [diff] [blame] | 180 | #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 181 | /* We are building GLFW as a shared / dynamic library */ |
John Bartholomew | 93f4eff | 2013-05-01 13:08:09 +0100 | [diff] [blame] | 182 | #define GLFWAPI __attribute__((visibility("default"))) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 183 | #else |
Camilla Berglund | 3afa831 | 2014-10-13 14:13:08 +0200 | [diff] [blame] | 184 | /* We are building or calling GLFW as a static library */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 185 | #define GLFWAPI |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 186 | #endif |
| 187 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 188 | |
| 189 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 190 | * GLFW API tokens |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 191 | *************************************************************************/ |
| 192 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 193 | /*! @name GLFW version macros |
| 194 | * @{ */ |
| 195 | /*! @brief The major version number of the GLFW library. |
| 196 | * |
| 197 | * This is incremented when the API is changed in non-compatible ways. |
| 198 | * @ingroup init |
| 199 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 200 | #define GLFW_VERSION_MAJOR 3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 201 | /*! @brief The minor version number of the GLFW library. |
| 202 | * |
| 203 | * This is incremented when features are added to the API but it remains |
| 204 | * backward-compatible. |
| 205 | * @ingroup init |
| 206 | */ |
Camilla Berglund | 95a07f3 | 2015-06-01 22:55:06 +0200 | [diff] [blame] | 207 | #define GLFW_VERSION_MINOR 2 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 208 | /*! @brief The revision number of the GLFW library. |
| 209 | * |
| 210 | * This is incremented when a bug fix release is made that does not contain any |
| 211 | * API changes. |
| 212 | * @ingroup init |
| 213 | */ |
Camilla Berglund | 95a07f3 | 2015-06-01 22:55:06 +0200 | [diff] [blame] | 214 | #define GLFW_VERSION_REVISION 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 215 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 216 | |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 217 | /*! @name Boolean values |
| 218 | * @{ */ |
| 219 | /*! @brief One. |
| 220 | * |
| 221 | * One. Seriously. You don't _need_ to use this symbol in your code. It's |
| 222 | * just semantic sugar for the number 1. You can use `1` or `true` or `_True` |
| 223 | * or `GL_TRUE` or whatever you want. |
| 224 | */ |
| 225 | #define GLFW_TRUE 1 |
| 226 | /*! @brief Zero. |
| 227 | * |
| 228 | * Zero. Seriously. You don't _need_ to use this symbol in your code. It's |
| 229 | * just just semantic sugar for the number 0. You can use `0` or `false` or |
| 230 | * `_False` or `GL_FALSE` or whatever you want. |
| 231 | */ |
| 232 | #define GLFW_FALSE 0 |
| 233 | /*! @} */ |
| 234 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 235 | /*! @name Key and button actions |
| 236 | * @{ */ |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 237 | /*! @brief The key or mouse button was released. |
| 238 | * |
| 239 | * The key or mouse button was released. |
| 240 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 241 | * @ingroup input |
| 242 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 243 | #define GLFW_RELEASE 0 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 244 | /*! @brief The key or mouse button was pressed. |
| 245 | * |
| 246 | * The key or mouse button was pressed. |
| 247 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 248 | * @ingroup input |
| 249 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 250 | #define GLFW_PRESS 1 |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 251 | /*! @brief The key was held down until it repeated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 252 | * |
| 253 | * The key was held down until it repeated. |
| 254 | * |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 255 | * @ingroup input |
| 256 | */ |
| 257 | #define GLFW_REPEAT 2 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 258 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 259 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 260 | /*! @defgroup keys Keyboard keys |
| 261 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 262 | * See [key input](@ref input_key) for how these are used. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 263 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 264 | * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), |
| 265 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
| 266 | * put in the 256+ range). |
| 267 | * |
| 268 | * The naming of the key codes follow these rules: |
| 269 | * - The US keyboard layout is used |
| 270 | * - Names of printable alpha-numeric characters are used (e.g. "A", "R", |
| 271 | * "3", etc.) |
| 272 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
| 273 | * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not |
| 274 | * correspond to the Unicode standard (usually for brevity) |
| 275 | * - Keys that lack a clear US mapping are named "WORLD_x" |
| 276 | * - For non-printable keys, custom names are used (e.g. "F4", |
| 277 | * "BACKSPACE", etc.) |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 278 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 279 | * @ingroup input |
| 280 | * @{ |
| 281 | */ |
| 282 | |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 283 | /* The unknown key */ |
| 284 | #define GLFW_KEY_UNKNOWN -1 |
| 285 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 286 | /* Printable keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 287 | #define GLFW_KEY_SPACE 32 |
| 288 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
| 289 | #define GLFW_KEY_COMMA 44 /* , */ |
| 290 | #define GLFW_KEY_MINUS 45 /* - */ |
| 291 | #define GLFW_KEY_PERIOD 46 /* . */ |
| 292 | #define GLFW_KEY_SLASH 47 /* / */ |
| 293 | #define GLFW_KEY_0 48 |
| 294 | #define GLFW_KEY_1 49 |
| 295 | #define GLFW_KEY_2 50 |
| 296 | #define GLFW_KEY_3 51 |
| 297 | #define GLFW_KEY_4 52 |
| 298 | #define GLFW_KEY_5 53 |
| 299 | #define GLFW_KEY_6 54 |
| 300 | #define GLFW_KEY_7 55 |
| 301 | #define GLFW_KEY_8 56 |
| 302 | #define GLFW_KEY_9 57 |
| 303 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
| 304 | #define GLFW_KEY_EQUAL 61 /* = */ |
| 305 | #define GLFW_KEY_A 65 |
| 306 | #define GLFW_KEY_B 66 |
| 307 | #define GLFW_KEY_C 67 |
| 308 | #define GLFW_KEY_D 68 |
| 309 | #define GLFW_KEY_E 69 |
| 310 | #define GLFW_KEY_F 70 |
| 311 | #define GLFW_KEY_G 71 |
| 312 | #define GLFW_KEY_H 72 |
| 313 | #define GLFW_KEY_I 73 |
| 314 | #define GLFW_KEY_J 74 |
| 315 | #define GLFW_KEY_K 75 |
| 316 | #define GLFW_KEY_L 76 |
| 317 | #define GLFW_KEY_M 77 |
| 318 | #define GLFW_KEY_N 78 |
| 319 | #define GLFW_KEY_O 79 |
| 320 | #define GLFW_KEY_P 80 |
| 321 | #define GLFW_KEY_Q 81 |
| 322 | #define GLFW_KEY_R 82 |
| 323 | #define GLFW_KEY_S 83 |
| 324 | #define GLFW_KEY_T 84 |
| 325 | #define GLFW_KEY_U 85 |
| 326 | #define GLFW_KEY_V 86 |
| 327 | #define GLFW_KEY_W 87 |
| 328 | #define GLFW_KEY_X 88 |
| 329 | #define GLFW_KEY_Y 89 |
| 330 | #define GLFW_KEY_Z 90 |
| 331 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
| 332 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
| 333 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
| 334 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
| 335 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
| 336 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 337 | |
| 338 | /* Function keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 339 | #define GLFW_KEY_ESCAPE 256 |
| 340 | #define GLFW_KEY_ENTER 257 |
| 341 | #define GLFW_KEY_TAB 258 |
| 342 | #define GLFW_KEY_BACKSPACE 259 |
| 343 | #define GLFW_KEY_INSERT 260 |
| 344 | #define GLFW_KEY_DELETE 261 |
| 345 | #define GLFW_KEY_RIGHT 262 |
| 346 | #define GLFW_KEY_LEFT 263 |
| 347 | #define GLFW_KEY_DOWN 264 |
| 348 | #define GLFW_KEY_UP 265 |
| 349 | #define GLFW_KEY_PAGE_UP 266 |
| 350 | #define GLFW_KEY_PAGE_DOWN 267 |
| 351 | #define GLFW_KEY_HOME 268 |
| 352 | #define GLFW_KEY_END 269 |
| 353 | #define GLFW_KEY_CAPS_LOCK 280 |
| 354 | #define GLFW_KEY_SCROLL_LOCK 281 |
| 355 | #define GLFW_KEY_NUM_LOCK 282 |
| 356 | #define GLFW_KEY_PRINT_SCREEN 283 |
| 357 | #define GLFW_KEY_PAUSE 284 |
| 358 | #define GLFW_KEY_F1 290 |
| 359 | #define GLFW_KEY_F2 291 |
| 360 | #define GLFW_KEY_F3 292 |
| 361 | #define GLFW_KEY_F4 293 |
| 362 | #define GLFW_KEY_F5 294 |
| 363 | #define GLFW_KEY_F6 295 |
| 364 | #define GLFW_KEY_F7 296 |
| 365 | #define GLFW_KEY_F8 297 |
| 366 | #define GLFW_KEY_F9 298 |
| 367 | #define GLFW_KEY_F10 299 |
| 368 | #define GLFW_KEY_F11 300 |
| 369 | #define GLFW_KEY_F12 301 |
| 370 | #define GLFW_KEY_F13 302 |
| 371 | #define GLFW_KEY_F14 303 |
| 372 | #define GLFW_KEY_F15 304 |
| 373 | #define GLFW_KEY_F16 305 |
| 374 | #define GLFW_KEY_F17 306 |
| 375 | #define GLFW_KEY_F18 307 |
| 376 | #define GLFW_KEY_F19 308 |
| 377 | #define GLFW_KEY_F20 309 |
| 378 | #define GLFW_KEY_F21 310 |
| 379 | #define GLFW_KEY_F22 311 |
| 380 | #define GLFW_KEY_F23 312 |
| 381 | #define GLFW_KEY_F24 313 |
| 382 | #define GLFW_KEY_F25 314 |
| 383 | #define GLFW_KEY_KP_0 320 |
| 384 | #define GLFW_KEY_KP_1 321 |
| 385 | #define GLFW_KEY_KP_2 322 |
| 386 | #define GLFW_KEY_KP_3 323 |
| 387 | #define GLFW_KEY_KP_4 324 |
| 388 | #define GLFW_KEY_KP_5 325 |
| 389 | #define GLFW_KEY_KP_6 326 |
| 390 | #define GLFW_KEY_KP_7 327 |
| 391 | #define GLFW_KEY_KP_8 328 |
| 392 | #define GLFW_KEY_KP_9 329 |
| 393 | #define GLFW_KEY_KP_DECIMAL 330 |
| 394 | #define GLFW_KEY_KP_DIVIDE 331 |
| 395 | #define GLFW_KEY_KP_MULTIPLY 332 |
| 396 | #define GLFW_KEY_KP_SUBTRACT 333 |
| 397 | #define GLFW_KEY_KP_ADD 334 |
| 398 | #define GLFW_KEY_KP_ENTER 335 |
| 399 | #define GLFW_KEY_KP_EQUAL 336 |
| 400 | #define GLFW_KEY_LEFT_SHIFT 340 |
| 401 | #define GLFW_KEY_LEFT_CONTROL 341 |
| 402 | #define GLFW_KEY_LEFT_ALT 342 |
| 403 | #define GLFW_KEY_LEFT_SUPER 343 |
| 404 | #define GLFW_KEY_RIGHT_SHIFT 344 |
| 405 | #define GLFW_KEY_RIGHT_CONTROL 345 |
| 406 | #define GLFW_KEY_RIGHT_ALT 346 |
| 407 | #define GLFW_KEY_RIGHT_SUPER 347 |
| 408 | #define GLFW_KEY_MENU 348 |
| 409 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 410 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 411 | /*! @} */ |
| 412 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 413 | /*! @defgroup mods Modifier key flags |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 414 | * |
| 415 | * See [key input](@ref input_key) for how these are used. |
| 416 | * |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 417 | * @ingroup input |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 418 | * @{ */ |
| 419 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 420 | /*! @brief 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] | 421 | */ |
| 422 | #define GLFW_MOD_SHIFT 0x0001 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 423 | /*! @brief 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] | 424 | */ |
Camilla Berglund | 3bcffba | 2013-05-23 14:11:05 +0200 | [diff] [blame] | 425 | #define GLFW_MOD_CONTROL 0x0002 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 426 | /*! @brief 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] | 427 | */ |
| 428 | #define GLFW_MOD_ALT 0x0004 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 429 | /*! @brief 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] | 430 | */ |
| 431 | #define GLFW_MOD_SUPER 0x0008 |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 432 | |
| 433 | /*! @} */ |
| 434 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 435 | /*! @defgroup buttons Mouse buttons |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 436 | * |
| 437 | * See [mouse button input](@ref input_mouse_button) for how these are used. |
| 438 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 439 | * @ingroup input |
| 440 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 441 | #define GLFW_MOUSE_BUTTON_1 0 |
| 442 | #define GLFW_MOUSE_BUTTON_2 1 |
| 443 | #define GLFW_MOUSE_BUTTON_3 2 |
| 444 | #define GLFW_MOUSE_BUTTON_4 3 |
| 445 | #define GLFW_MOUSE_BUTTON_5 4 |
| 446 | #define GLFW_MOUSE_BUTTON_6 5 |
| 447 | #define GLFW_MOUSE_BUTTON_7 6 |
| 448 | #define GLFW_MOUSE_BUTTON_8 7 |
| 449 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
| 450 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
| 451 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
| 452 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 453 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 454 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 455 | /*! @defgroup joysticks Joysticks |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 456 | * |
| 457 | * See [joystick input](@ref joystick) for how these are used. |
| 458 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 459 | * @ingroup input |
| 460 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 461 | #define GLFW_JOYSTICK_1 0 |
| 462 | #define GLFW_JOYSTICK_2 1 |
| 463 | #define GLFW_JOYSTICK_3 2 |
| 464 | #define GLFW_JOYSTICK_4 3 |
| 465 | #define GLFW_JOYSTICK_5 4 |
| 466 | #define GLFW_JOYSTICK_6 5 |
| 467 | #define GLFW_JOYSTICK_7 6 |
| 468 | #define GLFW_JOYSTICK_8 7 |
| 469 | #define GLFW_JOYSTICK_9 8 |
| 470 | #define GLFW_JOYSTICK_10 9 |
| 471 | #define GLFW_JOYSTICK_11 10 |
| 472 | #define GLFW_JOYSTICK_12 11 |
| 473 | #define GLFW_JOYSTICK_13 12 |
| 474 | #define GLFW_JOYSTICK_14 13 |
| 475 | #define GLFW_JOYSTICK_15 14 |
| 476 | #define GLFW_JOYSTICK_16 15 |
| 477 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 478 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 479 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 480 | /*! @defgroup errors Error codes |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 481 | * |
| 482 | * See [error handling](@ref error_handling) for how these are used. |
| 483 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 484 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 485 | * @{ */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 486 | /*! @brief GLFW has not been initialized. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 487 | * |
| 488 | * This occurs if a GLFW function was called that may not be called unless the |
| 489 | * library is [initialized](@ref intro_init). |
| 490 | * |
| 491 | * @par Analysis |
| 492 | * Application programmer error. Initialize GLFW before calling any function |
| 493 | * that requires initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 494 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 495 | #define GLFW_NOT_INITIALIZED 0x00010001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 496 | /*! @brief No context is current for this thread. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 497 | * |
| 498 | * This occurs if a GLFW function was called that needs and operates on the |
| 499 | * current OpenGL or OpenGL ES context but no context is current on the calling |
| 500 | * thread. One such function is @ref glfwSwapInterval. |
| 501 | * |
| 502 | * @par Analysis |
| 503 | * Application programmer error. Ensure a context is current before calling |
| 504 | * functions that require a current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 505 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 506 | #define GLFW_NO_CURRENT_CONTEXT 0x00010002 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 507 | /*! @brief One of the arguments to the function was an invalid enum value. |
| 508 | * |
| 509 | * One of the arguments to the function was an invalid enum value, for example |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 510 | * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref |
| 511 | * glfwGetWindowAttrib. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 512 | * |
| 513 | * @par Analysis |
| 514 | * Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 515 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 516 | #define GLFW_INVALID_ENUM 0x00010003 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 517 | /*! @brief One of the arguments to the function was an invalid value. |
| 518 | * |
| 519 | * One of the arguments to the function was an invalid value, for example |
| 520 | * requesting a non-existent OpenGL or OpenGL ES version like 2.7. |
| 521 | * |
| 522 | * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead |
| 523 | * result in a @ref GLFW_VERSION_UNAVAILABLE error. |
| 524 | * |
| 525 | * @par Analysis |
| 526 | * Application programmer error. Fix the offending call. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 527 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 528 | #define GLFW_INVALID_VALUE 0x00010004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 529 | /*! @brief A memory allocation failed. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 530 | * |
| 531 | * A memory allocation failed. |
| 532 | * |
| 533 | * @par Analysis |
| 534 | * A bug in GLFW or the underlying operating system. Report the bug to our |
| 535 | * [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 536 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 537 | #define GLFW_OUT_OF_MEMORY 0x00010005 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 538 | /*! @brief GLFW could not find support for the requested client API on the |
| 539 | * system. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 540 | * |
Camilla Berglund | d493a82 | 2015-03-10 19:51:14 +0100 | [diff] [blame] | 541 | * GLFW could not find support for the requested client API on the system. If |
| 542 | * emitted by functions other than @ref glfwCreateWindow, no supported client |
| 543 | * API was found. |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 544 | * |
| 545 | * @par Analysis |
| 546 | * The installed graphics driver does not support the requested client API, or |
| 547 | * does not support it via the chosen context creation backend. Below are |
| 548 | * a few examples. |
| 549 | * |
| 550 | * @par |
| 551 | * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only |
Camilla Berglund | d95b79f | 2015-03-30 23:20:49 +0200 | [diff] [blame] | 552 | * supports OpenGL ES via EGL, while Nvidia and Intel only support it via |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 553 | * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa |
Camilla Berglund | 138feb8 | 2015-01-05 16:46:04 +0100 | [diff] [blame] | 554 | * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 555 | * driver. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 556 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 557 | #define GLFW_API_UNAVAILABLE 0x00010006 |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 558 | /*! @brief The requested OpenGL or OpenGL ES version is not available. |
| 559 | * |
Camilla Berglund | d493a82 | 2015-03-10 19:51:14 +0100 | [diff] [blame] | 560 | * The requested OpenGL or OpenGL ES version (including any requested context |
| 561 | * or framebuffer hints) is not available on this machine. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 562 | * |
| 563 | * @par Analysis |
| 564 | * The machine does not support your requirements. If your application is |
| 565 | * sufficiently flexible, downgrade your requirements and try again. |
| 566 | * Otherwise, inform the user that their machine does not match your |
| 567 | * requirements. |
| 568 | * |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 569 | * @par |
| 570 | * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 |
| 571 | * comes out before the 4.x series gets that far, also fail with this error and |
| 572 | * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions |
| 573 | * will exist. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 574 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 575 | #define GLFW_VERSION_UNAVAILABLE 0x00010007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 576 | /*! @brief A platform-specific error occurred that does not match any of the |
| 577 | * more specific categories. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 578 | * |
| 579 | * A platform-specific error occurred that does not match any of the more |
| 580 | * specific categories. |
| 581 | * |
| 582 | * @par Analysis |
Camilla Berglund | d493a82 | 2015-03-10 19:51:14 +0100 | [diff] [blame] | 583 | * A bug or configuration error in GLFW, the underlying operating system or |
| 584 | * its drivers, or a lack of required resources. Report the issue to our |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 585 | * [issue tracker](https://github.com/glfw/glfw/issues). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 586 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 587 | #define GLFW_PLATFORM_ERROR 0x00010008 |
Camilla Berglund | 2d13eb0 | 2014-10-13 16:00:11 +0200 | [diff] [blame] | 588 | /*! @brief The requested format is not supported or available. |
| 589 | * |
| 590 | * If emitted during window creation, the requested pixel format is not |
| 591 | * supported. |
| 592 | * |
| 593 | * If emitted when querying the clipboard, the contents of the clipboard could |
| 594 | * not be converted to the requested format. |
| 595 | * |
| 596 | * @par Analysis |
| 597 | * If emitted during window creation, one or more |
| 598 | * [hard constraints](@ref window_hints_hard) did not match any of the |
| 599 | * available pixel formats. If your application is sufficiently flexible, |
| 600 | * downgrade your requirements and try again. Otherwise, inform the user that |
| 601 | * their machine does not match your requirements. |
| 602 | * |
| 603 | * @par |
| 604 | * If emitted when querying the clipboard, ignore the error or report it to |
| 605 | * the user, as appropriate. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 606 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 607 | #define GLFW_FORMAT_UNAVAILABLE 0x00010009 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 608 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 609 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 610 | #define GLFW_FOCUSED 0x00020001 |
| 611 | #define GLFW_ICONIFIED 0x00020002 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 612 | #define GLFW_RESIZABLE 0x00020003 |
| 613 | #define GLFW_VISIBLE 0x00020004 |
| 614 | #define GLFW_DECORATED 0x00020005 |
Camilla Berglund | 25e7ff1 | 2014-04-08 15:32:34 +0200 | [diff] [blame] | 615 | #define GLFW_AUTO_ICONIFY 0x00020006 |
Camilla Berglund | 3ce7bfe | 2014-05-23 14:01:02 +0200 | [diff] [blame] | 616 | #define GLFW_FLOATING 0x00020007 |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 617 | |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 618 | #define GLFW_RED_BITS 0x00021001 |
| 619 | #define GLFW_GREEN_BITS 0x00021002 |
| 620 | #define GLFW_BLUE_BITS 0x00021003 |
| 621 | #define GLFW_ALPHA_BITS 0x00021004 |
| 622 | #define GLFW_DEPTH_BITS 0x00021005 |
| 623 | #define GLFW_STENCIL_BITS 0x00021006 |
| 624 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
| 625 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
| 626 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
| 627 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
| 628 | #define GLFW_AUX_BUFFERS 0x0002100B |
| 629 | #define GLFW_STEREO 0x0002100C |
| 630 | #define GLFW_SAMPLES 0x0002100D |
| 631 | #define GLFW_SRGB_CAPABLE 0x0002100E |
Camilla Berglund | 2cd3438 | 2013-05-30 20:42:50 +0200 | [diff] [blame] | 632 | #define GLFW_REFRESH_RATE 0x0002100F |
Camilla Berglund | c980858 | 2014-04-24 19:21:10 +0200 | [diff] [blame] | 633 | #define GLFW_DOUBLEBUFFER 0x00021010 |
Camilla Berglund | deb0b3d | 2012-12-02 21:00:15 +0100 | [diff] [blame] | 634 | |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 635 | #define GLFW_CLIENT_API 0x00022001 |
| 636 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
| 637 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
| 638 | #define GLFW_CONTEXT_REVISION 0x00022004 |
| 639 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
| 640 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
| 641 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 |
| 642 | #define GLFW_OPENGL_PROFILE 0x00022008 |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 643 | #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 644 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 645 | #define GLFW_OPENGL_API 0x00030001 |
| 646 | #define GLFW_OPENGL_ES_API 0x00030002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 647 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 648 | #define GLFW_NO_ROBUSTNESS 0 |
| 649 | #define GLFW_NO_RESET_NOTIFICATION 0x00031001 |
| 650 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 651 | |
Camilla Berglund | 44e8401 | 2013-06-05 16:13:30 +0200 | [diff] [blame] | 652 | #define GLFW_OPENGL_ANY_PROFILE 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 653 | #define GLFW_OPENGL_CORE_PROFILE 0x00032001 |
| 654 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 655 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 656 | #define GLFW_CURSOR 0x00033001 |
| 657 | #define GLFW_STICKY_KEYS 0x00033002 |
| 658 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 659 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 660 | #define GLFW_CURSOR_NORMAL 0x00034001 |
| 661 | #define GLFW_CURSOR_HIDDEN 0x00034002 |
| 662 | #define GLFW_CURSOR_DISABLED 0x00034003 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 663 | |
Camilla Berglund | 44c899c | 2014-08-21 19:21:45 +0200 | [diff] [blame] | 664 | #define GLFW_ANY_RELEASE_BEHAVIOR 0 |
| 665 | #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 |
| 666 | #define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 |
| 667 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 668 | /*! @defgroup shapes Standard cursor shapes |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 669 | * |
| 670 | * See [standard cursor creation](@ref cursor_standard) for how these are used. |
| 671 | * |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 672 | * @ingroup input |
| 673 | * @{ */ |
| 674 | |
| 675 | /*! @brief The regular arrow cursor shape. |
| 676 | * |
| 677 | * The regular arrow cursor. |
| 678 | */ |
| 679 | #define GLFW_ARROW_CURSOR 0x00036001 |
| 680 | /*! @brief The text input I-beam cursor shape. |
| 681 | * |
| 682 | * The text input I-beam cursor shape. |
| 683 | */ |
| 684 | #define GLFW_IBEAM_CURSOR 0x00036002 |
| 685 | /*! @brief The crosshair shape. |
| 686 | * |
| 687 | * The crosshair shape. |
| 688 | */ |
| 689 | #define GLFW_CROSSHAIR_CURSOR 0x00036003 |
| 690 | /*! @brief The hand shape. |
| 691 | * |
| 692 | * The hand shape. |
| 693 | */ |
| 694 | #define GLFW_HAND_CURSOR 0x00036004 |
| 695 | /*! @brief The horizontal resize arrow shape. |
| 696 | * |
| 697 | * The horizontal resize arrow shape. |
| 698 | */ |
| 699 | #define GLFW_HRESIZE_CURSOR 0x00036005 |
| 700 | /*! @brief The vertical resize arrow shape. |
| 701 | * |
| 702 | * The vertical resize arrow shape. |
| 703 | */ |
| 704 | #define GLFW_VRESIZE_CURSOR 0x00036006 |
| 705 | /*! @} */ |
| 706 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 707 | #define GLFW_CONNECTED 0x00040001 |
| 708 | #define GLFW_DISCONNECTED 0x00040002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 709 | |
Camilla Berglund | 2810130 | 2014-04-08 18:57:43 +0200 | [diff] [blame] | 710 | #define GLFW_DONT_CARE -1 |
| 711 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 712 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 713 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 714 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 715 | *************************************************************************/ |
| 716 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 717 | /*! @brief Client API function pointer type. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 718 | * |
| 719 | * Generic function pointer used for returning client API function pointers |
| 720 | * without forcing a cast from a regular pointer. |
| 721 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 722 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 723 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 724 | typedef void (*GLFWglproc)(void); |
| 725 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 726 | /*! @brief Opaque monitor object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 727 | * |
| 728 | * Opaque monitor object. |
| 729 | * |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 730 | * @ingroup monitor |
| 731 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 732 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 733 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 734 | /*! @brief Opaque window object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 735 | * |
| 736 | * Opaque window object. |
| 737 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 738 | * @ingroup window |
| 739 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 740 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 741 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 742 | /*! @brief Opaque cursor object. |
| 743 | * |
| 744 | * Opaque cursor object. |
| 745 | * |
| 746 | * @ingroup cursor |
| 747 | */ |
| 748 | typedef struct GLFWcursor GLFWcursor; |
| 749 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 750 | /*! @brief The function signature for error callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 751 | * |
| 752 | * This is the function signature for error callback functions. |
| 753 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 754 | * @param[in] error An [error code](@ref errors). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 755 | * @param[in] description A UTF-8 encoded string describing the error. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 756 | * |
| 757 | * @sa glfwSetErrorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 758 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 759 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 760 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 761 | typedef void (* GLFWerrorfun)(int,const char*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 762 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 763 | /*! @brief The function signature for window position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 764 | * |
| 765 | * This is the function signature for window position callback functions. |
| 766 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 767 | * @param[in] window The window that was moved. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 768 | * @param[in] xpos The new x-coordinate, in screen coordinates, of the |
| 769 | * upper-left corner of the client area of the window. |
| 770 | * @param[in] ypos The new y-coordinate, in screen coordinates, of the |
| 771 | * upper-left corner of the client area of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 772 | * |
| 773 | * @sa glfwSetWindowPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 774 | * |
| 775 | * @ingroup window |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 776 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 777 | typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 778 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 779 | /*! @brief The function signature for window resize callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 780 | * |
| 781 | * This is the function signature for window size callback functions. |
| 782 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 783 | * @param[in] window The window that was resized. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 784 | * @param[in] width The new width, in screen coordinates, of the window. |
| 785 | * @param[in] height The new height, in screen coordinates, of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 786 | * |
| 787 | * @sa glfwSetWindowSizeCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 788 | * |
| 789 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 790 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 791 | typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 792 | |
| 793 | /*! @brief The function signature for window close callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 794 | * |
| 795 | * This is the function signature for window close callback functions. |
| 796 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 797 | * @param[in] window The window that the user attempted to close. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 798 | * |
| 799 | * @sa glfwSetWindowCloseCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 800 | * |
| 801 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 802 | */ |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 803 | typedef void (* GLFWwindowclosefun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 804 | |
| 805 | /*! @brief The function signature for window content refresh callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 806 | * |
| 807 | * This is the function signature for window refresh callback functions. |
| 808 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 809 | * @param[in] window The window whose content needs to be refreshed. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 810 | * |
| 811 | * @sa glfwSetWindowRefreshCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 812 | * |
| 813 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 814 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 815 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 816 | |
| 817 | /*! @brief The function signature for window focus/defocus callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 818 | * |
| 819 | * This is the function signature for window focus callback functions. |
| 820 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 821 | * @param[in] window The window that gained or lost input focus. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 822 | * @param[in] focused `GLFW_TRUE` if the window was given input focus, or |
| 823 | * `GLFW_FALSE` if it lost it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 824 | * |
| 825 | * @sa glfwSetWindowFocusCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 826 | * |
| 827 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 828 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 829 | typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 830 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 831 | /*! @brief The function signature for window iconify/restore callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 832 | * |
| 833 | * This is the function signature for window iconify/restore callback |
| 834 | * functions. |
| 835 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 836 | * @param[in] window The window that was iconified or restored. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 837 | * @param[in] iconified `GLFW_TRUE` if the window was iconified, or |
| 838 | * `GLFW_FALSE` if it was restored. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 839 | * |
| 840 | * @sa glfwSetWindowIconifyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 841 | * |
| 842 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 843 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 844 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 845 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 846 | /*! @brief The function signature for framebuffer resize callbacks. |
| 847 | * |
| 848 | * This is the function signature for framebuffer resize callback |
| 849 | * functions. |
| 850 | * |
| 851 | * @param[in] window The window whose framebuffer was resized. |
| 852 | * @param[in] width The new width, in pixels, of the framebuffer. |
| 853 | * @param[in] height The new height, in pixels, of the framebuffer. |
| 854 | * |
| 855 | * @sa glfwSetFramebufferSizeCallback |
| 856 | * |
| 857 | * @ingroup window |
| 858 | */ |
| 859 | typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); |
| 860 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 861 | /*! @brief The function signature for mouse button callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 862 | * |
| 863 | * This is the function signature for mouse button callback functions. |
| 864 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 865 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 866 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
| 867 | * released. |
| 868 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 869 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 870 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 871 | * |
| 872 | * @sa glfwSetMouseButtonCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 873 | * |
| 874 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 875 | */ |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 876 | typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 877 | |
| 878 | /*! @brief The function signature for cursor position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 879 | * |
| 880 | * This is the function signature for cursor position callback functions. |
| 881 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 882 | * @param[in] window The window that received the event. |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 883 | * @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor. |
| 884 | * @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 885 | * |
| 886 | * @sa glfwSetCursorPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 887 | * |
| 888 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 889 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 890 | typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 891 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 892 | /*! @brief The function signature for cursor enter/leave callbacks. |
| 893 | * |
| 894 | * This is the function signature for cursor enter/leave callback functions. |
| 895 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 896 | * @param[in] window The window that received the event. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 897 | * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client |
| 898 | * area, or `GLFW_FALSE` if it left it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 899 | * |
| 900 | * @sa glfwSetCursorEnterCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 901 | * |
| 902 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 903 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 904 | typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 905 | |
| 906 | /*! @brief The function signature for scroll callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 907 | * |
| 908 | * This is the function signature for scroll callback functions. |
| 909 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 910 | * @param[in] window The window that received the event. |
mewmew | cf2d260 | 2013-06-06 19:49:23 +0200 | [diff] [blame] | 911 | * @param[in] xoffset The scroll offset along the x-axis. |
| 912 | * @param[in] yoffset The scroll offset along the y-axis. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 913 | * |
| 914 | * @sa glfwSetScrollCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 915 | * |
| 916 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 917 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 918 | typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 919 | |
| 920 | /*! @brief The function signature for keyboard key callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 921 | * |
| 922 | * This is the function signature for keyboard key callback functions. |
| 923 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 924 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 925 | * @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] | 926 | * @param[in] scancode The system-specific scancode of the key. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 927 | * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 928 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 929 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 930 | * |
| 931 | * @sa glfwSetKeyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 932 | * |
| 933 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 934 | */ |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 935 | typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 936 | |
| 937 | /*! @brief The function signature for Unicode character callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 938 | * |
| 939 | * This is the function signature for Unicode character callback functions. |
| 940 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 941 | * @param[in] window The window that received the event. |
Camilla Berglund | 2c920fb | 2013-10-10 19:41:56 +0200 | [diff] [blame] | 942 | * @param[in] codepoint The Unicode code point of the character. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 943 | * |
| 944 | * @sa glfwSetCharCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 945 | * |
| 946 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 947 | */ |
Camilla Berglund | 182e0af | 2013-02-25 17:02:28 +0100 | [diff] [blame] | 948 | typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 949 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 950 | /*! @brief The function signature for Unicode character with modifiers |
| 951 | * callbacks. |
| 952 | * |
| 953 | * This is the function signature for Unicode character with modifiers callback |
| 954 | * functions. It is called for each input character, regardless of what |
| 955 | * modifier keys are held down. |
| 956 | * |
| 957 | * @param[in] window The window that received the event. |
| 958 | * @param[in] codepoint The Unicode code point of the character. |
| 959 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 960 | * held down. |
| 961 | * |
| 962 | * @sa glfwSetCharModsCallback |
| 963 | * |
| 964 | * @ingroup input |
| 965 | */ |
| 966 | typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); |
| 967 | |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 968 | /*! @brief The function signature for file drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 969 | * |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 970 | * This is the function signature for file drop callbacks. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 971 | * |
| 972 | * @param[in] window The window that received the event. |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 973 | * @param[in] count The number of dropped files. |
Camilla Berglund | 93855ae | 2015-01-27 23:04:22 +0100 | [diff] [blame] | 974 | * @param[in] paths The UTF-8 encoded file and/or directory path names. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 975 | * |
| 976 | * @sa glfwSetDropCallback |
| 977 | * |
| 978 | * @ingroup input |
| 979 | */ |
Camilla Berglund | 8f349e8 | 2013-12-22 19:28:46 +0100 | [diff] [blame] | 980 | typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**); |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 981 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 982 | /*! @brief The function signature for monitor configuration callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 983 | * |
| 984 | * This is the function signature for monitor configuration callback functions. |
| 985 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 986 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 987 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 988 | * |
| 989 | * @sa glfwSetMonitorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 990 | * |
| 991 | * @ingroup monitor |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 992 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 993 | typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 994 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 995 | /*! @brief Video mode type. |
| 996 | * |
| 997 | * This describes a single video mode. |
| 998 | * |
| 999 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1000 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1001 | typedef struct GLFWvidmode |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1002 | { |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1003 | /*! The width, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1004 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1005 | int width; |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 1006 | /*! The height, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1007 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1008 | int height; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1009 | /*! The bit depth of the red channel of the video mode. |
| 1010 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1011 | int redBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1012 | /*! The bit depth of the green channel of the video mode. |
| 1013 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 1014 | int greenBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1015 | /*! The bit depth of the blue channel of the video mode. |
| 1016 | */ |
Camilla Berglund | 2e8446f | 2013-04-11 01:31:00 +0200 | [diff] [blame] | 1017 | int blueBits; |
Camilla Berglund | 731812c | 2013-05-30 15:52:42 +0200 | [diff] [blame] | 1018 | /*! The refresh rate, in Hz, of the video mode. |
| 1019 | */ |
| 1020 | int refreshRate; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1021 | } GLFWvidmode; |
| 1022 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1023 | /*! @brief Gamma ramp. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1024 | * |
| 1025 | * This describes the gamma ramp for a monitor. |
| 1026 | * |
| 1027 | * @sa glfwGetGammaRamp glfwSetGammaRamp |
| 1028 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1029 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1030 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 1031 | typedef struct GLFWgammaramp |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1032 | { |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1033 | /*! An array of value describing the response of the red channel. |
| 1034 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1035 | unsigned short* red; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1036 | /*! An array of value describing the response of the green channel. |
| 1037 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1038 | unsigned short* green; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1039 | /*! An array of value describing the response of the blue channel. |
| 1040 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1041 | unsigned short* blue; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 1042 | /*! The number of elements in each array. |
| 1043 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1044 | unsigned int size; |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1045 | } GLFWgammaramp; |
| 1046 | |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 1047 | /*! @brief Image data. |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 1048 | */ |
| 1049 | typedef struct GLFWimage |
| 1050 | { |
| 1051 | /*! The width, in pixels, of this image. |
| 1052 | */ |
| 1053 | int width; |
| 1054 | /*! The height, in pixels, of this image. |
| 1055 | */ |
| 1056 | int height; |
| 1057 | /*! The pixel data of this image, arranged left-to-right, top-to-bottom. |
| 1058 | */ |
| 1059 | unsigned char* pixels; |
| 1060 | } GLFWimage; |
| 1061 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1062 | |
| 1063 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 1064 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1065 | *************************************************************************/ |
| 1066 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1067 | /*! @brief Initializes the GLFW library. |
| 1068 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1069 | * This function initializes the GLFW library. Before most GLFW functions can |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1070 | * be used, GLFW must be initialized, and before an application terminates GLFW |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1071 | * should be terminated in order to free any resources allocated during or |
| 1072 | * after initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1073 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1074 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1075 | * succeeds, you should call @ref glfwTerminate before the application exits. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1076 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1077 | * Additional calls to this function after successful initialization but before |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1078 | * termination will return `GLFW_TRUE` immediately. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1079 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 1080 | * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1081 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1082 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1083 | * @remarks __OS X:__ This function will change the current directory of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1084 | * application to the `Contents/Resources` subdirectory of the application's |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1085 | * bundle, if present. This can be disabled with a |
| 1086 | * [compile-time option](@ref compile_options_osx). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1087 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1088 | * @par Thread Safety |
| 1089 | * This function may only be called from the main thread. |
| 1090 | * |
| 1091 | * @sa @ref intro_init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1092 | * @sa glfwTerminate |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1093 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1094 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1095 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1096 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1097 | */ |
| 1098 | GLFWAPI int glfwInit(void); |
| 1099 | |
| 1100 | /*! @brief Terminates the GLFW library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1101 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1102 | * This function destroys all remaining windows and cursors, restores any |
| 1103 | * modified gamma ramps and frees any other allocated resources. Once this |
| 1104 | * function is called, you must again call @ref glfwInit successfully before |
| 1105 | * you will be able to use most GLFW functions. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1106 | * |
| 1107 | * If GLFW has been successfully initialized, this function should be called |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1108 | * before the application exits. If initialization fails, there is no need to |
| 1109 | * call this function, as it is called by @ref glfwInit before it returns |
| 1110 | * failure. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 1111 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1112 | * @remarks This function may be called before @ref glfwInit. |
| 1113 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1114 | * @warning No window's context may be current on another thread when this |
| 1115 | * function is called. |
| 1116 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 1117 | * @par Reentrancy |
| 1118 | * This function may not be called from a callback. |
| 1119 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1120 | * @par Thread Safety |
| 1121 | * This function may only be called from the main thread. |
| 1122 | * |
| 1123 | * @sa @ref intro_init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1124 | * @sa glfwInit |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1125 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1126 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1127 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1128 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1129 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1130 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1131 | |
| 1132 | /*! @brief Retrieves the version of the GLFW library. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1133 | * |
| 1134 | * This function retrieves the major, minor and revision numbers of the GLFW |
| 1135 | * library. It is intended for when you are using GLFW as a shared library and |
| 1136 | * want to ensure that you are using the minimum required version. |
| 1137 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1138 | * Any or all of the version arguments may be `NULL`. This function always |
| 1139 | * succeeds. |
| 1140 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1141 | * @param[out] major Where to store the major version number, or `NULL`. |
| 1142 | * @param[out] minor Where to store the minor version number, or `NULL`. |
| 1143 | * @param[out] rev Where to store the revision number, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1144 | * |
| 1145 | * @remarks This function may be called before @ref glfwInit. |
| 1146 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1147 | * @par Thread Safety |
| 1148 | * This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1149 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1150 | * @sa @ref intro_version |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1151 | * @sa glfwGetVersionString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1152 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1153 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1154 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1155 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1156 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1157 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1158 | |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 1159 | /*! @brief Returns a string describing the compile-time configuration. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1160 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1161 | * This function returns the compile-time generated |
| 1162 | * [version string](@ref intro_version_string) of the GLFW library binary. It |
| 1163 | * describes the version, platform, compiler and any platform-specific |
| 1164 | * compile-time options. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1165 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1166 | * __Do not use the version string__ to parse the GLFW library version. The |
| 1167 | * @ref glfwGetVersion function already provides the version of the running |
| 1168 | * library binary. |
| 1169 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1170 | * This function always succeeds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1171 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1172 | * @return The GLFW version string. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1173 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1174 | * @remarks This function may be called before @ref glfwInit. |
| 1175 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1176 | * @par Pointer Lifetime |
| 1177 | * The returned string is static and compile-time generated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1178 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1179 | * @par Thread Safety |
| 1180 | * This function may be called from any thread. |
| 1181 | * |
| 1182 | * @sa @ref intro_version |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1183 | * @sa glfwGetVersion |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1184 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1185 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1186 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1187 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1188 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 1189 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1190 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1191 | /*! @brief Sets the error callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1192 | * |
| 1193 | * This function sets the error callback, which is called with an error code |
| 1194 | * and a human-readable description each time a GLFW error occurs. |
| 1195 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1196 | * The error callback is called on the thread where the error occurred. If you |
| 1197 | * are using GLFW from multiple threads, your error callback needs to be |
| 1198 | * written accordingly. |
| 1199 | * |
| 1200 | * Because the description string may have been generated specifically for that |
| 1201 | * error, it is not guaranteed to be valid after the callback has returned. If |
| 1202 | * you wish to use it after the callback returns, you need to make a copy. |
| 1203 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 1204 | * Once set, the error callback remains set even after the library has been |
| 1205 | * terminated. |
| 1206 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1207 | * @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] | 1208 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1209 | * @return The previously set callback, or `NULL` if no callback was set. |
| 1210 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1211 | * @remarks This function may be called before @ref glfwInit. |
| 1212 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1213 | * @par Thread Safety |
| 1214 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1215 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1216 | * @sa @ref error_handling |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1217 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1218 | * @since Added in GLFW 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1219 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1220 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1221 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1222 | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 1223 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1224 | /*! @brief Returns the currently connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1225 | * |
| 1226 | * This function returns an array of handles for all currently connected |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1227 | * monitors. The primary monitor is always first in the returned array. If no |
| 1228 | * monitors were found, this function returns `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1229 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1230 | * @param[out] count Where to store the number of monitors in the returned |
| 1231 | * array. This is set to zero if an error occurred. |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1232 | * @return An array of monitor handles, or `NULL` if no monitors were found or |
| 1233 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1234 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1235 | * @par Pointer Lifetime |
| 1236 | * The returned array is allocated and freed by GLFW. You should not free it |
| 1237 | * yourself. It is guaranteed to be valid only until the monitor configuration |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 1238 | * changes or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1239 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1240 | * @par Thread Safety |
| 1241 | * This function may only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1242 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1243 | * @sa @ref monitor_monitors |
| 1244 | * @sa @ref monitor_event |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1245 | * @sa glfwGetPrimaryMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1246 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1247 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1248 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1249 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1250 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1251 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1252 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1253 | /*! @brief Returns the primary monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1254 | * |
| 1255 | * This function returns the primary monitor. This is usually the monitor |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1256 | * where elements like the task bar or global menu bar are located. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1257 | * |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1258 | * @return The primary monitor, or `NULL` if no monitors were found or if an |
| 1259 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1260 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1261 | * @par Thread Safety |
| 1262 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1263 | * |
Camilla Berglund | f5cbdba | 2015-09-17 16:37:09 +0200 | [diff] [blame] | 1264 | * @remarks The primary monitor is always first in the array returned by @ref |
| 1265 | * glfwGetMonitors. |
| 1266 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1267 | * @sa @ref monitor_monitors |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1268 | * @sa glfwGetMonitors |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1269 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1270 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1271 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1272 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1273 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1274 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1275 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1276 | /*! @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] | 1277 | * |
| 1278 | * This function returns the position, in screen coordinates, of the upper-left |
| 1279 | * corner of the specified monitor. |
| 1280 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1281 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 1282 | * non-`NULL` position arguments will be set to zero. |
| 1283 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1284 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1285 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 1286 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1287 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1288 | * @par Thread Safety |
| 1289 | * This function may only be called from the main thread. |
| 1290 | * |
| 1291 | * @sa @ref monitor_properties |
| 1292 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1293 | * @since Added in GLFW 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1294 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1295 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1296 | */ |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1297 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
| 1298 | |
| 1299 | /*! @brief Returns the physical size of the monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1300 | * |
| 1301 | * This function returns the size, in millimetres, of the display area of the |
| 1302 | * specified monitor. |
| 1303 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1304 | * Some systems do not provide accurate monitor size information, either |
| 1305 | * because the monitor |
| 1306 | * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) |
| 1307 | * data is incorrect or because the driver does not report it accurately. |
| 1308 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1309 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 1310 | * non-`NULL` size arguments will be set to zero. |
| 1311 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1312 | * @param[in] monitor The monitor to query. |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1313 | * @param[out] widthMM Where to store the width, in millimetres, of the |
| 1314 | * monitor's display area, or `NULL`. |
| 1315 | * @param[out] heightMM Where to store the height, in millimetres, of the |
| 1316 | * monitor's display area, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1317 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1318 | * @remarks __Windows:__ The OS calculates the returned physical size from the |
| 1319 | * current resolution and system DPI instead of querying the monitor EDID data. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1320 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1321 | * @par Thread Safety |
| 1322 | * This function may only be called from the main thread. |
| 1323 | * |
| 1324 | * @sa @ref monitor_properties |
| 1325 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1326 | * @since Added in GLFW 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1327 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1328 | * @ingroup monitor |
| 1329 | */ |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1330 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1331 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1332 | /*! @brief Returns the name of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1333 | * |
| 1334 | * 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] | 1335 | * specified monitor. The name typically reflects the make and model of the |
| 1336 | * monitor and is not guaranteed to be unique among the connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1337 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1338 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1339 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an |
| 1340 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1341 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1342 | * @par Pointer Lifetime |
| 1343 | * The returned string is allocated and freed by GLFW. You should not free it |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 1344 | * yourself. It is valid until the specified monitor is disconnected or the |
| 1345 | * library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1346 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1347 | * @par Thread Safety |
| 1348 | * This function may only be called from the main thread. |
| 1349 | * |
| 1350 | * @sa @ref monitor_properties |
| 1351 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1352 | * @since Added in GLFW 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1353 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1354 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1355 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1356 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1357 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1358 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1359 | * |
| 1360 | * This function sets the monitor configuration callback, or removes the |
| 1361 | * currently set callback. This is called when a monitor is connected to or |
| 1362 | * disconnected from the system. |
| 1363 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1364 | * @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] | 1365 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1366 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 1367 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1368 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1369 | * @bug __X11:__ This callback is not yet called on monitor configuration |
Camilla Berglund | c347b07 | 2013-06-12 20:57:37 +0200 | [diff] [blame] | 1370 | * changes. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1371 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1372 | * @par Thread Safety |
| 1373 | * This function may only be called from the main thread. |
| 1374 | * |
| 1375 | * @sa @ref monitor_event |
| 1376 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1377 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1378 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1379 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1380 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1381 | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 1382 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1383 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1384 | * |
| 1385 | * 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] | 1386 | * monitor. The returned array is sorted in ascending order, first by color |
| 1387 | * bit depth (the sum of all channel depths) and then by resolution area (the |
| 1388 | * product of width and height). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1389 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1390 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1391 | * @param[out] count Where to store the number of video modes in the returned |
| 1392 | * array. This is set to zero if an error occurred. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1393 | * @return An array of video modes, or `NULL` if an |
| 1394 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1395 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1396 | * @par Pointer Lifetime |
| 1397 | * The returned array is allocated and freed by GLFW. You should not free it |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 1398 | * yourself. It is valid until the specified monitor is disconnected, this |
| 1399 | * function is called again for that monitor or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1400 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1401 | * @par Thread Safety |
| 1402 | * This function may only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1403 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1404 | * @sa @ref monitor_modes |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1405 | * @sa glfwGetVideoMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1406 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1407 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1408 | * |
| 1409 | * @par |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1410 | * __GLFW 3:__ Changed to return an array of modes for a specific monitor. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1411 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1412 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1413 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1414 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1415 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1416 | /*! @brief Returns the current mode of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1417 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1418 | * This function returns the current video mode of the specified monitor. If |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1419 | * you have created a full screen window for that monitor, the return value |
| 1420 | * will depend on whether that window is iconified. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1421 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1422 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1423 | * @return The current mode of the monitor, or `NULL` if an |
| 1424 | * [error](@ref error_handling) occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1425 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1426 | * @par Pointer Lifetime |
| 1427 | * The returned array is allocated and freed by GLFW. You should not free it |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 1428 | * yourself. It is valid until the specified monitor is disconnected or the |
| 1429 | * library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1430 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1431 | * @par Thread Safety |
| 1432 | * This function may only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1433 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1434 | * @sa @ref monitor_modes |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1435 | * @sa glfwGetVideoModes |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1436 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1437 | * @since Added in GLFW 3.0. Replaces `glfwGetDesktopMode`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1438 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1439 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1440 | */ |
Camilla Berglund | ce1e84d | 2013-05-22 22:16:43 +0200 | [diff] [blame] | 1441 | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1442 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1443 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1444 | * |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1445 | * This function generates a 256-element gamma ramp from the specified exponent |
Camilla Berglund | 5bbc2b4 | 2015-03-15 15:40:43 +0100 | [diff] [blame] | 1446 | * and then calls @ref glfwSetGammaRamp with it. The value must be a finite |
| 1447 | * number greater than zero. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1448 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1449 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1450 | * @param[in] gamma The desired exponent. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1451 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1452 | * @par Thread Safety |
| 1453 | * This function may only be called from the main thread. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1454 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1455 | * @sa @ref monitor_gamma |
| 1456 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1457 | * @since Added in GLFW 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1458 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1459 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1460 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1461 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1462 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1463 | /*! @brief Returns the current gamma ramp for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1464 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1465 | * This function returns the current gamma ramp of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1466 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1467 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1468 | * @return The current gamma ramp, or `NULL` if an |
| 1469 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1470 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1471 | * @par Pointer Lifetime |
| 1472 | * The returned structure and its arrays are allocated and freed by GLFW. You |
| 1473 | * should not free them yourself. They are valid until the specified monitor |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 1474 | * is disconnected, this function is called again for that monitor or the |
| 1475 | * library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1476 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1477 | * @par Thread Safety |
| 1478 | * This function may only be called from the main thread. |
| 1479 | * |
| 1480 | * @sa @ref monitor_gamma |
| 1481 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1482 | * @since Added in GLFW 3.0. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1483 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1484 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1485 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1486 | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1487 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1488 | /*! @brief Sets the current gamma ramp for the specified monitor. |
| 1489 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1490 | * This function sets the current gamma ramp for the specified monitor. The |
| 1491 | * original gamma ramp for that monitor is saved by GLFW the first time this |
| 1492 | * function is called and is restored by @ref glfwTerminate. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1493 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1494 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1495 | * @param[in] ramp The gamma ramp to use. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 1496 | * |
Camilla Berglund | 76fff4d | 2015-03-10 19:02:28 +0100 | [diff] [blame] | 1497 | * @remarks Gamma ramp sizes other than 256 are not supported by all platforms |
| 1498 | * or graphics hardware. |
| 1499 | * |
| 1500 | * @remarks __Windows:__ The gamma ramp size must be 256. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1501 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1502 | * @par Pointer Lifetime |
| 1503 | * The specified gamma ramp is copied before this function returns. |
| 1504 | * |
| 1505 | * @par Thread Safety |
| 1506 | * This function may only be called from the main thread. |
| 1507 | * |
| 1508 | * @sa @ref monitor_gamma |
| 1509 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1510 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1511 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1512 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1513 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1514 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1515 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1516 | /*! @brief Resets all window hints to their default values. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1517 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1518 | * This function resets all window hints to their |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1519 | * [default values](@ref window_hints_values). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1520 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1521 | * @par Thread Safety |
| 1522 | * This function may only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1523 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1524 | * @sa @ref window_hints |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1525 | * @sa glfwWindowHint |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1526 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1527 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1528 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1529 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1530 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 1531 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1532 | |
| 1533 | /*! @brief Sets the specified window hint to the desired value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1534 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 1535 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 1536 | * hints, once set, retain their values until changed by a call to @ref |
| 1537 | * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 1538 | * terminated. |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 1539 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1540 | * @param[in] target The [window hint](@ref window_hints) to set. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1541 | * @param[in] hint The new value of the window hint. |
| 1542 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1543 | * @par Thread Safety |
| 1544 | * This function may only be called from the main thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 1545 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1546 | * @sa @ref window_hints |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1547 | * @sa glfwDefaultWindowHints |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1548 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1549 | * @since Added in GLFW 3.0. Replaces `glfwOpenWindowHint`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1550 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1551 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1552 | */ |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 1553 | GLFWAPI void glfwWindowHint(int target, int hint); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1554 | |
| 1555 | /*! @brief Creates a window and its associated context. |
| 1556 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1557 | * This function creates a window and its associated OpenGL or OpenGL ES |
| 1558 | * context. Most of the options controlling how the window and its context |
| 1559 | * should be created are specified with [window hints](@ref window_hints). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1560 | * |
| 1561 | * Successful creation does not change which context is current. Before you |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1562 | * can use the newly created context, you need to |
| 1563 | * [make it current](@ref context_current). For information about the `share` |
| 1564 | * parameter, see @ref context_sharing. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1565 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1566 | * The created window, framebuffer and context may differ from what you |
| 1567 | * requested, as not all parameters and hints are |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 1568 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1569 | * window, especially for full screen windows. To query the actual attributes |
Camilla Berglund | e8bceaa | 2015-04-07 14:37:42 +0200 | [diff] [blame] | 1570 | * of the created window, framebuffer and context, see @ref |
| 1571 | * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1572 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1573 | * To create a full screen window, you need to specify the monitor the window |
| 1574 | * will cover. If no monitor is specified, windowed mode will be used. Unless |
| 1575 | * you have a way for the user to choose a specific monitor, it is recommended |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1576 | * that you pick the primary monitor. For more information on how to query |
| 1577 | * connected monitors, see @ref monitor_monitors. |
Camilla Berglund | 4b7ae49 | 2013-07-07 12:06:59 +0200 | [diff] [blame] | 1578 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1579 | * For full screen windows, the specified size becomes the resolution of the |
| 1580 | * window's _desired video mode_. As long as a full screen window has input |
| 1581 | * focus, the supported video mode most closely matching the desired video mode |
| 1582 | * is set for the specified monitor. For more information about full screen |
| 1583 | * windows, including the creation of so called _windowed full screen_ or |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1584 | * _borderless full screen_ windows, see @ref window_windowed_full_screen. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1585 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1586 | * By default, newly created windows use the placement recommended by the |
| 1587 | * window system. To create the window at a specific position, make it |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1588 | * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window |
| 1589 | * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) |
| 1590 | * it. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1591 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1592 | * If a full screen window has input focus, the screensaver is prohibited from |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1593 | * starting. |
| 1594 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1595 | * Window systems put limits on window sizes. Very large or very small window |
| 1596 | * dimensions may be overridden by the window system on creation. Check the |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1597 | * actual [size](@ref window_size) after creation. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1598 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1599 | * 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] | 1600 | * the initial value may vary depending on driver settings and defaults. |
| 1601 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1602 | * @param[in] width The desired width, in screen coordinates, of the window. |
| 1603 | * This must be greater than zero. |
| 1604 | * @param[in] height The desired height, in screen coordinates, of the window. |
| 1605 | * This must be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1606 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1607 | * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1608 | * windowed mode. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1609 | * @param[in] share The window whose context to share resources with, or `NULL` |
| 1610 | * to not share resources. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1611 | * @return The handle of the created window, or `NULL` if an |
| 1612 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1613 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1614 | * @remarks __Windows:__ Window creation will fail if the Microsoft GDI |
Camilla Berglund | 07db5da | 2013-09-26 19:15:36 +0200 | [diff] [blame] | 1615 | * software OpenGL implementation is the only one available. |
| 1616 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1617 | * @remarks __Windows:__ If the executable has an icon resource named |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1618 | * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is |
| 1619 | * present, the `IDI_WINLOGO` icon will be used instead. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1620 | * |
Camilla Berglund | b19fb4c | 2014-12-27 21:14:41 +0100 | [diff] [blame] | 1621 | * @remarks __Windows:__ The context to share resources with may not be current |
| 1622 | * on any other thread. |
| 1623 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1624 | * @remarks __OS X:__ The GLFW window has no icon, as it is not a document |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1625 | * 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] | 1626 | * For more information on bundles, see the |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1627 | * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) |
| 1628 | * in the Mac Developer Library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1629 | * |
Camilla Berglund | 96d230b | 2014-10-07 02:15:36 +0200 | [diff] [blame] | 1630 | * @remarks __OS X:__ The first time a window is created the menu bar is |
| 1631 | * populated with common commands like Hide, Quit and About. The About entry |
| 1632 | * opens a minimal about dialog with information from the application's bundle. |
| 1633 | * The menu bar can be disabled with a |
| 1634 | * [compile-time option](@ref compile_options_osx). |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1635 | * |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 1636 | * @remarks __OS X:__ On OS X 10.10 and later the window frame will not be |
| 1637 | * rendered at full resolution on Retina displays unless the |
| 1638 | * `NSHighResolutionCapable` key is enabled in the application bundle's |
| 1639 | * `Info.plist`. For more information, see |
| 1640 | * [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] | 1641 | * in the Mac Developer Library. The GLFW test and example programs use |
| 1642 | * a custom `Info.plist` template for this, which can be found as |
| 1643 | * `CMake/MacOSXBundleInfo.plist.in` in the source tree. |
Camilla Berglund | 821f3e6 | 2015-03-16 22:39:14 +0100 | [diff] [blame] | 1644 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1645 | * @remarks __X11:__ There is no mechanism for setting the window icon yet. |
Camilla Berglund | b9fb45f | 2013-10-27 11:03:47 +0100 | [diff] [blame] | 1646 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1647 | * @remarks __X11:__ Some window managers will not respect the placement of |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 1648 | * initially hidden windows. |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 1649 | * |
Camilla Berglund | 20ed0a1 | 2015-08-12 21:31:54 +0200 | [diff] [blame] | 1650 | * @remarks __X11:__ Due to the asynchronous nature of X11, it may take |
| 1651 | * a moment for a window to reach its requested state. This means you may not |
| 1652 | * be able to query the final size, position or other attributes directly after |
| 1653 | * window creation. |
| 1654 | * |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 1655 | * @par Reentrancy |
| 1656 | * This function may not be called from a callback. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1657 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1658 | * @par Thread Safety |
| 1659 | * This function may only be called from the main thread. |
| 1660 | * |
| 1661 | * @sa @ref window_creation |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1662 | * @sa glfwDestroyWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1663 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1664 | * @since Added in GLFW 3.0. Replaces `glfwOpenWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1665 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1666 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1667 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1668 | 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] | 1669 | |
| 1670 | /*! @brief Destroys the specified window and its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1671 | * |
| 1672 | * This function destroys the specified window and its context. On calling |
| 1673 | * this function, no further callbacks will be called for that window. |
| 1674 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1675 | * If the context of the specified window is current on the main thread, it is |
| 1676 | * detached before being destroyed. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1677 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1678 | * @param[in] window The window to destroy. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1679 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1680 | * @note The context of the specified window must not be current on any other |
| 1681 | * thread when this function is called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1682 | * |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 1683 | * @par Reentrancy |
| 1684 | * This function may not be called from a callback. |
| 1685 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1686 | * @par Thread Safety |
| 1687 | * This function may only be called from the main thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1688 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1689 | * @sa @ref window_creation |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1690 | * @sa glfwCreateWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1691 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1692 | * @since Added in GLFW 3.0. Replaces `glfwCloseWindow`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1693 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1694 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1695 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1696 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1697 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1698 | /*! @brief Checks the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1699 | * |
| 1700 | * This function returns the value of the close flag of the specified window. |
| 1701 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1702 | * @param[in] window The window to query. |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1703 | * @return The value of the close flag. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1704 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1705 | * @par Thread Safety |
| 1706 | * This function may be called from any thread. Access is not synchronized. |
| 1707 | * |
| 1708 | * @sa @ref window_close |
| 1709 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1710 | * @since Added in GLFW 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 1711 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1712 | * @ingroup window |
| 1713 | */ |
| 1714 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
| 1715 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1716 | /*! @brief Sets the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1717 | * |
| 1718 | * This function sets the value of the close flag of the specified window. |
| 1719 | * This can be used to override the user's attempt to close the window, or |
| 1720 | * to signal that it should be closed. |
| 1721 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1722 | * @param[in] window The window whose flag to change. |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1723 | * @param[in] value The new value. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1724 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1725 | * @par Thread Safety |
| 1726 | * This function may be called from any thread. Access is not synchronized. |
| 1727 | * |
| 1728 | * @sa @ref window_close |
| 1729 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1730 | * @since Added in GLFW 3.0. |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 1731 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1732 | * @ingroup window |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1733 | */ |
| 1734 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
| 1735 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1736 | /*! @brief Sets the title of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1737 | * |
| 1738 | * This function sets the window title, encoded as UTF-8, of the specified |
| 1739 | * window. |
| 1740 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1741 | * @param[in] window The window whose title to change. |
| 1742 | * @param[in] title The UTF-8 encoded window title. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1743 | * |
Camilla Berglund | 6412dcb | 2015-04-07 21:52:29 +0200 | [diff] [blame] | 1744 | * @remarks __OS X:__ The window title will not be updated until the next time |
| 1745 | * you process events. |
| 1746 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1747 | * @par Thread Safety |
| 1748 | * This function may only be called from the main thread. |
| 1749 | * |
| 1750 | * @sa @ref window_title |
| 1751 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1752 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1753 | * |
| 1754 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1755 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1756 | * |
| 1757 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1758 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1759 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1760 | |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1761 | /*! @brief Retrieves the position of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1762 | * |
| 1763 | * This function retrieves the position, in screen coordinates, of the |
| 1764 | * upper-left corner of the client area of the specified window. |
| 1765 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1766 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 1767 | * non-`NULL` position arguments will be set to zero. |
| 1768 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1769 | * @param[in] window The window to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1770 | * @param[out] xpos Where to store the x-coordinate of the upper-left corner of |
| 1771 | * the client area, or `NULL`. |
| 1772 | * @param[out] ypos Where to store the y-coordinate of the upper-left corner of |
| 1773 | * the client area, or `NULL`. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1774 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1775 | * @par Thread Safety |
| 1776 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1777 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1778 | * @sa @ref window_pos |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1779 | * @sa glfwSetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1780 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1781 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1782 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1783 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1784 | */ |
| 1785 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
| 1786 | |
| 1787 | /*! @brief Sets the position of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1788 | * |
| 1789 | * This function sets the position, in screen coordinates, of the upper-left |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1790 | * corner of the client area of the specified windowed mode window. If the |
| 1791 | * window is a full screen window, this function does nothing. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1792 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1793 | * __Do not use this function__ to move an already visible window unless you |
| 1794 | * have very good reasons for doing so, as it will confuse and annoy the user. |
| 1795 | * |
| 1796 | * The window manager may put limits on what positions are allowed. GLFW |
| 1797 | * cannot and should not override these limits. |
| 1798 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1799 | * @param[in] window The window to query. |
| 1800 | * @param[in] xpos The x-coordinate of the upper-left corner of the client area. |
| 1801 | * @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] | 1802 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1803 | * @par Thread Safety |
| 1804 | * This function may only be called from the main thread. |
| 1805 | * |
| 1806 | * @sa @ref window_pos |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1807 | * @sa glfwGetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1808 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1809 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1810 | * |
| 1811 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1812 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1813 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1814 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1815 | */ |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 1816 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1817 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1818 | /*! @brief Retrieves the size of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1819 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1820 | * This function retrieves the size, in screen coordinates, of the client area |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 1821 | * 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] | 1822 | * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1823 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1824 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 1825 | * non-`NULL` size arguments will be set to zero. |
| 1826 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1827 | * @param[in] window The window whose size to retrieve. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1828 | * @param[out] width Where to store the width, in screen coordinates, of the |
| 1829 | * client area, or `NULL`. |
| 1830 | * @param[out] height Where to store the height, in screen coordinates, of the |
| 1831 | * client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1832 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1833 | * @par Thread Safety |
| 1834 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1835 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1836 | * @sa @ref window_size |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1837 | * @sa glfwSetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1838 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1839 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1840 | * |
| 1841 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1842 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1843 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1844 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1845 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1846 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1847 | |
Camilla Berglund | d84772d | 2014-02-13 02:57:59 +0100 | [diff] [blame^] | 1848 | /*! @brief Sets the size limits of the specified window. |
| 1849 | * |
| 1850 | * This function sets the size limits of the client area of the specified |
| 1851 | * window. If the window is full screen or not resizable, this function does |
| 1852 | * nothing. |
| 1853 | * |
| 1854 | * The size limits are applied immediately and may cause the window to be |
| 1855 | * resized. |
| 1856 | * |
| 1857 | * @param[in] window The window to set limits for. |
| 1858 | * @param[in] minwidth The minimum width, in screen coordinates, of the client |
| 1859 | * area, or `GLFW_DONT_CARE`. |
| 1860 | * @param[in] minheight The minimum height, in screen coordinates, of the |
| 1861 | * client area, or `GLFW_DONT_CARE`. |
| 1862 | * @param[in] maxwidth The maximum width, in screen coordinates, of the client |
| 1863 | * area, or `GLFW_DONT_CARE`. |
| 1864 | * @param[in] maxheight The maximum height, in screen coordinates, of the |
| 1865 | * client area, or `GLFW_DONT_CARE`. |
| 1866 | * |
| 1867 | * @remarks If you set size limits and an aspect ratio that conflict, the |
| 1868 | * results are undefined. |
| 1869 | * |
| 1870 | * @par Thread Safety |
| 1871 | * This function may only be called from the main thread. |
| 1872 | * |
| 1873 | * @sa @ref window_sizelimits |
| 1874 | * @sa glfwSetWindowAspectRatio |
| 1875 | * |
| 1876 | * @since Added in GLFW 3.2. |
| 1877 | * |
| 1878 | * @ingroup window |
| 1879 | */ |
| 1880 | GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); |
| 1881 | |
| 1882 | /*! @brief Sets the aspect ratio of the specified window. |
| 1883 | * |
| 1884 | * This function sets the required aspect ratio of the client area of the |
| 1885 | * specified window. If the window is full screen or not resizable, this |
| 1886 | * function does nothing. |
| 1887 | * |
| 1888 | * The aspect ratio is specified as a numerator and a denominator. For |
| 1889 | * example, the common 16:9 aspect ratio is specified as 16 and 9, |
| 1890 | * respectively. The denominator may not be zero. |
| 1891 | * |
| 1892 | * If the numerator and denominator is set to `GLFW_DONT_CARE` then the window |
| 1893 | * may be resized to any aspect ratio permitted by the window system and any |
| 1894 | * limits set by @ref glfwSetWindowSizeLimits. |
| 1895 | * |
| 1896 | * The aspect ratio is applied immediately and may cause the window to be |
| 1897 | * resized. |
| 1898 | * |
| 1899 | * @param[in] window The window to set limits for. |
| 1900 | * @param[in] numer The numerator of the desired aspect ratio, or |
| 1901 | * `GLFW_DONT_CARE`. |
| 1902 | * @param[in] denom The denominator of the desired aspect ratio, or |
| 1903 | * `GLFW_DONT_CARE`. |
| 1904 | * |
| 1905 | * @remarks If you set size limits and an aspect ratio that conflict, the |
| 1906 | * results are undefined. |
| 1907 | * |
| 1908 | * @par Thread Safety |
| 1909 | * This function may only be called from the main thread. |
| 1910 | * |
| 1911 | * @sa @ref window_sizelimits |
| 1912 | * @sa glfwSetWindowSizeLimits |
| 1913 | * |
| 1914 | * @since Added in GLFW 3.2. |
| 1915 | * |
| 1916 | * @ingroup window |
| 1917 | */ |
| 1918 | GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom); |
| 1919 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1920 | /*! @brief Sets the size of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1921 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1922 | * This function sets the size, in screen coordinates, of the client area of |
| 1923 | * the specified window. |
| 1924 | * |
| 1925 | * For full screen windows, this function selects and switches to the resolution |
| 1926 | * closest to the specified size, without affecting the window's context. As |
| 1927 | * the context is unaffected, the bit depths of the framebuffer remain |
| 1928 | * unchanged. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1929 | * |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 1930 | * The window manager may put limits on what sizes are allowed. GLFW cannot |
| 1931 | * and should not override these limits. |
| 1932 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1933 | * @param[in] window The window to resize. |
| 1934 | * @param[in] width The desired width of the specified window. |
| 1935 | * @param[in] height The desired height of the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1936 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1937 | * @par Thread Safety |
| 1938 | * This function may only be called from the main thread. |
| 1939 | * |
| 1940 | * @sa @ref window_size |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1941 | * @sa glfwGetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1942 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1943 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1944 | * |
| 1945 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 1946 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1947 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1948 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1949 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1950 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1951 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1952 | /*! @brief Retrieves the size of the framebuffer of the specified window. |
| 1953 | * |
| 1954 | * This function retrieves the size, in pixels, of the framebuffer of the |
Camilla Berglund | 521fa7d | 2013-09-26 20:02:19 +0200 | [diff] [blame] | 1955 | * specified window. If you wish to retrieve the size of the window in screen |
| 1956 | * coordinates, see @ref glfwGetWindowSize. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1957 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1958 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 1959 | * non-`NULL` size arguments will be set to zero. |
| 1960 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1961 | * @param[in] window The window whose framebuffer to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1962 | * @param[out] width Where to store the width, in pixels, of the framebuffer, |
| 1963 | * or `NULL`. |
| 1964 | * @param[out] height Where to store the height, in pixels, of the framebuffer, |
| 1965 | * or `NULL`. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1966 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1967 | * @par Thread Safety |
| 1968 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 1969 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1970 | * @sa @ref window_fbsize |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1971 | * @sa glfwSetFramebufferSizeCallback |
| 1972 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 1973 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1974 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1975 | * @ingroup window |
| 1976 | */ |
| 1977 | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); |
| 1978 | |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 1979 | /*! @brief Retrieves the size of the frame of the window. |
| 1980 | * |
| 1981 | * This function retrieves the size, in screen coordinates, of each edge of the |
| 1982 | * frame of the specified window. This size includes the title bar, if the |
| 1983 | * window has one. The size of the frame may vary depending on the |
| 1984 | * [window-related hints](@ref window_hints_wnd) used to create it. |
| 1985 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 1986 | * Because this function retrieves the size of each window frame edge and not |
| 1987 | * the offset along a particular coordinate axis, the retrieved values will |
| 1988 | * always be zero or positive. |
| 1989 | * |
| 1990 | * Any or all of the size arguments may be `NULL`. If an error occurs, all |
| 1991 | * non-`NULL` size arguments will be set to zero. |
| 1992 | * |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 1993 | * @param[in] window The window whose frame size to query. |
| 1994 | * @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] | 1995 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 1996 | * @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] | 1997 | * edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 1998 | * @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] | 1999 | * right edge of the window frame, or `NULL`. |
Camilla Berglund | eaff0f7 | 2014-04-07 16:27:32 +0200 | [diff] [blame] | 2000 | * @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] | 2001 | * bottom edge of the window frame, or `NULL`. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2002 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2003 | * @par Thread Safety |
| 2004 | * This function may only be called from the main thread. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2005 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2006 | * @sa @ref window_size |
| 2007 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2008 | * @since Added in GLFW 3.1. |
Camilla Berglund | eb3f75e | 2014-03-25 21:30:13 +0100 | [diff] [blame] | 2009 | * |
| 2010 | * @ingroup window |
| 2011 | */ |
| 2012 | GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); |
| 2013 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2014 | /*! @brief Iconifies the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2015 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2016 | * This function iconifies (minimizes) the specified window if it was |
| 2017 | * previously restored. If the window is already iconified, this function does |
| 2018 | * nothing. |
| 2019 | * |
| 2020 | * If the specified window is a full screen window, the original monitor |
| 2021 | * resolution is restored until the window is restored. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2022 | * |
| 2023 | * @param[in] window The window to iconify. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2024 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2025 | * @par Thread Safety |
| 2026 | * This function may only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2027 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2028 | * @sa @ref window_iconify |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2029 | * @sa glfwRestoreWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2030 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2031 | * @since Added in GLFW 2.1. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2032 | * |
| 2033 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2034 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2035 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2036 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2037 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2038 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2039 | |
| 2040 | /*! @brief Restores the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2041 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2042 | * This function restores the specified window if it was previously iconified |
| 2043 | * (minimized). If the window is already restored, this function does nothing. |
| 2044 | * |
| 2045 | * If the specified window is a full screen window, the resolution chosen for |
| 2046 | * the window is restored on the selected monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2047 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2048 | * @param[in] window The window to restore. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2049 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2050 | * @par Thread Safety |
| 2051 | * This function may only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2052 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2053 | * @sa @ref window_iconify |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2054 | * @sa glfwIconifyWindow |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2055 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2056 | * @since Added in GLFW 2.1. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2057 | * |
| 2058 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2059 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2060 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2061 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2062 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2063 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2064 | |
| 2065 | /*! @brief Makes the specified window visible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2066 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2067 | * This function makes the specified window visible if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2068 | * 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] | 2069 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2070 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2071 | * @param[in] window The window to make visible. |
| 2072 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2073 | * @par Thread Safety |
| 2074 | * This function may only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2075 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2076 | * @sa @ref window_hide |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2077 | * @sa glfwHideWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2078 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2079 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2080 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2081 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2082 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2083 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2084 | |
| 2085 | /*! @brief Hides the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2086 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2087 | * This function hides the specified window if it was previously visible. If |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2088 | * 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] | 2089 | * nothing. |
| 2090 | * |
| 2091 | * @param[in] window The window to hide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2092 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2093 | * @par Thread Safety |
| 2094 | * This function may only be called from the main thread. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2095 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2096 | * @sa @ref window_hide |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2097 | * @sa glfwShowWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2098 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2099 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2100 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2101 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2102 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2103 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2104 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2105 | /*! @brief Returns the monitor that the window uses for full screen mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2106 | * |
| 2107 | * 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] | 2108 | * in full screen on. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2109 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2110 | * @param[in] window The window to query. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2111 | * @return The monitor, or `NULL` if the window is in windowed mode or an error |
| 2112 | * occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2113 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2114 | * @par Thread Safety |
| 2115 | * This function may only be called from the main thread. |
| 2116 | * |
| 2117 | * @sa @ref window_monitor |
| 2118 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2119 | * @since Added in GLFW 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2120 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 2121 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2122 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2123 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 2124 | |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 2125 | /*! @brief Returns an attribute of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2126 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2127 | * This function returns the value of an attribute of the specified window or |
| 2128 | * its OpenGL or OpenGL ES context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2129 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 2130 | * @param[in] window The window to query. |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 2131 | * @param[in] attrib The [window attribute](@ref window_attribs) whose value to |
| 2132 | * return. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2133 | * @return The value of the attribute, or zero if an |
| 2134 | * [error](@ref error_handling) occurred. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 2135 | * |
Camilla Berglund | 59abeeb | 2015-04-07 14:34:12 +0200 | [diff] [blame] | 2136 | * @remarks Framebuffer related hints are not window attributes. See @ref |
| 2137 | * window_attribs_fb for more information. |
| 2138 | * |
| 2139 | * @remarks Zero is a valid value for many window and context related |
| 2140 | * attributes so you cannot use a return value of zero as an indication of |
| 2141 | * errors. However, this function should not fail as long as it is passed |
| 2142 | * valid arguments and the library has been [initialized](@ref intro_init). |
| 2143 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2144 | * @par Thread Safety |
| 2145 | * This function may only be called from the main thread. |
| 2146 | * |
| 2147 | * @sa @ref window_attribs |
| 2148 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2149 | * @since Added in GLFW 3.0. Replaces `glfwGetWindowParam` and |
| 2150 | * `glfwGetGLVersion`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2151 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2152 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2153 | */ |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 2154 | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2155 | |
| 2156 | /*! @brief Sets the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2157 | * |
| 2158 | * This function sets the user-defined pointer of the specified window. The |
| 2159 | * current value is retained until the window is destroyed. The initial value |
| 2160 | * is `NULL`. |
| 2161 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2162 | * @param[in] window The window whose pointer to set. |
| 2163 | * @param[in] pointer The new value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2164 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2165 | * @par Thread Safety |
| 2166 | * This function may be called from any thread. Access is not synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2167 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2168 | * @sa @ref window_userptr |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2169 | * @sa glfwGetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2170 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2171 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2172 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2173 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2174 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2175 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2176 | |
| 2177 | /*! @brief Returns the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2178 | * |
| 2179 | * This function returns the current value of the user-defined pointer of the |
| 2180 | * specified window. The initial value is `NULL`. |
| 2181 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2182 | * @param[in] window The window whose pointer to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2183 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2184 | * @par Thread Safety |
| 2185 | * This function may be called from any thread. Access is not synchronized. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2186 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2187 | * @sa @ref window_userptr |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2188 | * @sa glfwSetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2189 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2190 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2191 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2192 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2193 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2194 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2195 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 2196 | /*! @brief Sets the position callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2197 | * |
| 2198 | * This function sets the position callback of the specified window, which is |
| 2199 | * called when the window is moved. The callback is provided with the screen |
| 2200 | * position of the upper-left corner of the client area of the window. |
| 2201 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 2202 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2203 | * @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] | 2204 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2205 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2206 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2207 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2208 | * @par Thread Safety |
| 2209 | * This function may only be called from the main thread. |
| 2210 | * |
| 2211 | * @sa @ref window_pos |
| 2212 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2213 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2214 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 2215 | * @ingroup window |
| 2216 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2217 | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 2218 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2219 | /*! @brief Sets the size callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2220 | * |
| 2221 | * This function sets the size callback of the specified window, which is |
| 2222 | * 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] | 2223 | * in screen coordinates, of the client area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2224 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2225 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2226 | * @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] | 2227 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2228 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2229 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2230 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2231 | * @par Thread Safety |
| 2232 | * This function may only be called from the main thread. |
| 2233 | * |
| 2234 | * @sa @ref window_size |
| 2235 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2236 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2237 | * |
| 2238 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2239 | * __GLFW 3:__ Added window handle parameter. Updated callback signature. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2240 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2241 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2242 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2243 | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2244 | |
| 2245 | /*! @brief Sets the close callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2246 | * |
| 2247 | * This function sets the close callback of the specified window, which is |
| 2248 | * called when the user attempts to close the window, for example by clicking |
| 2249 | * the close widget in the title bar. |
| 2250 | * |
| 2251 | * The close flag is set before this callback is called, but you can modify it |
| 2252 | * at any time with @ref glfwSetWindowShouldClose. |
| 2253 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2254 | * The close callback is not triggered by @ref glfwDestroyWindow. |
| 2255 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2256 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2257 | * @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] | 2258 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2259 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2260 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2261 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2262 | * @remarks __OS X:__ Selecting Quit from the application menu will |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 2263 | * trigger the close callback for all windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2264 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2265 | * @par Thread Safety |
| 2266 | * This function may only be called from the main thread. |
| 2267 | * |
| 2268 | * @sa @ref window_close |
| 2269 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2270 | * @since Added in GLFW 2.5. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2271 | * |
| 2272 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2273 | * __GLFW 3:__ Added window handle parameter. Updated callback signature. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2274 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2275 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2276 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2277 | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2278 | |
| 2279 | /*! @brief Sets the refresh callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2280 | * |
| 2281 | * This function sets the refresh callback of the specified window, which is |
| 2282 | * called when the client area of the window needs to be redrawn, for example |
| 2283 | * if the window has been exposed after having been covered by another window. |
| 2284 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2285 | * On compositing window systems such as Aero, Compiz or Aqua, where the window |
| 2286 | * contents are saved off-screen, this callback may be called only very |
| 2287 | * infrequently or never at all. |
| 2288 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2289 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2290 | * @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] | 2291 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2292 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2293 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2294 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2295 | * @par Thread Safety |
| 2296 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2297 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2298 | * @sa @ref window_refresh |
| 2299 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2300 | * @since Added in GLFW 2.5. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2301 | * |
| 2302 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2303 | * __GLFW 3:__ Added window handle parameter. Updated callback signature. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 2304 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2305 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2306 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2307 | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2308 | |
| 2309 | /*! @brief Sets the focus callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2310 | * |
| 2311 | * This function sets the focus callback of the specified window, which is |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2312 | * called when the window gains or loses input focus. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2313 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2314 | * After the focus callback is called for a window that lost input focus, |
| 2315 | * synthetic key and mouse button release events will be generated for all such |
| 2316 | * that had been pressed. For more information, see @ref glfwSetKeyCallback |
| 2317 | * and @ref glfwSetMouseButtonCallback. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 2318 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2319 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2320 | * @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] | 2321 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2322 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2323 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2324 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2325 | * @par Thread Safety |
| 2326 | * This function may only be called from the main thread. |
| 2327 | * |
| 2328 | * @sa @ref window_focus |
| 2329 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2330 | * @since Added in GLFW 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2331 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2332 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2333 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2334 | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2335 | |
| 2336 | /*! @brief Sets the iconify callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2337 | * |
| 2338 | * This function sets the iconification callback of the specified window, which |
| 2339 | * is called when the window is iconified or restored. |
| 2340 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2341 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2342 | * @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] | 2343 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2344 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2345 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2346 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2347 | * @par Thread Safety |
| 2348 | * This function may only be called from the main thread. |
| 2349 | * |
| 2350 | * @sa @ref window_iconify |
| 2351 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2352 | * @since Added in GLFW 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2353 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2354 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2355 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2356 | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 2357 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2358 | /*! @brief Sets the framebuffer resize callback for the specified window. |
| 2359 | * |
| 2360 | * This function sets the framebuffer resize callback of the specified window, |
| 2361 | * which is called when the framebuffer of the specified window is resized. |
| 2362 | * |
| 2363 | * @param[in] window The window whose callback to set. |
| 2364 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 2365 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2366 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2367 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2368 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2369 | * @par Thread Safety |
| 2370 | * This function may only be called from the main thread. |
| 2371 | * |
| 2372 | * @sa @ref window_fbsize |
| 2373 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2374 | * @since Added in GLFW 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2375 | * |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 2376 | * @ingroup window |
| 2377 | */ |
| 2378 | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun); |
| 2379 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2380 | /*! @brief Processes all pending events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2381 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2382 | * This function processes only those events that are already in the event |
| 2383 | * queue and then returns immediately. Processing events will cause the window |
| 2384 | * and input callbacks associated with those events to be called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2385 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2386 | * On some platforms, a window move, resize or menu operation will cause event |
| 2387 | * processing to block. This is due to how event processing is designed on |
| 2388 | * those platforms. You can use the |
| 2389 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 2390 | * your window when necessary during such operations. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2391 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2392 | * On some platforms, certain events are sent directly to the application |
| 2393 | * without going through the event queue, causing callbacks to be called |
| 2394 | * outside of a call to one of the event processing functions. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 2395 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2396 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2397 | * |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 2398 | * @par Reentrancy |
| 2399 | * This function may not be called from a callback. |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 2400 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2401 | * @par Thread Safety |
| 2402 | * This function may only be called from the main thread. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2403 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2404 | * @sa @ref events |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2405 | * @sa glfwWaitEvents |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2406 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2407 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2408 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2409 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2410 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 2411 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2412 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2413 | /*! @brief Waits until events are queued and processes them. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2414 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2415 | * This function puts the calling thread to sleep until at least one event is |
| 2416 | * available in the event queue. Once one or more events are available, |
| 2417 | * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue |
| 2418 | * are processed and the function then returns immediately. Processing events |
| 2419 | * will cause the window and input callbacks associated with those events to be |
| 2420 | * called. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2421 | * |
| 2422 | * Since not all events are associated with callbacks, this function may return |
| 2423 | * without a callback having been called even if you are monitoring all |
| 2424 | * callbacks. |
| 2425 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2426 | * On some platforms, a window move, resize or menu operation will cause event |
| 2427 | * processing to block. This is due to how event processing is designed on |
| 2428 | * those platforms. You can use the |
| 2429 | * [window refresh callback](@ref window_refresh) to redraw the contents of |
| 2430 | * your window when necessary during such operations. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2431 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2432 | * On some platforms, certain callbacks may be called outside of a call to one |
| 2433 | * of the event processing functions. |
| 2434 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2435 | * If no windows exist, this function returns immediately. For synchronization |
| 2436 | * of threads in applications that do not create windows, use your threading |
| 2437 | * library of choice. |
Camilla Berglund | 2ae46fa | 2013-12-04 19:12:24 +0100 | [diff] [blame] | 2438 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2439 | * Event processing is not required for joystick input to work. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 2440 | * |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 2441 | * @par Reentrancy |
| 2442 | * This function may not be called from a callback. |
| 2443 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2444 | * @par Thread Safety |
| 2445 | * This function may only be called from the main thread. |
| 2446 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2447 | * @sa @ref events |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2448 | * @sa glfwPollEvents |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2449 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2450 | * @since Added in GLFW 2.5. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2451 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2452 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2453 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 2454 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 2455 | |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 2456 | /*! @brief Posts an empty event to the event queue. |
| 2457 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2458 | * This function posts an empty event from the current thread to the event |
| 2459 | * queue, causing @ref glfwWaitEvents to return. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 2460 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2461 | * If no windows exist, this function returns immediately. For synchronization |
| 2462 | * of threads in applications that do not create windows, use your threading |
| 2463 | * library of choice. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 2464 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2465 | * @par Thread Safety |
| 2466 | * This function may be called from any thread. |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 2467 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2468 | * @sa @ref events |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 2469 | * @sa glfwWaitEvents |
| 2470 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2471 | * @since Added in GLFW 3.1. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2472 | * |
Camilla Berglund | 1ccc232 | 2014-02-10 18:16:58 +0100 | [diff] [blame] | 2473 | * @ingroup window |
| 2474 | */ |
| 2475 | GLFWAPI void glfwPostEmptyEvent(void); |
| 2476 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2477 | /*! @brief Returns the value of an input option for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2478 | * |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2479 | * This function returns the value of an input option for the specified window. |
| 2480 | * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
| 2481 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
| 2482 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2483 | * @param[in] window The window to query. |
Camilla Berglund | 9264b5d | 2013-04-26 14:29:55 +0200 | [diff] [blame] | 2484 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 2485 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2486 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2487 | * @par Thread Safety |
| 2488 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2489 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2490 | * @sa glfwSetInputMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2491 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2492 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2493 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2494 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2495 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2496 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2497 | |
| 2498 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2499 | * |
| 2500 | * This function sets an input mode option for the specified window. The mode |
| 2501 | * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2502 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2503 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2504 | * 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] | 2505 | * modes: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 2506 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
| 2507 | * - `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] | 2508 | * area of the window but does not restrict the cursor from leaving. |
Camilla Berglund | a18b187 | 2013-12-05 03:27:12 +0100 | [diff] [blame] | 2509 | * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual |
| 2510 | * and unlimited cursor movement. This is useful for implementing for |
| 2511 | * example 3D camera controls. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 2512 | * |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 2513 | * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to |
| 2514 | * 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] | 2515 | * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS` |
| 2516 | * the next time it is called even if the key had been released before the |
| 2517 | * call. This is useful when you are only interested in whether keys have been |
| 2518 | * pressed but not when or in which order. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 2519 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2520 | * 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] | 2521 | * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it. |
| 2522 | * If sticky mouse buttons are enabled, a mouse button press will ensure that |
| 2523 | * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even |
| 2524 | * if the mouse button had been released before the call. This is useful when |
| 2525 | * you are only interested in whether mouse buttons have been pressed but not |
| 2526 | * when or in which order. |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2527 | * |
| 2528 | * @param[in] window The window whose input mode to set. |
| 2529 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
| 2530 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
| 2531 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 2532 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2533 | * @par Thread Safety |
| 2534 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2535 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2536 | * @sa glfwGetInputMode |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2537 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2538 | * @since Added in GLFW 3.0. Replaces `glfwEnable` and `glfwDisable`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2539 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2540 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2541 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2542 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2543 | |
| 2544 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 2545 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2546 | * |
| 2547 | * This function returns the last state reported for the specified key to the |
| 2548 | * specified window. The returned state is one of `GLFW_PRESS` or |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2549 | * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2550 | * the key callback. |
| 2551 | * |
| 2552 | * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2553 | * `GLFW_PRESS` the first time you call it for a key that was pressed, even if |
| 2554 | * that key has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2555 | * |
| 2556 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 2557 | * named after their use on the standard US keyboard layout. If you want to |
| 2558 | * input text, use the Unicode character callback instead. |
| 2559 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2560 | * The [modifier key bit masks](@ref mods) are not key tokens and cannot be |
| 2561 | * used with this function. |
| 2562 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2563 | * @param[in] window The desired window. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2564 | * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is |
| 2565 | * not a valid key for this function. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2566 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2567 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2568 | * @par Thread Safety |
| 2569 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2570 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2571 | * @sa @ref input_key |
| 2572 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2573 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2574 | * |
| 2575 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2576 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 2577 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2578 | * @ingroup input |
| 2579 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2580 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2581 | |
| 2582 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 2583 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2584 | * |
| 2585 | * This function returns the last state reported for the specified mouse button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2586 | * 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] | 2587 | * `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2588 | * |
| 2589 | * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2590 | * `GLFW_PRESS` the first time you call it for a mouse button that was pressed, |
| 2591 | * even if that mouse button has already been released. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2592 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2593 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2594 | * @param[in] button The desired [mouse button](@ref buttons). |
| 2595 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2596 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2597 | * @par Thread Safety |
| 2598 | * This function may only be called from the main thread. |
| 2599 | * |
| 2600 | * @sa @ref input_mouse_button |
| 2601 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2602 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2603 | * |
| 2604 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2605 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2606 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2607 | * @ingroup input |
| 2608 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2609 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2610 | |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 2611 | /*! @brief Retrieves the position of the cursor relative to the client area of |
| 2612 | * the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2613 | * |
Camilla Berglund | d459145 | 2014-02-11 18:24:01 +0100 | [diff] [blame] | 2614 | * This function returns the position of the cursor, in screen coordinates, |
| 2615 | * relative to the upper-left corner of the client area of the specified |
| 2616 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2617 | * |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 2618 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
| 2619 | * position is unbounded and limited only by the minimum and maximum values of |
| 2620 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2621 | * |
Camilla Berglund | 3ec2925 | 2013-04-25 18:03:15 +0200 | [diff] [blame] | 2622 | * The coordinate can be converted to their integer equivalents with the |
| 2623 | * `floor` function. Casting directly to an integer type works for positive |
| 2624 | * coordinates, but fails for negative ones. |
| 2625 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2626 | * Any or all of the position arguments may be `NULL`. If an error occurs, all |
| 2627 | * non-`NULL` position arguments will be set to zero. |
| 2628 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2629 | * @param[in] window The desired window. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2630 | * @param[out] xpos Where to store the cursor x-coordinate, relative to the |
| 2631 | * left edge of the client area, or `NULL`. |
| 2632 | * @param[out] ypos Where to store the cursor y-coordinate, relative to the to |
| 2633 | * top edge of the client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2634 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2635 | * @par Thread Safety |
| 2636 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2637 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2638 | * @sa @ref cursor_pos |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2639 | * @sa glfwSetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2640 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2641 | * @since Added in GLFW 3.0. Replaces `glfwGetMousePos`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2642 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2643 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2644 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 2645 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2646 | |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 2647 | /*! @brief Sets the position of the cursor, relative to the client area of the |
| 2648 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2649 | * |
Camilla Berglund | 6d9d856 | 2013-09-28 22:12:50 +0200 | [diff] [blame] | 2650 | * This function sets the position, in screen coordinates, of the cursor |
| 2651 | * 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] | 2652 | * window. The window must have input focus. If the window does not have |
| 2653 | * input focus when this function is called, it fails silently. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2654 | * |
Camilla Berglund | 2085876 | 2015-01-01 18:41:22 +0100 | [diff] [blame] | 2655 | * __Do not use this function__ to implement things like camera controls. GLFW |
| 2656 | * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the |
| 2657 | * cursor, transparently re-centers it and provides unconstrained cursor |
| 2658 | * motion. See @ref glfwSetInputMode for more information. |
| 2659 | * |
| 2660 | * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is |
| 2661 | * unconstrained and limited only by the minimum and maximum values of |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 2662 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2663 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2664 | * @param[in] window The desired window. |
| 2665 | * @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] | 2666 | * client area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2667 | * @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] | 2668 | * client area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2669 | * |
Camilla Berglund | 20ed0a1 | 2015-08-12 21:31:54 +0200 | [diff] [blame] | 2670 | * @remarks __X11:__ Due to the asynchronous nature of X11, it may take |
| 2671 | * a moment for the window focus event to arrive. This means you may not be |
| 2672 | * able to set the cursor position directly after window creation. |
Camilla Berglund | 2eb5ed3 | 2014-08-31 13:10:06 +0200 | [diff] [blame] | 2673 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2674 | * @par Thread Safety |
| 2675 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2676 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2677 | * @sa @ref cursor_pos |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2678 | * @sa glfwGetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2679 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2680 | * @since Added in GLFW 3.0. Replaces `glfwSetMousePos`. |
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 input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2683 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 2684 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2685 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 2686 | /*! @brief Creates a custom cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2687 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2688 | * Creates a new custom cursor image that can be set for a window with @ref |
| 2689 | * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. |
| 2690 | * Any remaining cursors are destroyed by @ref glfwTerminate. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2691 | * |
Camilla Berglund | 85a01bf | 2015-08-17 21:04:19 +0200 | [diff] [blame] | 2692 | * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight |
| 2693 | * bits per channel. They are arranged canonically as packed sequential rows, |
| 2694 | * starting from the top-left corner. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2695 | * |
| 2696 | * The cursor hotspot is specified in pixels, relative to the upper-left corner |
| 2697 | * of the cursor image. Like all other coordinate systems in GLFW, the X-axis |
| 2698 | * points to the right and the Y-axis points down. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2699 | * |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 2700 | * @param[in] image The desired cursor image. |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2701 | * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. |
| 2702 | * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2703 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2704 | * @return The handle of the created cursor, or `NULL` if an |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2705 | * [error](@ref error_handling) occurred. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2706 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2707 | * @par Pointer Lifetime |
| 2708 | * The specified image data is copied before this function returns. |
| 2709 | * |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 2710 | * @par Reentrancy |
| 2711 | * This function may not be called from a callback. |
| 2712 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2713 | * @par Thread Safety |
| 2714 | * This function may only be called from the main thread. |
| 2715 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2716 | * @sa @ref cursor_object |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2717 | * @sa glfwDestroyCursor |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 2718 | * @sa glfwCreateStandardCursor |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2719 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2720 | * @since Added in GLFW 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2721 | * |
| 2722 | * @ingroup input |
| 2723 | */ |
Camilla Berglund | 8fa9cc0 | 2014-02-23 16:43:17 +0100 | [diff] [blame] | 2724 | GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2725 | |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 2726 | /*! @brief Creates a cursor with a standard shape. |
| 2727 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2728 | * Returns a cursor with a [standard shape](@ref shapes), that can be set for |
| 2729 | * a window with @ref glfwSetCursor. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 2730 | * |
| 2731 | * @param[in] shape One of the [standard shapes](@ref shapes). |
| 2732 | * |
| 2733 | * @return A new cursor ready to use or `NULL` if an |
| 2734 | * [error](@ref error_handling) occurred. |
| 2735 | * |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 2736 | * @par Reentrancy |
| 2737 | * This function may not be called from a callback. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 2738 | * |
| 2739 | * @par Thread Safety |
| 2740 | * This function may only be called from the main thread. |
| 2741 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2742 | * @sa @ref cursor_object |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 2743 | * @sa glfwCreateCursor |
| 2744 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2745 | * @since Added in GLFW 3.1. |
Camilla Berglund | 2a1375e | 2014-09-02 16:52:16 +0200 | [diff] [blame] | 2746 | * |
| 2747 | * @ingroup input |
| 2748 | */ |
| 2749 | GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); |
| 2750 | |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2751 | /*! @brief Destroys a cursor. |
| 2752 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2753 | * This function destroys a cursor previously created with @ref |
| 2754 | * glfwCreateCursor. Any remaining cursors will be destroyed by @ref |
| 2755 | * glfwTerminate. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2756 | * |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2757 | * @param[in] cursor The cursor object to destroy. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2758 | * |
Camilla Berglund | 44372b8 | 2014-12-17 01:31:36 +0100 | [diff] [blame] | 2759 | * @par Reentrancy |
| 2760 | * This function may not be called from a callback. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2761 | * |
| 2762 | * @par Thread Safety |
| 2763 | * This function may only be called from the main thread. |
| 2764 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2765 | * @sa @ref cursor_object |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2766 | * @sa glfwCreateCursor |
| 2767 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2768 | * @since Added in GLFW 3.1. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2769 | * |
| 2770 | * @ingroup input |
| 2771 | */ |
| 2772 | GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); |
| 2773 | |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2774 | /*! @brief Sets the cursor for the window. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2775 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2776 | * This function sets the cursor image to be used when the cursor is over the |
| 2777 | * client area of the specified window. The set cursor will only be visible |
| 2778 | * when the [cursor mode](@ref cursor_mode) of the window is |
| 2779 | * `GLFW_CURSOR_NORMAL`. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2780 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2781 | * On some platforms, the set cursor may not be visible unless the window also |
| 2782 | * has input focus. |
| 2783 | * |
| 2784 | * @param[in] window The window to set the cursor for. |
| 2785 | * @param[in] cursor The cursor to set, or `NULL` to switch back to the default |
| 2786 | * arrow cursor. |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2787 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2788 | * @par Thread Safety |
| 2789 | * This function may only be called from the main thread. |
| 2790 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2791 | * @sa @ref cursor_object |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2792 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2793 | * @since Added in GLFW 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2794 | * |
urraka | 40c04a7 | 2013-12-04 10:19:22 -0300 | [diff] [blame] | 2795 | * @ingroup input |
| 2796 | */ |
| 2797 | GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); |
| 2798 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2799 | /*! @brief Sets the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2800 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2801 | * 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] | 2802 | * when a key is pressed, repeated or released. |
| 2803 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 2804 | * The key functions deal with physical keys, with layout independent |
| 2805 | * [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] | 2806 | * layout. If you want to input text, use the |
| 2807 | * [character callback](@ref glfwSetCharCallback) instead. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2808 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2809 | * When a window loses input focus, it will generate synthetic key release |
| 2810 | * events for all pressed keys. You can tell these events from user-generated |
| 2811 | * events by the fact that the synthetic ones are generated after the focus |
| 2812 | * loss event has been processed, i.e. after the |
| 2813 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 2814 | * |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 2815 | * The scancode of a key is specific to that platform or sometimes even to that |
| 2816 | * machine. Scancodes are intended to allow users to bind keys that don't have |
| 2817 | * 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] | 2818 | * 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] | 2819 | * |
| 2820 | * Sometimes GLFW needs to generate synthetic key events, in which case the |
| 2821 | * scancode may be zero. |
| 2822 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 2823 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2824 | * @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] | 2825 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2826 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2827 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2828 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2829 | * @par Thread Safety |
| 2830 | * This function may only be called from the main thread. |
| 2831 | * |
| 2832 | * @sa @ref input_key |
| 2833 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2834 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2835 | * |
| 2836 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2837 | * __GLFW 3:__ Added window handle parameter. Updated callback signature. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2838 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2839 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2840 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2841 | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2842 | |
| 2843 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2844 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2845 | * This function sets the character callback of the specified window, which is |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2846 | * called when a Unicode character is input. |
| 2847 | * |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 2848 | * The character callback is intended for Unicode text input. As it deals with |
| 2849 | * characters, it is keyboard layout dependent, whereas the |
| 2850 | * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 |
| 2851 | * to physical keys, as a key may produce zero, one or more characters. If you |
| 2852 | * want to know whether a specific physical key was pressed or released, see |
| 2853 | * the key callback instead. |
| 2854 | * |
| 2855 | * The character callback behaves as system text input normally does and will |
| 2856 | * not be called if modifier keys are held down that would prevent normal text |
| 2857 | * input on that platform, for example a Super (Command) key on OS X or Alt key |
| 2858 | * on Windows. There is a |
| 2859 | * [character with modifiers callback](@ref glfwSetCharModsCallback) that |
| 2860 | * receives these events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2861 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 2862 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2863 | * @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] | 2864 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2865 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2866 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2867 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2868 | * @par Thread Safety |
| 2869 | * This function may only be called from the main thread. |
| 2870 | * |
| 2871 | * @sa @ref input_char |
| 2872 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2873 | * @since Added in GLFW 2.4. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2874 | * |
| 2875 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2876 | * __GLFW 3:__ Added window handle parameter. Updated callback signature. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2877 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2878 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2879 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2880 | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2881 | |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 2882 | /*! @brief Sets the Unicode character with modifiers callback. |
| 2883 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2884 | * This function sets the character with modifiers callback of the specified |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 2885 | * window, which is called when a Unicode character is input regardless of what |
| 2886 | * modifier keys are used. |
| 2887 | * |
| 2888 | * The character with modifiers callback is intended for implementing custom |
| 2889 | * Unicode character input. For regular Unicode text input, see the |
| 2890 | * [character callback](@ref glfwSetCharCallback). Like the character |
| 2891 | * callback, the character with modifiers callback deals with characters and is |
| 2892 | * keyboard layout dependent. Characters do not map 1:1 to physical keys, as |
| 2893 | * a key may produce zero, one or more characters. If you want to know whether |
| 2894 | * a specific physical key was pressed or released, see the |
| 2895 | * [key callback](@ref glfwSetKeyCallback) instead. |
| 2896 | * |
| 2897 | * @param[in] window The window whose callback to set. |
| 2898 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 2899 | * callback. |
| 2900 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 2901 | * error occurred. |
| 2902 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2903 | * @par Thread Safety |
| 2904 | * This function may only be called from the main thread. |
| 2905 | * |
| 2906 | * @sa @ref input_char |
| 2907 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2908 | * @since Added in GLFW 3.1. |
Camilla Berglund | 96b12ee | 2014-06-12 23:04:20 +0200 | [diff] [blame] | 2909 | * |
| 2910 | * @ingroup input |
| 2911 | */ |
| 2912 | GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun); |
| 2913 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2914 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2915 | * |
| 2916 | * This function sets the mouse button callback of the specified window, which |
| 2917 | * is called when a mouse button is pressed or released. |
| 2918 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2919 | * When a window loses input focus, it will generate synthetic mouse button |
| 2920 | * release events for all pressed mouse buttons. You can tell these events |
| 2921 | * from user-generated events by the fact that the synthetic ones are generated |
| 2922 | * after the focus loss event has been processed, i.e. after the |
| 2923 | * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 2924 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 2925 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2926 | * @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] | 2927 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2928 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2929 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2930 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2931 | * @par Thread Safety |
| 2932 | * This function may only be called from the main thread. |
| 2933 | * |
| 2934 | * @sa @ref input_mouse_button |
| 2935 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2936 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2937 | * |
| 2938 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 2939 | * __GLFW 3:__ Added window handle parameter. Updated callback signature. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2940 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2941 | * @ingroup input |
| 2942 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2943 | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2944 | |
| 2945 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2946 | * |
| 2947 | * This function sets the cursor position callback of the specified window, |
| 2948 | * 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] | 2949 | * position, in screen coordinates, relative to the upper-left corner of the |
| 2950 | * client area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2951 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 2952 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2953 | * @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] | 2954 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2955 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2956 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2957 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2958 | * @par Thread Safety |
| 2959 | * This function may only be called from the main thread. |
| 2960 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2961 | * @sa @ref cursor_pos |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2962 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2963 | * @since Added in GLFW 3.0. Replaces `glfwSetMousePosCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2964 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2965 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2966 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2967 | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2968 | |
| 2969 | /*! @brief Sets the cursor enter/exit callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2970 | * |
| 2971 | * This function sets the cursor boundary crossing callback of the specified |
| 2972 | * window, which is called when the cursor enters or leaves the client area of |
| 2973 | * the window. |
| 2974 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 2975 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2976 | * @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] | 2977 | * callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 2978 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 2979 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2980 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2981 | * @par Thread Safety |
| 2982 | * This function may only be called from the main thread. |
| 2983 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2984 | * @sa @ref cursor_enter |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 2985 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 2986 | * @since Added in GLFW 3.0. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 2987 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2988 | * @ingroup input |
| 2989 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 2990 | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2991 | |
| 2992 | /*! @brief Sets the scroll callback. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2993 | * |
| 2994 | * This function sets the scroll callback of the specified window, which is |
| 2995 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
| 2996 | * area of a touchpad. |
| 2997 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2998 | * The scroll callback receives all scrolling input, like that from a mouse |
| 2999 | * wheel or a touchpad scrolling area. |
| 3000 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 3001 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3002 | * @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] | 3003 | * set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3004 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3005 | * library had not been [initialized](@ref intro_init). |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3006 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3007 | * @par Thread Safety |
| 3008 | * This function may only be called from the main thread. |
| 3009 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3010 | * @sa @ref scrolling |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3011 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3012 | * @since Added in GLFW 3.0. Replaces `glfwSetMouseWheelCallback`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3013 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3014 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3015 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 3016 | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3017 | |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 3018 | /*! @brief Sets the file drop callback. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 3019 | * |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 3020 | * This function sets the file drop callback of the specified window, which is |
| 3021 | * called when one or more dragged files are dropped on the window. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 3022 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3023 | * Because the path array and its strings may have been generated specifically |
| 3024 | * for that event, they are not guaranteed to be valid after the callback has |
| 3025 | * returned. If you wish to use them after the callback returns, you need to |
| 3026 | * make a deep copy. |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 3027 | * |
| 3028 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 5c8121e | 2014-03-29 21:35:21 +0100 | [diff] [blame] | 3029 | * @param[in] cbfun The new file drop callback, or `NULL` to remove the |
| 3030 | * currently set callback. |
Camilla Berglund | e8e05d4 | 2014-04-23 13:30:11 +0200 | [diff] [blame] | 3031 | * @return The previously set callback, or `NULL` if no callback was set or the |
| 3032 | * library had not been [initialized](@ref intro_init). |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 3033 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3034 | * @par Thread Safety |
| 3035 | * This function may only be called from the main thread. |
| 3036 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3037 | * @sa @ref path_drop |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3038 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3039 | * @since Added in GLFW 3.1. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3040 | * |
arturo | 89d0723 | 2013-07-10 11:42:14 +0200 | [diff] [blame] | 3041 | * @ingroup input |
| 3042 | */ |
| 3043 | GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun); |
| 3044 | |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 3045 | /*! @brief Returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3046 | * |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 3047 | * This function returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3048 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3049 | * @param[in] joy The [joystick](@ref joysticks) to query. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 3050 | * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3051 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3052 | * @par Thread Safety |
| 3053 | * This function may only be called from the main thread. |
| 3054 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3055 | * @sa @ref joystick |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3056 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3057 | * @since Added in GLFW 3.0. Replaces `glfwGetJoystickParam`. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3058 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3059 | * @ingroup input |
| 3060 | */ |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 3061 | GLFWAPI int glfwJoystickPresent(int joy); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3062 | |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 3063 | /*! @brief Returns the values of all axes of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3064 | * |
| 3065 | * This function returns the values of all axes of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3066 | * 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] | 3067 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3068 | * @param[in] joy The [joystick](@ref joysticks) to query. |
| 3069 | * @param[out] count Where to store the number of axis values in the returned |
| 3070 | * array. This is set to zero if an error occurred. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3071 | * @return An array of axis values, or `NULL` if the joystick is not present. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 3072 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3073 | * @par Pointer Lifetime |
| 3074 | * The returned array is allocated and freed by GLFW. You should not free it |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 3075 | * yourself. It is valid until the specified joystick is disconnected, this |
| 3076 | * function is called again for that joystick or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3077 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3078 | * @par Thread Safety |
| 3079 | * This function may only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 3080 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3081 | * @sa @ref joystick_axis |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3082 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3083 | * @since Added in GLFW 3.0. Replaces `glfwGetJoystickPos`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3084 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3085 | * @ingroup input |
| 3086 | */ |
Camilla Berglund | 180a4ee | 2013-06-04 18:20:38 +0200 | [diff] [blame] | 3087 | GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3088 | |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 3089 | /*! @brief Returns the state of all buttons of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3090 | * |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 3091 | * This function returns the state of all buttons of the specified joystick. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3092 | * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3093 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3094 | * @param[in] joy The [joystick](@ref joysticks) to query. |
| 3095 | * @param[out] count Where to store the number of button states in the returned |
| 3096 | * array. This is set to zero if an error occurred. |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 3097 | * @return An array of button states, or `NULL` if the joystick is not present. |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 3098 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3099 | * @par Pointer Lifetime |
| 3100 | * The returned array is allocated and freed by GLFW. You should not free it |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 3101 | * yourself. It is valid until the specified joystick is disconnected, this |
| 3102 | * function is called again for that joystick or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3103 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3104 | * @par Thread Safety |
| 3105 | * This function may only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 3106 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3107 | * @sa @ref joystick_button |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3108 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3109 | * @since Added in GLFW 2.2. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3110 | * |
| 3111 | * @par |
Camilla Berglund | 95654cf | 2014-10-02 17:35:10 +0200 | [diff] [blame] | 3112 | * __GLFW 3:__ Changed to return a dynamic array. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3113 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3114 | * @ingroup input |
| 3115 | */ |
Camilla Berglund | 180a4ee | 2013-06-04 18:20:38 +0200 | [diff] [blame] | 3116 | GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3117 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 3118 | /*! @brief Returns the name of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3119 | * |
| 3120 | * 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] | 3121 | * The returned string is allocated and freed by GLFW. You should not free it |
| 3122 | * yourself. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3123 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3124 | * @param[in] joy The [joystick](@ref joysticks) to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3125 | * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 3126 | * is not present. |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 3127 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3128 | * @par Pointer Lifetime |
| 3129 | * The returned string is allocated and freed by GLFW. You should not free it |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 3130 | * yourself. It is valid until the specified joystick is disconnected, this |
| 3131 | * function is called again for that joystick or the library is terminated. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3132 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3133 | * @par Thread Safety |
| 3134 | * This function may only be called from the main thread. |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 3135 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3136 | * @sa @ref joystick_name |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3137 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3138 | * @since Added in GLFW 3.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3139 | * |
| 3140 | * @ingroup input |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 3141 | */ |
Camilla Berglund | 93a1d1c | 2012-09-07 01:01:34 +0200 | [diff] [blame] | 3142 | GLFWAPI const char* glfwGetJoystickName(int joy); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3143 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3144 | /*! @brief Sets the clipboard to the specified string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3145 | * |
| 3146 | * This function sets the system clipboard to the specified, UTF-8 encoded |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3147 | * string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3148 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3149 | * @param[in] window The window that will own the clipboard contents. |
| 3150 | * @param[in] string A UTF-8 encoded string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3151 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3152 | * @par Pointer Lifetime |
| 3153 | * The specified string is copied before this function returns. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 3154 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3155 | * @par Thread Safety |
| 3156 | * This function may only be called from the main thread. |
| 3157 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3158 | * @sa @ref clipboard |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3159 | * @sa glfwGetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3160 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3161 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3162 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 3163 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3164 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3165 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3166 | |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3167 | /*! @brief Returns the contents of the clipboard as a string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3168 | * |
| 3169 | * This function returns the contents of the system clipboard, if it contains |
Camilla Berglund | cf9079c | 2015-09-16 18:51:49 +0200 | [diff] [blame] | 3170 | * 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] | 3171 | * if its contents cannot be converted, `NULL` is returned and a @ref |
| 3172 | * GLFW_FORMAT_UNAVAILABLE error is generated. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3173 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3174 | * @param[in] window The window that will request the clipboard contents. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3175 | * @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] | 3176 | * if an [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3177 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3178 | * @par Pointer Lifetime |
| 3179 | * The returned string is allocated and freed by GLFW. You should not free it |
| 3180 | * yourself. It is valid until the next call to @ref |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 3181 | * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library |
| 3182 | * is terminated. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3183 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3184 | * @par Thread Safety |
| 3185 | * This function may only be called from the main thread. |
| 3186 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3187 | * @sa @ref clipboard |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3188 | * @sa glfwSetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3189 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3190 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3191 | * |
Camilla Berglund | 8d170c7 | 2014-09-09 16:26:57 +0200 | [diff] [blame] | 3192 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3193 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3194 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 3195 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3196 | /*! @brief Returns the value of the GLFW timer. |
| 3197 | * |
| 3198 | * This function returns the value of the GLFW timer. Unless the timer has |
| 3199 | * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW |
| 3200 | * was initialized. |
| 3201 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3202 | * The resolution of the timer is system dependent, but is usually on the order |
| 3203 | * of a few micro- or nanoseconds. It uses the highest-resolution monotonic |
| 3204 | * time source on each supported platform. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3205 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3206 | * @return The current value, in seconds, or zero if an |
| 3207 | * [error](@ref error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3208 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3209 | * @par Thread Safety |
| 3210 | * This function may be called from any thread. Access is not synchronized. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3211 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3212 | * @sa @ref time |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3213 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3214 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3215 | * |
| 3216 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3217 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 3218 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3219 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3220 | /*! @brief Sets the GLFW timer. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3221 | * |
| 3222 | * 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] | 3223 | * up from that value. The value must be a positive finite number less than |
| 3224 | * or equal to 18446744073.0, which is approximately 584.5 years. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3225 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3226 | * @param[in] time The new value, in seconds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3227 | * |
Camilla Berglund | 6e20cda | 2015-03-10 12:01:38 +0100 | [diff] [blame] | 3228 | * @remarks The upper limit of the timer is calculated as |
| 3229 | * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations |
| 3230 | * storing nanoseconds in 64 bits. The limit may be increased in the future. |
| 3231 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3232 | * @par Thread Safety |
| 3233 | * This function may only be called from the main thread. |
Camilla Berglund | 0e20577 | 2014-03-24 11:58:35 +0100 | [diff] [blame] | 3234 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3235 | * @sa @ref time |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3236 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3237 | * @since Added in GLFW 2.2. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3238 | * |
| 3239 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3240 | */ |
| 3241 | GLFWAPI void glfwSetTime(double time); |
| 3242 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3243 | /*! @brief Makes the context of the specified window current for the calling |
| 3244 | * thread. |
| 3245 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3246 | * This function makes the OpenGL or OpenGL ES context of the specified window |
| 3247 | * current on the calling thread. A context can only be made current on |
| 3248 | * a single thread at a time and each thread can have only a single current |
| 3249 | * context at a time. |
| 3250 | * |
| 3251 | * By default, making a context non-current implicitly forces a pipeline flush. |
| 3252 | * On machines that support `GL_KHR_context_flush_control`, you can control |
| 3253 | * whether a context performs this flush by setting the |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3254 | * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3255 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3256 | * @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] | 3257 | * detach the current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3258 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3259 | * @par Thread Safety |
| 3260 | * This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3261 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3262 | * @sa @ref context_current |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3263 | * @sa glfwGetCurrentContext |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3264 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3265 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3266 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3267 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3268 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3269 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3270 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3271 | /*! @brief Returns the window whose context is current on the calling thread. |
| 3272 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3273 | * This function returns the window whose OpenGL or OpenGL ES context is |
| 3274 | * current on the calling thread. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3275 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 3276 | * @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] | 3277 | * context is current. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3278 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3279 | * @par Thread Safety |
| 3280 | * This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3281 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3282 | * @sa @ref context_current |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3283 | * @sa glfwMakeContextCurrent |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3284 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3285 | * @since Added in GLFW 3.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3286 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3287 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3288 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3289 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3290 | |
| 3291 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3292 | * |
| 3293 | * This function swaps the front and back buffers of the specified window. If |
| 3294 | * the swap interval is greater than zero, the GPU driver waits the specified |
| 3295 | * number of screen updates before swapping the buffers. |
| 3296 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 3297 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3298 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3299 | * @par Thread Safety |
| 3300 | * This function may be called from any thread. |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 3301 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3302 | * @sa @ref buffer_swap |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3303 | * @sa glfwSwapInterval |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3304 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3305 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3306 | * |
| 3307 | * @par |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3308 | * __GLFW 3:__ Added window handle parameter. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3309 | * |
| 3310 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3311 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 3312 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3313 | |
| 3314 | /*! @brief Sets the swap interval for the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3315 | * |
| 3316 | * This function sets the swap interval for the current context, i.e. the |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3317 | * number of screen updates to wait from the time @ref glfwSwapBuffers was |
| 3318 | * called before swapping the buffers and returning. This is sometimes called |
Camilla Berglund | bb3dd31 | 2015-01-05 02:26:21 +0100 | [diff] [blame] | 3319 | * _vertical synchronization_, _vertical retrace synchronization_ or just |
| 3320 | * _vsync_. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3321 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3322 | * Contexts that support either of the `WGL_EXT_swap_control_tear` and |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3323 | * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals, |
| 3324 | * which allow the driver to swap even if a frame arrives a little bit late. |
| 3325 | * You can check for the presence of these extensions using @ref |
| 3326 | * glfwExtensionSupported. For more information about swap tearing, see the |
| 3327 | * extension specifications. |
| 3328 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3329 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3330 | * 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] | 3331 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 3332 | * @param[in] interval The minimum number of screen updates to wait for |
| 3333 | * until the buffers are swapped by @ref glfwSwapBuffers. |
| 3334 | * |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 3335 | * @remarks This function is not called during context creation, leaving the |
| 3336 | * 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] | 3337 | * because some swap interval extensions used by GLFW do not allow the swap |
| 3338 | * interval to be reset to zero once it has been set to a non-zero value. |
| 3339 | * |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 3340 | * @remarks Some GPU drivers do not honor the requested swap interval, either |
| 3341 | * because of a user setting that overrides the application's request or due to |
| 3342 | * bugs in the driver. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 3343 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3344 | * @par Thread Safety |
| 3345 | * This function may be called from any thread. |
| 3346 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3347 | * @sa @ref buffer_swap |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3348 | * @sa glfwSwapBuffers |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3349 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3350 | * @since Added in GLFW 1.0. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3351 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3352 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3353 | */ |
| 3354 | GLFWAPI void glfwSwapInterval(int interval); |
| 3355 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3356 | /*! @brief Returns whether the specified extension is available. |
| 3357 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 3358 | * This function returns whether the specified |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 3359 | * [client API extension](@ref context_glext) is supported by the current |
| 3360 | * OpenGL or OpenGL ES context. It searches both for OpenGL and OpenGL ES |
| 3361 | * extension and platform-specific context creation API extensions. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3362 | * |
| 3363 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3364 | * 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] | 3365 | * |
| 3366 | * As this functions retrieves and searches one or more extension strings each |
| 3367 | * call, it is recommended that you cache its results if it is going to be used |
| 3368 | * frequently. The extension strings will not change during the lifetime of |
| 3369 | * a context, so there is no danger in doing this. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3370 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3371 | * @param[in] extension The ASCII encoded name of the extension. |
Camilla Berglund | 0eccf75 | 2015-08-23 19:30:04 +0200 | [diff] [blame] | 3372 | * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE` |
| 3373 | * otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3374 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3375 | * @par Thread Safety |
| 3376 | * This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3377 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3378 | * @sa @ref context_glext |
| 3379 | * @sa glfwGetProcAddress |
| 3380 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3381 | * @since Added in GLFW 1.0. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 3382 | * |
| 3383 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3384 | */ |
| 3385 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 3386 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3387 | /*! @brief Returns the address of the specified function for the current |
| 3388 | * context. |
| 3389 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 3390 | * This function returns the address of the specified |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 3391 | * [core or extension function](@ref context_glext), if it is supported |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 3392 | * by the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3393 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3394 | * A context must be current on the calling thread. Calling this function |
Camilla Berglund | ce8f97c | 2015-01-11 23:33:14 +0100 | [diff] [blame] | 3395 | * 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] | 3396 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3397 | * @param[in] procname The ASCII encoded name of the function. |
Camilla Berglund | c8e0687 | 2015-08-27 21:40:22 +0200 | [diff] [blame] | 3398 | * @return The address of the function, or `NULL` if an [error](@ref |
| 3399 | * error_handling) occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3400 | * |
Camilla Berglund | 40da56f | 2015-09-09 12:27:38 +0200 | [diff] [blame] | 3401 | * @remarks 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] | 3402 | * between contexts. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3403 | * |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 3404 | * @remarks This function may return a non-`NULL` address despite the |
| 3405 | * associated version or extension not being available. Always check the |
Camilla Berglund | c8e0687 | 2015-08-27 21:40:22 +0200 | [diff] [blame] | 3406 | * context version or extension string first. |
Camilla Berglund | 11c22d6 | 2015-02-19 15:33:51 +0100 | [diff] [blame] | 3407 | * |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3408 | * @par Pointer Lifetime |
Camilla Berglund | 6be821c | 2014-10-06 23:18:33 +0200 | [diff] [blame] | 3409 | * The returned function pointer is valid until the context is destroyed or the |
| 3410 | * library is terminated. |
Camilla Berglund | 4591ad2 | 2014-09-18 15:03:29 +0200 | [diff] [blame] | 3411 | * |
| 3412 | * @par Thread Safety |
| 3413 | * This function may be called from any thread. |
| 3414 | * |
| 3415 | * @sa @ref context_glext |
| 3416 | * @sa glfwExtensionSupported |
| 3417 | * |
Camilla Berglund | 4188c26 | 2015-01-18 01:55:25 +0100 | [diff] [blame] | 3418 | * @since Added in GLFW 1.0. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 3419 | * |
| 3420 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 3421 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 3422 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3423 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3424 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 3425 | /************************************************************************* |
| 3426 | * Global definition cleanup |
| 3427 | *************************************************************************/ |
| 3428 | |
| 3429 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 3430 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 3431 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 3432 | #undef WINGDIAPI |
| 3433 | #undef GLFW_WINGDIAPI_DEFINED |
| 3434 | #endif |
| 3435 | |
| 3436 | #ifdef GLFW_CALLBACK_DEFINED |
| 3437 | #undef CALLBACK |
| 3438 | #undef GLFW_CALLBACK_DEFINED |
| 3439 | #endif |
| 3440 | |
| 3441 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 3442 | |
| 3443 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3444 | #ifdef __cplusplus |
| 3445 | } |
| 3446 | #endif |
| 3447 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 3448 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3449 | |