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