Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 1 | /************************************************************************* |
Camilla Berglund | 3cfc400 | 2013-07-29 20:53:17 +0200 | [diff] [blame] | 2 | * GLFW 3.0 - www.glfw.org |
| 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 | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 41 | /*! @defgroup clipboard Clipboard support |
| 42 | */ |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 43 | /*! @defgroup context Context handling |
| 44 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 45 | /*! @defgroup error Error handling |
| 46 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 47 | /*! @defgroup init Initialization and version information |
| 48 | */ |
| 49 | /*! @defgroup input Input handling |
| 50 | */ |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 51 | /*! @defgroup monitor Monitor handling |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 52 | * |
| 53 | * This is the reference documentation for monitor related functions and types. |
| 54 | * For more information, see the @ref monitor. |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 55 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 56 | /*! @defgroup time Time input |
| 57 | */ |
| 58 | /*! @defgroup window Window handling |
| 59 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 60 | * This is the reference documentation for window related functions and types, |
| 61 | * including creation, deletion and event polling. For more information, see |
| 62 | * the @ref window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 63 | */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 64 | |
| 65 | |
| 66 | /************************************************************************* |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 67 | * Global definitions |
| 68 | *************************************************************************/ |
| 69 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 70 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 71 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 72 | /* Please report any problems that you find with your compiler, which may |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 73 | * be solved in this section! There are several compilers that I have not |
| 74 | * been able to test this file with yet. |
| 75 | * |
| 76 | * First: If we are we on Windows, we want a single define for it (_WIN32) |
| 77 | * (Note: For Cygwin the compiler flag -mwin32 should be used, but to |
| 78 | * make sure that things run smoothly for Cygwin users, we add __CYGWIN__ |
| 79 | * to the list of "valid Win32 identifiers", which removes the need for |
| 80 | * -mwin32) |
| 81 | */ |
| 82 | #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)) |
| 83 | #define _WIN32 |
| 84 | #endif /* _WIN32 */ |
| 85 | |
| 86 | /* In order for extension support to be portable, we need to define an |
| 87 | * OpenGL function call method. We use the keyword APIENTRY, which is |
| 88 | * defined for Win32. (Note: Windows also needs this for <GL/gl.h>) |
| 89 | */ |
| 90 | #ifndef APIENTRY |
| 91 | #ifdef _WIN32 |
| 92 | #define APIENTRY __stdcall |
| 93 | #else |
| 94 | #define APIENTRY |
| 95 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 96 | #endif /* APIENTRY */ |
| 97 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 98 | /* The following three defines are here solely to make some Windows-based |
| 99 | * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but |
| 100 | * it has the major drawback of severely polluting our namespace. |
| 101 | */ |
| 102 | |
| 103 | /* Under Windows, we need WINGDIAPI defined */ |
| 104 | #if !defined(WINGDIAPI) && defined(_WIN32) |
| 105 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__) |
| 106 | /* Microsoft Visual C++, Borland C++ Builder and Pelles C */ |
| 107 | #define WINGDIAPI __declspec(dllimport) |
| 108 | #elif defined(__LCC__) |
| 109 | /* LCC-Win32 */ |
| 110 | #define WINGDIAPI __stdcall |
| 111 | #else |
| 112 | /* Others (e.g. MinGW, Cygwin) */ |
| 113 | #define WINGDIAPI extern |
| 114 | #endif |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 115 | #define GLFW_WINGDIAPI_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 116 | #endif /* WINGDIAPI */ |
| 117 | |
| 118 | /* Some <GL/glu.h> files also need CALLBACK defined */ |
| 119 | #if !defined(CALLBACK) && defined(_WIN32) |
| 120 | #if defined(_MSC_VER) |
| 121 | /* Microsoft Visual C++ */ |
| 122 | #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) |
| 123 | #define CALLBACK __stdcall |
| 124 | #else |
| 125 | #define CALLBACK |
| 126 | #endif |
| 127 | #else |
| 128 | /* Other Windows compilers */ |
| 129 | #define CALLBACK __stdcall |
| 130 | #endif |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 131 | #define GLFW_CALLBACK_DEFINED |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 132 | #endif /* CALLBACK */ |
| 133 | |
Camilla Berglund | bea59f6 | 2013-07-23 00:20:23 +0200 | [diff] [blame] | 134 | /* Most GL/glu.h variants on Windows need wchar_t |
| 135 | * 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] | 136 | #if !defined(GLFW_INCLUDE_NONE) |
| 137 | #include <stddef.h> |
| 138 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 139 | |
Camilla Berglund | c93b120 | 2013-09-08 16:07:34 +0200 | [diff] [blame] | 140 | /* Include the chosen client API headers. |
| 141 | */ |
| 142 | #if defined(__APPLE_CC__) |
| 143 | #if defined(GLFW_INCLUDE_GLCOREARB) |
| 144 | #include <OpenGL/gl3.h> |
| 145 | #elif !defined(GLFW_INCLUDE_NONE) |
| 146 | #define GL_GLEXT_LEGACY |
| 147 | #include <OpenGL/gl.h> |
| 148 | #endif |
| 149 | #if defined(GLFW_INCLUDE_GLU) |
| 150 | #include <OpenGL/glu.h> |
| 151 | #endif |
| 152 | #else |
| 153 | #if defined(GLFW_INCLUDE_GLCOREARB) |
| 154 | #include <GL/glcorearb.h> |
| 155 | #elif defined(GLFW_INCLUDE_ES1) |
| 156 | #include <GLES/gl.h> |
| 157 | #elif defined(GLFW_INCLUDE_ES2) |
| 158 | #include <GLES2/gl2.h> |
| 159 | #elif defined(GLFW_INCLUDE_ES3) |
| 160 | #include <GLES3/gl3.h> |
| 161 | #elif !defined(GLFW_INCLUDE_NONE) |
| 162 | #include <GL/gl.h> |
| 163 | #endif |
| 164 | #if defined(GLFW_INCLUDE_GLU) |
| 165 | #include <GL/glu.h> |
| 166 | #endif |
| 167 | #endif |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 168 | |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 169 | #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | bd2d571 | 2013-07-23 01:59:27 +0200 | [diff] [blame] | 170 | /* GLFW_DLL is defined by users of GLFW when compiling programs that will link |
| 171 | * to the DLL version of the GLFW library. _GLFW_BUILD_DLL is defined by the |
| 172 | * GLFW configuration header when compiling the DLL version of the library. |
| 173 | */ |
Camilla Berglund | cc5d7cd | 2012-03-25 17:43:02 +0200 | [diff] [blame] | 174 | #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" |
| 175 | #endif |
| 176 | |
Camilla Berglund | 2588c9b | 2012-03-25 17:40:30 +0200 | [diff] [blame] | 177 | #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 178 | |
| 179 | /* We are building a Win32 DLL */ |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 180 | #define GLFWAPI __declspec(dllexport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 181 | |
| 182 | #elif defined(_WIN32) && defined(GLFW_DLL) |
| 183 | |
| 184 | /* We are calling a Win32 DLL */ |
| 185 | #if defined(__LCC__) |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 186 | #define GLFWAPI extern |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 187 | #else |
Camilla Berglund | 2955cd3 | 2010-11-17 15:42:55 +0100 | [diff] [blame] | 188 | #define GLFWAPI __declspec(dllimport) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 189 | #endif |
| 190 | |
John Bartholomew | 93f4eff | 2013-05-01 13:08:09 +0100 | [diff] [blame] | 191 | #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) |
| 192 | |
| 193 | #define GLFWAPI __attribute__((visibility("default"))) |
| 194 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 195 | #else |
| 196 | |
| 197 | /* We are either building/calling a static lib or we are non-win32 */ |
| 198 | #define GLFWAPI |
| 199 | |
| 200 | #endif |
| 201 | |
| 202 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 203 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 204 | |
| 205 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 206 | * GLFW API tokens |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 207 | *************************************************************************/ |
| 208 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 209 | /*! @name GLFW version macros |
| 210 | * @{ */ |
| 211 | /*! @brief The major version number of the GLFW library. |
| 212 | * |
| 213 | * This is incremented when the API is changed in non-compatible ways. |
| 214 | * @ingroup init |
| 215 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 216 | #define GLFW_VERSION_MAJOR 3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 217 | /*! @brief The minor version number of the GLFW library. |
| 218 | * |
| 219 | * This is incremented when features are added to the API but it remains |
| 220 | * backward-compatible. |
| 221 | * @ingroup init |
| 222 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 223 | #define GLFW_VERSION_MINOR 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 224 | /*! @brief The revision number of the GLFW library. |
| 225 | * |
| 226 | * This is incremented when a bug fix release is made that does not contain any |
| 227 | * API changes. |
| 228 | * @ingroup init |
| 229 | */ |
Camilla Berglund | 59422ec | 2013-09-24 21:35:37 +0200 | [diff] [blame] | 230 | #define GLFW_VERSION_REVISION 4 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 231 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 232 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 233 | /*! @name Key and button actions |
| 234 | * @{ */ |
| 235 | /*! @brief The key or button was released. |
| 236 | * @ingroup input |
| 237 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 238 | #define GLFW_RELEASE 0 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 239 | /*! @brief The key or button was pressed. |
| 240 | * @ingroup input |
| 241 | */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 242 | #define GLFW_PRESS 1 |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 243 | /*! @brief The key was held down until it repeated. |
| 244 | * @ingroup input |
| 245 | */ |
| 246 | #define GLFW_REPEAT 2 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 247 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 248 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 249 | /*! @defgroup keys Keyboard keys |
| 250 | * |
| 251 | * 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] | 252 | * but re-arranged to map to 7-bit ASCII for printable keys (function keys are |
| 253 | * put in the 256+ range). |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 254 | * |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 255 | * The naming of the key codes follow these rules: |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 256 | * - The US keyboard layout is used |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 257 | * - Names of printable alpha-numeric characters are used (e.g. "A", "R", |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 258 | * "3", etc.) |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 259 | * - For non-alphanumeric characters, Unicode:ish names are used (e.g. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 260 | * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not |
| 261 | * correspond to the Unicode standard (usually for brevity) |
| 262 | * - Keys that lack a clear US mapping are named "WORLD_x" |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 263 | * - For non-printable keys, custom names are used (e.g. "F4", |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 264 | * "BACKSPACE", etc.) |
| 265 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 266 | * @ingroup input |
| 267 | * @{ |
| 268 | */ |
| 269 | |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 270 | /* The unknown key */ |
| 271 | #define GLFW_KEY_UNKNOWN -1 |
| 272 | |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 273 | /* Printable keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 274 | #define GLFW_KEY_SPACE 32 |
| 275 | #define GLFW_KEY_APOSTROPHE 39 /* ' */ |
| 276 | #define GLFW_KEY_COMMA 44 /* , */ |
| 277 | #define GLFW_KEY_MINUS 45 /* - */ |
| 278 | #define GLFW_KEY_PERIOD 46 /* . */ |
| 279 | #define GLFW_KEY_SLASH 47 /* / */ |
| 280 | #define GLFW_KEY_0 48 |
| 281 | #define GLFW_KEY_1 49 |
| 282 | #define GLFW_KEY_2 50 |
| 283 | #define GLFW_KEY_3 51 |
| 284 | #define GLFW_KEY_4 52 |
| 285 | #define GLFW_KEY_5 53 |
| 286 | #define GLFW_KEY_6 54 |
| 287 | #define GLFW_KEY_7 55 |
| 288 | #define GLFW_KEY_8 56 |
| 289 | #define GLFW_KEY_9 57 |
| 290 | #define GLFW_KEY_SEMICOLON 59 /* ; */ |
| 291 | #define GLFW_KEY_EQUAL 61 /* = */ |
| 292 | #define GLFW_KEY_A 65 |
| 293 | #define GLFW_KEY_B 66 |
| 294 | #define GLFW_KEY_C 67 |
| 295 | #define GLFW_KEY_D 68 |
| 296 | #define GLFW_KEY_E 69 |
| 297 | #define GLFW_KEY_F 70 |
| 298 | #define GLFW_KEY_G 71 |
| 299 | #define GLFW_KEY_H 72 |
| 300 | #define GLFW_KEY_I 73 |
| 301 | #define GLFW_KEY_J 74 |
| 302 | #define GLFW_KEY_K 75 |
| 303 | #define GLFW_KEY_L 76 |
| 304 | #define GLFW_KEY_M 77 |
| 305 | #define GLFW_KEY_N 78 |
| 306 | #define GLFW_KEY_O 79 |
| 307 | #define GLFW_KEY_P 80 |
| 308 | #define GLFW_KEY_Q 81 |
| 309 | #define GLFW_KEY_R 82 |
| 310 | #define GLFW_KEY_S 83 |
| 311 | #define GLFW_KEY_T 84 |
| 312 | #define GLFW_KEY_U 85 |
| 313 | #define GLFW_KEY_V 86 |
| 314 | #define GLFW_KEY_W 87 |
| 315 | #define GLFW_KEY_X 88 |
| 316 | #define GLFW_KEY_Y 89 |
| 317 | #define GLFW_KEY_Z 90 |
| 318 | #define GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
| 319 | #define GLFW_KEY_BACKSLASH 92 /* \ */ |
| 320 | #define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
| 321 | #define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
| 322 | #define GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
| 323 | #define GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 324 | |
| 325 | /* Function keys */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 326 | #define GLFW_KEY_ESCAPE 256 |
| 327 | #define GLFW_KEY_ENTER 257 |
| 328 | #define GLFW_KEY_TAB 258 |
| 329 | #define GLFW_KEY_BACKSPACE 259 |
| 330 | #define GLFW_KEY_INSERT 260 |
| 331 | #define GLFW_KEY_DELETE 261 |
| 332 | #define GLFW_KEY_RIGHT 262 |
| 333 | #define GLFW_KEY_LEFT 263 |
| 334 | #define GLFW_KEY_DOWN 264 |
| 335 | #define GLFW_KEY_UP 265 |
| 336 | #define GLFW_KEY_PAGE_UP 266 |
| 337 | #define GLFW_KEY_PAGE_DOWN 267 |
| 338 | #define GLFW_KEY_HOME 268 |
| 339 | #define GLFW_KEY_END 269 |
| 340 | #define GLFW_KEY_CAPS_LOCK 280 |
| 341 | #define GLFW_KEY_SCROLL_LOCK 281 |
| 342 | #define GLFW_KEY_NUM_LOCK 282 |
| 343 | #define GLFW_KEY_PRINT_SCREEN 283 |
| 344 | #define GLFW_KEY_PAUSE 284 |
| 345 | #define GLFW_KEY_F1 290 |
| 346 | #define GLFW_KEY_F2 291 |
| 347 | #define GLFW_KEY_F3 292 |
| 348 | #define GLFW_KEY_F4 293 |
| 349 | #define GLFW_KEY_F5 294 |
| 350 | #define GLFW_KEY_F6 295 |
| 351 | #define GLFW_KEY_F7 296 |
| 352 | #define GLFW_KEY_F8 297 |
| 353 | #define GLFW_KEY_F9 298 |
| 354 | #define GLFW_KEY_F10 299 |
| 355 | #define GLFW_KEY_F11 300 |
| 356 | #define GLFW_KEY_F12 301 |
| 357 | #define GLFW_KEY_F13 302 |
| 358 | #define GLFW_KEY_F14 303 |
| 359 | #define GLFW_KEY_F15 304 |
| 360 | #define GLFW_KEY_F16 305 |
| 361 | #define GLFW_KEY_F17 306 |
| 362 | #define GLFW_KEY_F18 307 |
| 363 | #define GLFW_KEY_F19 308 |
| 364 | #define GLFW_KEY_F20 309 |
| 365 | #define GLFW_KEY_F21 310 |
| 366 | #define GLFW_KEY_F22 311 |
| 367 | #define GLFW_KEY_F23 312 |
| 368 | #define GLFW_KEY_F24 313 |
| 369 | #define GLFW_KEY_F25 314 |
| 370 | #define GLFW_KEY_KP_0 320 |
| 371 | #define GLFW_KEY_KP_1 321 |
| 372 | #define GLFW_KEY_KP_2 322 |
| 373 | #define GLFW_KEY_KP_3 323 |
| 374 | #define GLFW_KEY_KP_4 324 |
| 375 | #define GLFW_KEY_KP_5 325 |
| 376 | #define GLFW_KEY_KP_6 326 |
| 377 | #define GLFW_KEY_KP_7 327 |
| 378 | #define GLFW_KEY_KP_8 328 |
| 379 | #define GLFW_KEY_KP_9 329 |
| 380 | #define GLFW_KEY_KP_DECIMAL 330 |
| 381 | #define GLFW_KEY_KP_DIVIDE 331 |
| 382 | #define GLFW_KEY_KP_MULTIPLY 332 |
| 383 | #define GLFW_KEY_KP_SUBTRACT 333 |
| 384 | #define GLFW_KEY_KP_ADD 334 |
| 385 | #define GLFW_KEY_KP_ENTER 335 |
| 386 | #define GLFW_KEY_KP_EQUAL 336 |
| 387 | #define GLFW_KEY_LEFT_SHIFT 340 |
| 388 | #define GLFW_KEY_LEFT_CONTROL 341 |
| 389 | #define GLFW_KEY_LEFT_ALT 342 |
| 390 | #define GLFW_KEY_LEFT_SUPER 343 |
| 391 | #define GLFW_KEY_RIGHT_SHIFT 344 |
| 392 | #define GLFW_KEY_RIGHT_CONTROL 345 |
| 393 | #define GLFW_KEY_RIGHT_ALT 346 |
| 394 | #define GLFW_KEY_RIGHT_SUPER 347 |
| 395 | #define GLFW_KEY_MENU 348 |
| 396 | #define GLFW_KEY_LAST GLFW_KEY_MENU |
Marcus | c0cb4c2 | 2011-01-02 11:18:14 +0100 | [diff] [blame] | 397 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 398 | /*! @} */ |
| 399 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 400 | /*! @defgroup mods Modifier key flags |
| 401 | * @ingroup input |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 402 | * @{ */ |
| 403 | |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 404 | /*! @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] | 405 | */ |
| 406 | #define GLFW_MOD_SHIFT 0x0001 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 407 | /*! @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] | 408 | */ |
Camilla Berglund | 3bcffba | 2013-05-23 14:11:05 +0200 | [diff] [blame] | 409 | #define GLFW_MOD_CONTROL 0x0002 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 410 | /*! @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] | 411 | */ |
| 412 | #define GLFW_MOD_ALT 0x0004 |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 413 | /*! @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] | 414 | */ |
| 415 | #define GLFW_MOD_SUPER 0x0008 |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 416 | |
| 417 | /*! @} */ |
| 418 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 419 | /*! @defgroup buttons Mouse buttons |
| 420 | * @ingroup input |
| 421 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 422 | #define GLFW_MOUSE_BUTTON_1 0 |
| 423 | #define GLFW_MOUSE_BUTTON_2 1 |
| 424 | #define GLFW_MOUSE_BUTTON_3 2 |
| 425 | #define GLFW_MOUSE_BUTTON_4 3 |
| 426 | #define GLFW_MOUSE_BUTTON_5 4 |
| 427 | #define GLFW_MOUSE_BUTTON_6 5 |
| 428 | #define GLFW_MOUSE_BUTTON_7 6 |
| 429 | #define GLFW_MOUSE_BUTTON_8 7 |
| 430 | #define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
| 431 | #define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
| 432 | #define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
| 433 | #define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 434 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 435 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 436 | /*! @defgroup joysticks Joysticks |
| 437 | * @ingroup input |
| 438 | * @{ */ |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 439 | #define GLFW_JOYSTICK_1 0 |
| 440 | #define GLFW_JOYSTICK_2 1 |
| 441 | #define GLFW_JOYSTICK_3 2 |
| 442 | #define GLFW_JOYSTICK_4 3 |
| 443 | #define GLFW_JOYSTICK_5 4 |
| 444 | #define GLFW_JOYSTICK_6 5 |
| 445 | #define GLFW_JOYSTICK_7 6 |
| 446 | #define GLFW_JOYSTICK_8 7 |
| 447 | #define GLFW_JOYSTICK_9 8 |
| 448 | #define GLFW_JOYSTICK_10 9 |
| 449 | #define GLFW_JOYSTICK_11 10 |
| 450 | #define GLFW_JOYSTICK_12 11 |
| 451 | #define GLFW_JOYSTICK_13 12 |
| 452 | #define GLFW_JOYSTICK_14 13 |
| 453 | #define GLFW_JOYSTICK_15 14 |
| 454 | #define GLFW_JOYSTICK_16 15 |
| 455 | #define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 456 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 457 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 458 | /*! @defgroup errors Error codes |
| 459 | * @ingroup error |
| 460 | * @{ */ |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 461 | /*! @brief GLFW has not been initialized. |
| 462 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 463 | #define GLFW_NOT_INITIALIZED 0x00010001 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 464 | /*! @brief No context is current for this thread. |
| 465 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 466 | #define GLFW_NO_CURRENT_CONTEXT 0x00010002 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 467 | /*! @brief One of the enum parameters for the function was given an invalid |
| 468 | * enum. |
| 469 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 470 | #define GLFW_INVALID_ENUM 0x00010003 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 471 | /*! @brief One of the parameters for the function was given an invalid value. |
| 472 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 473 | #define GLFW_INVALID_VALUE 0x00010004 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 474 | /*! @brief A memory allocation failed. |
| 475 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 476 | #define GLFW_OUT_OF_MEMORY 0x00010005 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 477 | /*! @brief GLFW could not find support for the requested client API on the |
| 478 | * system. |
| 479 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 480 | #define GLFW_API_UNAVAILABLE 0x00010006 |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 481 | /*! @brief The requested client API version is not available. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 482 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 483 | #define GLFW_VERSION_UNAVAILABLE 0x00010007 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 484 | /*! @brief A platform-specific error occurred that does not match any of the |
| 485 | * more specific categories. |
| 486 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 487 | #define GLFW_PLATFORM_ERROR 0x00010008 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 488 | /*! @brief The clipboard did not contain data in the requested format. |
| 489 | */ |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 490 | #define GLFW_FORMAT_UNAVAILABLE 0x00010009 |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 491 | /*! @} */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 492 | |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 493 | #define GLFW_FOCUSED 0x00020001 |
| 494 | #define GLFW_ICONIFIED 0x00020002 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 495 | #define GLFW_RESIZABLE 0x00020003 |
| 496 | #define GLFW_VISIBLE 0x00020004 |
| 497 | #define GLFW_DECORATED 0x00020005 |
Camilla Berglund | 2c09157 | 2010-09-09 21:09:11 +0200 | [diff] [blame] | 498 | |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 499 | #define GLFW_RED_BITS 0x00021001 |
| 500 | #define GLFW_GREEN_BITS 0x00021002 |
| 501 | #define GLFW_BLUE_BITS 0x00021003 |
| 502 | #define GLFW_ALPHA_BITS 0x00021004 |
| 503 | #define GLFW_DEPTH_BITS 0x00021005 |
| 504 | #define GLFW_STENCIL_BITS 0x00021006 |
| 505 | #define GLFW_ACCUM_RED_BITS 0x00021007 |
| 506 | #define GLFW_ACCUM_GREEN_BITS 0x00021008 |
| 507 | #define GLFW_ACCUM_BLUE_BITS 0x00021009 |
| 508 | #define GLFW_ACCUM_ALPHA_BITS 0x0002100A |
| 509 | #define GLFW_AUX_BUFFERS 0x0002100B |
| 510 | #define GLFW_STEREO 0x0002100C |
| 511 | #define GLFW_SAMPLES 0x0002100D |
| 512 | #define GLFW_SRGB_CAPABLE 0x0002100E |
Camilla Berglund | 2cd3438 | 2013-05-30 20:42:50 +0200 | [diff] [blame] | 513 | #define GLFW_REFRESH_RATE 0x0002100F |
Camilla Berglund | deb0b3d | 2012-12-02 21:00:15 +0100 | [diff] [blame] | 514 | |
Camilla Berglund | 53b39a6 | 2013-05-30 18:55:45 +0200 | [diff] [blame] | 515 | #define GLFW_CLIENT_API 0x00022001 |
| 516 | #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
| 517 | #define GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
| 518 | #define GLFW_CONTEXT_REVISION 0x00022004 |
| 519 | #define GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
| 520 | #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
| 521 | #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 |
| 522 | #define GLFW_OPENGL_PROFILE 0x00022008 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 523 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 524 | #define GLFW_OPENGL_API 0x00030001 |
| 525 | #define GLFW_OPENGL_ES_API 0x00030002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 526 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 527 | #define GLFW_NO_ROBUSTNESS 0 |
| 528 | #define GLFW_NO_RESET_NOTIFICATION 0x00031001 |
| 529 | #define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 530 | |
Camilla Berglund | 44e8401 | 2013-06-05 16:13:30 +0200 | [diff] [blame] | 531 | #define GLFW_OPENGL_ANY_PROFILE 0 |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 532 | #define GLFW_OPENGL_CORE_PROFILE 0x00032001 |
| 533 | #define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 534 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 535 | #define GLFW_CURSOR 0x00033001 |
| 536 | #define GLFW_STICKY_KEYS 0x00033002 |
| 537 | #define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 538 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 539 | #define GLFW_CURSOR_NORMAL 0x00034001 |
| 540 | #define GLFW_CURSOR_HIDDEN 0x00034002 |
| 541 | #define GLFW_CURSOR_DISABLED 0x00034003 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 542 | |
Camilla Berglund | 393e439 | 2013-05-27 22:16:59 +0200 | [diff] [blame] | 543 | #define GLFW_CONNECTED 0x00040001 |
| 544 | #define GLFW_DISCONNECTED 0x00040002 |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 545 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 546 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 547 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 548 | * GLFW API types |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 549 | *************************************************************************/ |
| 550 | |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 551 | /*! @brief Client API function pointer type. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 552 | * |
| 553 | * Generic function pointer used for returning client API function pointers |
| 554 | * without forcing a cast from a regular pointer. |
| 555 | * |
Camilla Berglund | 3f5843f | 2012-12-13 02:22:39 +0100 | [diff] [blame] | 556 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 557 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 558 | typedef void (*GLFWglproc)(void); |
| 559 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 560 | /*! @brief Opaque monitor object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 561 | * |
| 562 | * Opaque monitor object. |
| 563 | * |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 564 | * @ingroup monitor |
| 565 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 566 | typedef struct GLFWmonitor GLFWmonitor; |
Camilla Berglund | e0ce920 | 2012-08-29 20:39:05 +0200 | [diff] [blame] | 567 | |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 568 | /*! @brief Opaque window object. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 569 | * |
| 570 | * Opaque window object. |
| 571 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 572 | * @ingroup window |
| 573 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 574 | typedef struct GLFWwindow GLFWwindow; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 575 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 576 | /*! @brief The function signature for error callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 577 | * |
| 578 | * This is the function signature for error callback functions. |
| 579 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 580 | * @param[in] error An [error code](@ref errors). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 581 | * @param[in] description A UTF-8 encoded string describing the error. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 582 | * |
| 583 | * @sa glfwSetErrorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 584 | * |
| 585 | * @ingroup error |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 586 | */ |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 587 | typedef void (* GLFWerrorfun)(int,const char*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 588 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 589 | /*! @brief The function signature for window position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 590 | * |
| 591 | * This is the function signature for window position callback functions. |
| 592 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 593 | * @param[in] window The window that the user moved. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 594 | * @param[in] xpos The new x-coordinate, in screen coordinates, of the |
| 595 | * upper-left corner of the client area of the window. |
| 596 | * @param[in] ypos The new y-coordinate, in screen coordinates, of the |
| 597 | * upper-left corner of the client area of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 598 | * |
| 599 | * @sa glfwSetWindowPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 600 | * |
| 601 | * @ingroup window |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 602 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 603 | typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 604 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 605 | /*! @brief The function signature for window resize callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 606 | * |
| 607 | * This is the function signature for window size callback functions. |
| 608 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 609 | * @param[in] window The window that the user resized. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 610 | * @param[in] width The new width, in screen coordinates, of the window. |
| 611 | * @param[in] height The new height, in screen coordinates, of the window. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 612 | * |
| 613 | * @sa glfwSetWindowSizeCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 614 | * |
| 615 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 616 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 617 | typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 618 | |
| 619 | /*! @brief The function signature for window close callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 620 | * |
| 621 | * This is the function signature for window close callback functions. |
| 622 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 623 | * @param[in] window The window that the user attempted to close. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 624 | * |
| 625 | * @sa glfwSetWindowCloseCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 626 | * |
| 627 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 628 | */ |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 629 | typedef void (* GLFWwindowclosefun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 630 | |
| 631 | /*! @brief The function signature for window content refresh callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 632 | * |
| 633 | * This is the function signature for window refresh callback functions. |
| 634 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 635 | * @param[in] window The window whose content needs to be refreshed. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 636 | * |
| 637 | * @sa glfwSetWindowRefreshCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 638 | * |
| 639 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 640 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 641 | typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 642 | |
| 643 | /*! @brief The function signature for window focus/defocus callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 644 | * |
| 645 | * This is the function signature for window focus callback functions. |
| 646 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 647 | * @param[in] window The window that was focused or defocused. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 648 | * @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] | 649 | * it was defocused. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 650 | * |
| 651 | * @sa glfwSetWindowFocusCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 652 | * |
| 653 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 654 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 655 | typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 656 | |
Camilla Berglund | 06e7a96 | 2012-11-22 19:14:27 +0100 | [diff] [blame] | 657 | /*! @brief The function signature for window iconify/restore callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 658 | * |
| 659 | * This is the function signature for window iconify/restore callback |
| 660 | * functions. |
| 661 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 662 | * @param[in] window The window that was iconified or restored. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 663 | * @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] | 664 | * if it was restored. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 665 | * |
| 666 | * @sa glfwSetWindowIconifyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 667 | * |
| 668 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 669 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 670 | typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 671 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 672 | /*! @brief The function signature for framebuffer resize callbacks. |
| 673 | * |
| 674 | * This is the function signature for framebuffer resize callback |
| 675 | * functions. |
| 676 | * |
| 677 | * @param[in] window The window whose framebuffer was resized. |
| 678 | * @param[in] width The new width, in pixels, of the framebuffer. |
| 679 | * @param[in] height The new height, in pixels, of the framebuffer. |
| 680 | * |
| 681 | * @sa glfwSetFramebufferSizeCallback |
| 682 | * |
| 683 | * @ingroup window |
| 684 | */ |
| 685 | typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); |
| 686 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 687 | /*! @brief The function signature for mouse button callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 688 | * |
| 689 | * This is the function signature for mouse button callback functions. |
| 690 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 691 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 692 | * @param[in] button The [mouse button](@ref buttons) that was pressed or |
| 693 | * released. |
| 694 | * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 695 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 696 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 697 | * |
| 698 | * @sa glfwSetMouseButtonCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 699 | * |
| 700 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 701 | */ |
Camilla Berglund | 2d1b835 | 2012-12-09 19:19:00 +0100 | [diff] [blame] | 702 | typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 703 | |
| 704 | /*! @brief The function signature for cursor position callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 705 | * |
| 706 | * This is the function signature for cursor position callback functions. |
| 707 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 708 | * @param[in] window The window that received the event. |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 709 | * @param[in] xpos The new x-coordinate of the cursor. |
| 710 | * @param[in] ypos The new y-coordinate of the cursor. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 711 | * |
| 712 | * @sa glfwSetCursorPosCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 713 | * |
| 714 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 715 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 716 | typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 717 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 718 | /*! @brief The function signature for cursor enter/leave callbacks. |
| 719 | * |
| 720 | * This is the function signature for cursor enter/leave callback functions. |
| 721 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 722 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 723 | * @param[in] entered `GL_TRUE` if the cursor entered the window's client |
| 724 | * area, or `GL_FALSE` if it left it. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 725 | * |
| 726 | * @sa glfwSetCursorEnterCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 727 | * |
| 728 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 729 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 730 | typedef void (* GLFWcursorenterfun)(GLFWwindow*,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 731 | |
| 732 | /*! @brief The function signature for scroll callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 733 | * |
| 734 | * This is the function signature for scroll callback functions. |
| 735 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 736 | * @param[in] window The window that received the event. |
mewmew | cf2d260 | 2013-06-06 19:49:23 +0200 | [diff] [blame] | 737 | * @param[in] xoffset The scroll offset along the x-axis. |
| 738 | * @param[in] yoffset The scroll offset along the y-axis. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 739 | * |
| 740 | * @sa glfwSetScrollCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 741 | * |
| 742 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 743 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 744 | typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 745 | |
| 746 | /*! @brief The function signature for keyboard key callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 747 | * |
| 748 | * This is the function signature for keyboard key callback functions. |
| 749 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 750 | * @param[in] window The window that received the event. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 751 | * @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] | 752 | * @param[in] scancode The system-specific scancode of the key. |
Camilla Berglund | 253e0d6 | 2013-01-12 17:06:35 +0100 | [diff] [blame] | 753 | * @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT. |
Camilla Berglund | 98cbf6f | 2013-05-23 14:42:33 +0200 | [diff] [blame] | 754 | * @param[in] mods Bit field describing which [modifier keys](@ref mods) were |
| 755 | * held down. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 756 | * |
| 757 | * @sa glfwSetKeyCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 758 | * |
| 759 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 760 | */ |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 761 | typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 762 | |
| 763 | /*! @brief The function signature for Unicode character callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 764 | * |
| 765 | * This is the function signature for Unicode character callback functions. |
| 766 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 767 | * @param[in] window The window that received the event. |
| 768 | * @param[in] character The Unicode code point of the character. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 769 | * |
| 770 | * @sa glfwSetCharCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 771 | * |
| 772 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 773 | */ |
Camilla Berglund | 182e0af | 2013-02-25 17:02:28 +0100 | [diff] [blame] | 774 | typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 775 | |
| 776 | /*! @brief The function signature for monitor configuration callbacks. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 777 | * |
| 778 | * This is the function signature for monitor configuration callback functions. |
| 779 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 780 | * @param[in] monitor The monitor that was connected or disconnected. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 781 | * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 782 | * |
| 783 | * @sa glfwSetMonitorCallback |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 784 | * |
| 785 | * @ingroup monitor |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 786 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 787 | typedef void (* GLFWmonitorfun)(GLFWmonitor*,int); |
Camilla Berglund | 897558f | 2011-03-07 13:34:58 +0100 | [diff] [blame] | 788 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 789 | /*! @brief Video mode type. |
| 790 | * |
| 791 | * This describes a single video mode. |
| 792 | * |
| 793 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 794 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 795 | typedef struct GLFWvidmode |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 796 | { |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 797 | /*! The width, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 798 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 799 | int width; |
Camilla Berglund | 95835af | 2013-05-30 13:53:25 +0200 | [diff] [blame] | 800 | /*! The height, in screen coordinates, of the video mode. |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 801 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 802 | int height; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 803 | /*! The bit depth of the red channel of the video mode. |
| 804 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 805 | int redBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 806 | /*! The bit depth of the green channel of the video mode. |
| 807 | */ |
Camilla Berglund | 5fd3fc7 | 2010-09-09 19:44:43 +0200 | [diff] [blame] | 808 | int greenBits; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 809 | /*! The bit depth of the blue channel of the video mode. |
| 810 | */ |
Camilla Berglund | 2e8446f | 2013-04-11 01:31:00 +0200 | [diff] [blame] | 811 | int blueBits; |
Camilla Berglund | 731812c | 2013-05-30 15:52:42 +0200 | [diff] [blame] | 812 | /*! The refresh rate, in Hz, of the video mode. |
| 813 | */ |
| 814 | int refreshRate; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 815 | } GLFWvidmode; |
| 816 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 817 | /*! @brief Gamma ramp. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 818 | * |
| 819 | * This describes the gamma ramp for a monitor. |
| 820 | * |
| 821 | * @sa glfwGetGammaRamp glfwSetGammaRamp |
| 822 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 823 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 824 | */ |
Systemcluster | d0a0e37 | 2013-08-29 06:15:55 +0200 | [diff] [blame] | 825 | typedef struct GLFWgammaramp |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 826 | { |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 827 | /*! An array of value describing the response of the red channel. |
| 828 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 829 | unsigned short* red; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 830 | /*! An array of value describing the response of the green channel. |
| 831 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 832 | unsigned short* green; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 833 | /*! An array of value describing the response of the blue channel. |
| 834 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 835 | unsigned short* blue; |
Camilla Berglund | c159411 | 2013-05-27 22:29:06 +0200 | [diff] [blame] | 836 | /*! The number of elements in each array. |
| 837 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 838 | unsigned int size; |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 839 | } GLFWgammaramp; |
| 840 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 841 | |
| 842 | /************************************************************************* |
Camilla Berglund | 2fca5c5 | 2013-01-17 21:51:39 +0100 | [diff] [blame] | 843 | * GLFW API functions |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 844 | *************************************************************************/ |
| 845 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 846 | /*! @brief Initializes the GLFW library. |
| 847 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 848 | * This function initializes the GLFW library. Before most GLFW functions can |
| 849 | * be used, GLFW must be initialized, and before a program terminates GLFW |
| 850 | * should be terminated in order to free any resources allocated during or |
| 851 | * after initialization. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 852 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 853 | * If this function fails, it calls @ref glfwTerminate before returning. If it |
| 854 | * succeeds, you should call @ref glfwTerminate before the program exits. |
| 855 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 856 | * Additional calls to this function after successful initialization but before |
| 857 | * termination will succeed but will do nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 858 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 859 | * @return `GL_TRUE` if successful, or `GL_FALSE` if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 860 | * |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 861 | * @par New in GLFW 3 |
| 862 | * This function no longer registers @ref glfwTerminate with `atexit`. |
| 863 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 864 | * @note This function may only be called from the main thread. |
| 865 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 866 | * @note This function may take several seconds to complete on some systems, |
| 867 | * while on other systems it may take only a fraction of a second to complete. |
| 868 | * |
Camilla Berglund | fd3813f | 2013-09-24 21:34:46 +0200 | [diff] [blame] | 869 | * @note **OS X:** This function will change the current directory of the |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 870 | * application to the `Contents/Resources` subdirectory of the application's |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 871 | * bundle, if present. |
| 872 | * |
| 873 | * @sa glfwTerminate |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 874 | * |
| 875 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 876 | */ |
| 877 | GLFWAPI int glfwInit(void); |
| 878 | |
| 879 | /*! @brief Terminates the GLFW library. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 880 | * |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 881 | * This function destroys all remaining windows, frees any allocated resources |
| 882 | * and sets the library to an uninitialized state. Once this is called, you |
| 883 | * must again call @ref glfwInit successfully before you will be able to use |
| 884 | * most GLFW functions. |
| 885 | * |
| 886 | * If GLFW has been successfully initialized, this function should be called |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 887 | * before the program exits. If initialization fails, there is no need to call |
| 888 | * this function, as it is called by @ref glfwInit before it returns failure. |
Camilla Berglund | 23f6176 | 2013-03-12 19:53:29 +0100 | [diff] [blame] | 889 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 890 | * @remarks This function may be called before @ref glfwInit. |
| 891 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 892 | * @note This function may only be called from the main thread. |
| 893 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 894 | * @warning No window's context may be current on another thread when this |
| 895 | * function is called. |
| 896 | * |
| 897 | * @sa glfwInit |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 898 | * |
| 899 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 900 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 901 | GLFWAPI void glfwTerminate(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 902 | |
| 903 | /*! @brief Retrieves the version of the GLFW library. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 904 | * |
| 905 | * This function retrieves the major, minor and revision numbers of the GLFW |
| 906 | * library. It is intended for when you are using GLFW as a shared library and |
| 907 | * want to ensure that you are using the minimum required version. |
| 908 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 909 | * @param[out] major Where to store the major version number, or `NULL`. |
| 910 | * @param[out] minor Where to store the minor version number, or `NULL`. |
| 911 | * @param[out] rev Where to store the revision number, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 912 | * |
| 913 | * @remarks This function may be called before @ref glfwInit. |
| 914 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 915 | * @remarks This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 916 | * |
| 917 | * @sa glfwGetVersionString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 918 | * |
| 919 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 920 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 921 | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 922 | |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 923 | /*! @brief Returns a string describing the compile-time configuration. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 924 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 925 | * This function returns a static string generated at compile-time according to |
| 926 | * which configuration macros were defined. This is intended for use when |
| 927 | * submitting bug reports, to allow developers to see which code paths are |
| 928 | * enabled in a binary. |
| 929 | * |
Camilla Berglund | 6f8084f | 2013-02-14 13:14:17 +0100 | [diff] [blame] | 930 | * The format of the string is as follows: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 931 | * - The version of GLFW |
| 932 | * - The name of the window system API |
| 933 | * - The name of the context creation API |
| 934 | * - Any additional options or APIs |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 935 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 936 | * For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 937 | * back ends, the version string may look something like this: |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 938 | * |
| 939 | * 3.0.0 Win32 WGL MinGW |
| 940 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 941 | * @return The GLFW version string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 942 | * |
| 943 | * @remarks This function may be called before @ref glfwInit. |
| 944 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 945 | * @remarks This function may be called from any thread. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 946 | * |
| 947 | * @sa glfwGetVersion |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 948 | * |
| 949 | * @ingroup init |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 950 | */ |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 951 | GLFWAPI const char* glfwGetVersionString(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 952 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 953 | /*! @brief Sets the error callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 954 | * |
| 955 | * This function sets the error callback, which is called with an error code |
| 956 | * and a human-readable description each time a GLFW error occurs. |
| 957 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 958 | * @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] | 959 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 960 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 961 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 962 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 963 | * @remarks This function may be called before @ref glfwInit. |
| 964 | * |
Camilla Berglund | 9bfb925 | 2013-01-07 17:22:02 +0100 | [diff] [blame] | 965 | * @note The error callback is called by the thread where the error was |
| 966 | * generated. If you are using GLFW from multiple threads, your error callback |
| 967 | * needs to be written accordingly. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 968 | * |
| 969 | * @note Because the description string provided to the callback may have been |
| 970 | * generated specifically for that error, it is not guaranteed to be valid |
| 971 | * after the callback has returned. If you wish to use it after that, you need |
| 972 | * to make your own copy of it before returning. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 973 | * |
| 974 | * @ingroup error |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 975 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 976 | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 977 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 978 | /*! @brief Returns the currently connected monitors. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 979 | * |
| 980 | * This function returns an array of handles for all currently connected |
| 981 | * monitors. |
| 982 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 983 | * @param[out] count Where to store the size of the returned array. This is |
| 984 | * set to zero if an error occurred. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 985 | * @return An array of monitor handles, or `NULL` if an error occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 986 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 987 | * @note The returned array is allocated and freed by GLFW. You should not |
| 988 | * free it yourself. |
| 989 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 990 | * @note The returned array is valid only until the monitor configuration |
| 991 | * changes. See @ref glfwSetMonitorCallback to receive notifications of |
| 992 | * configuration changes. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 993 | * |
| 994 | * @sa glfwGetPrimaryMonitor |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 995 | * |
| 996 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 997 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 998 | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 999 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1000 | /*! @brief Returns the primary monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1001 | * |
| 1002 | * This function returns the primary monitor. This is usually the monitor |
| 1003 | * where elements like the Windows task bar or the OS X menu bar is located. |
| 1004 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1005 | * @return The primary monitor, or `NULL` if an error occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1006 | * |
| 1007 | * @sa glfwGetMonitors |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1008 | * |
| 1009 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1010 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1011 | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1012 | |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1013 | /*! @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] | 1014 | * |
| 1015 | * This function returns the position, in screen coordinates, of the upper-left |
| 1016 | * corner of the specified monitor. |
| 1017 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1018 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1019 | * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. |
| 1020 | * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1021 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1022 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1023 | */ |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1024 | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); |
| 1025 | |
| 1026 | /*! @brief Returns the physical size of the monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1027 | * |
| 1028 | * This function returns the size, in millimetres, of the display area of the |
| 1029 | * specified monitor. |
| 1030 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1031 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1032 | * @param[out] width Where to store the width, in mm, of the monitor's display |
| 1033 | * area, or `NULL`. |
| 1034 | * @param[out] height Where to store the height, in mm, of the monitor's |
| 1035 | * display area, or `NULL`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1036 | * |
| 1037 | * @note Some operating systems do not provide accurate information, either |
| 1038 | * because the monitor's EDID data is incorrect, or because the driver does not |
| 1039 | * report it accurately. |
| 1040 | * |
Camilla Berglund | ee5f30e | 2013-01-24 19:10:17 +0100 | [diff] [blame] | 1041 | * @ingroup monitor |
| 1042 | */ |
| 1043 | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1044 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1045 | /*! @brief Returns the name of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1046 | * |
| 1047 | * This function returns a human-readable name, encoded as UTF-8, of the |
| 1048 | * specified monitor. |
| 1049 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1050 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1051 | * @return The UTF-8 encoded name of the monitor, or `NULL` if an error |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 1052 | * occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1053 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1054 | * @note The returned string is allocated and freed by GLFW. You should not |
| 1055 | * free it yourself. |
| 1056 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1057 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1058 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1059 | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1060 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1061 | /*! @brief Sets the monitor configuration callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1062 | * |
| 1063 | * This function sets the monitor configuration callback, or removes the |
| 1064 | * currently set callback. This is called when a monitor is connected to or |
| 1065 | * disconnected from the system. |
| 1066 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1067 | * @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] | 1068 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1069 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1070 | * error occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1071 | * |
Camilla Berglund | c347b07 | 2013-06-12 20:57:37 +0200 | [diff] [blame] | 1072 | * @bug **X11:** This callback is not yet called on monitor configuration |
| 1073 | * changes. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1074 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1075 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1076 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1077 | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 1078 | |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1079 | /*! @brief Returns the available video modes for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1080 | * |
| 1081 | * 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] | 1082 | * monitor. The returned array is sorted in ascending order, first by color |
| 1083 | * bit depth (the sum of all channel depths) and then by resolution area (the |
| 1084 | * product of width and height). |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1085 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1086 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1087 | * @param[out] count Where to store the number of video modes in the returned |
| 1088 | * array. This is set to zero if an error occurred. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1089 | * @return An array of video modes, or `NULL` if an error occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1090 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1091 | * @note The returned array is allocated and freed by GLFW. You should not |
| 1092 | * free it yourself. |
| 1093 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1094 | * @note The returned array is valid only until this function is called again |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1095 | * for the specified monitor. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1096 | * |
| 1097 | * @sa glfwGetVideoMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1098 | * |
| 1099 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1100 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1101 | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1102 | |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1103 | /*! @brief Returns the current mode of the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1104 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1105 | * This function returns the current video mode of the specified monitor. If |
| 1106 | * you are using a full screen window, the return value will therefore depend |
| 1107 | * on whether it is focused. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1108 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1109 | * @param[in] monitor The monitor to query. |
Camilla Berglund | ce1e84d | 2013-05-22 22:16:43 +0200 | [diff] [blame] | 1110 | * @return The current mode of the monitor, or `NULL` if an error occurred. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1111 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1112 | * @note The returned struct is allocated and freed by GLFW. You should not |
| 1113 | * free it yourself. |
| 1114 | * |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1115 | * @sa glfwGetVideoModes |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1116 | * |
| 1117 | * @ingroup monitor |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1118 | */ |
Camilla Berglund | ce1e84d | 2013-05-22 22:16:43 +0200 | [diff] [blame] | 1119 | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1120 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1121 | /*! @brief Generates a gamma ramp and sets it for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1122 | * |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1123 | * This function generates a 256-element gamma ramp from the specified exponent |
Camilla Berglund | f1c88b4 | 2013-06-14 12:12:16 +0200 | [diff] [blame] | 1124 | * and then calls @ref glfwSetGammaRamp with it. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1125 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1126 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1127 | * @param[in] gamma The desired exponent. |
Camilla Berglund | dba2d80 | 2013-01-17 23:06:56 +0100 | [diff] [blame] | 1128 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1129 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1130 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1131 | GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1132 | |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1133 | /*! @brief Retrieves the current gamma ramp for the specified monitor. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1134 | * |
| 1135 | * This function retrieves the current gamma ramp of the specified monitor. |
| 1136 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1137 | * @param[in] monitor The monitor to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1138 | * @return The current gamma ramp, or `NULL` if an error occurred. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1139 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 1140 | * @note The value arrays of the returned ramp are allocated and freed by GLFW. |
| 1141 | * You should not free them yourself. |
| 1142 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1143 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1144 | */ |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1145 | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1146 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1147 | /*! @brief Sets the current gamma ramp for the specified monitor. |
| 1148 | * |
| 1149 | * This function sets the current gamma ramp for the specified monitor. |
| 1150 | * |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1151 | * @param[in] monitor The monitor whose gamma ramp to set. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1152 | * @param[in] ramp The gamma ramp to use. |
Camilla Berglund | 8954af6 | 2013-02-20 19:44:52 +0100 | [diff] [blame] | 1153 | * |
Camilla Berglund | 5d308db | 2013-05-19 15:46:44 +0200 | [diff] [blame] | 1154 | * @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] | 1155 | * |
Camilla Berglund | f5f55e3 | 2013-06-17 12:56:36 +0200 | [diff] [blame] | 1156 | * @ingroup monitor |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1157 | */ |
Camilla Berglund | 92a71e0 | 2013-02-12 13:50:41 +0100 | [diff] [blame] | 1158 | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 1159 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1160 | /*! @brief Resets all window hints to their default values. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1161 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1162 | * This function resets all window hints to their |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1163 | * [default values](@ref window_hints_values). |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1164 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1165 | * @note This function may only be called from the main thread. |
| 1166 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1167 | * @sa glfwWindowHint |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1168 | * |
| 1169 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1170 | */ |
Camilla Berglund | 5df4df6 | 2012-10-22 02:59:05 +0200 | [diff] [blame] | 1171 | GLFWAPI void glfwDefaultWindowHints(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1172 | |
| 1173 | /*! @brief Sets the specified window hint to the desired value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1174 | * |
Camilla Berglund | ed9e403 | 2012-12-23 15:59:09 +0100 | [diff] [blame] | 1175 | * This function sets hints for the next call to @ref glfwCreateWindow. The |
| 1176 | * hints, once set, retain their values until changed by a call to @ref |
| 1177 | * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is |
| 1178 | * terminated with @ref glfwTerminate. |
| 1179 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1180 | * @param[in] target The [window hint](@ref window_hints) to set. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1181 | * @param[in] hint The new value of the window hint. |
| 1182 | * |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 1183 | * @par New in GLFW 3 |
| 1184 | * Hints are no longer reset to their default values on window creation. To |
| 1185 | * set default hint values, use @ref glfwDefaultWindowHints. |
| 1186 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1187 | * @note This function may only be called from the main thread. |
| 1188 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1189 | * @sa glfwDefaultWindowHints |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1190 | * |
| 1191 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1192 | */ |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 1193 | GLFWAPI void glfwWindowHint(int target, int hint); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1194 | |
| 1195 | /*! @brief Creates a window and its associated context. |
| 1196 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1197 | * This function creates a window and its associated context. Most of the |
| 1198 | * options controlling how the window and its context should be created are |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 1199 | * specified through @ref glfwWindowHint. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1200 | * |
| 1201 | * Successful creation does not change which context is current. Before you |
| 1202 | * can use the newly created context, you need to make it current using @ref |
| 1203 | * glfwMakeContextCurrent. |
| 1204 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1205 | * Note that the created window and context may differ from what you requested, |
Camilla Berglund | fa0cbd9 | 2013-04-11 01:07:07 +0200 | [diff] [blame] | 1206 | * as not all parameters and hints are |
| 1207 | * [hard constraints](@ref window_hints_hard). This includes the size of the |
| 1208 | * window, especially for full screen windows. To retrieve the actual |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 1209 | * attributes of the created window and context, use queries like @ref |
| 1210 | * glfwGetWindowAttrib and @ref glfwGetWindowSize. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1211 | * |
Camilla Berglund | 4b7ae49 | 2013-07-07 12:06:59 +0200 | [diff] [blame] | 1212 | * To create a full screen window, you need to specify the monitor to use. If |
| 1213 | * no monitor is specified, windowed mode will be used. Unless you have a way |
| 1214 | * for the user to choose a specific monitor, it is recommended that you pick |
| 1215 | * the primary monitor. For more information on how to retrieve monitors, see |
| 1216 | * @ref monitor_monitors. |
| 1217 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1218 | * To create the window at a specific position, make it initially invisible |
| 1219 | * using the `GLFW_VISIBLE` window hint, set its position and then show it. |
| 1220 | * |
Camilla Berglund | 4b7ae49 | 2013-07-07 12:06:59 +0200 | [diff] [blame] | 1221 | * If a full screen window is active, the screensaver is prohibited from |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1222 | * starting. |
| 1223 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1224 | * @param[in] width The desired width, in screen coordinates, of the window. |
| 1225 | * This must be greater than zero. |
| 1226 | * @param[in] height The desired height, in screen coordinates, of the window. |
| 1227 | * This must be greater than zero. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1228 | * @param[in] title The initial, UTF-8 encoded window title. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1229 | * @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] | 1230 | * windowed mode. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1231 | * @param[in] share The window whose context to share resources with, or `NULL` |
| 1232 | * to not share resources. |
| 1233 | * @return The handle of the created window, or `NULL` if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1234 | * |
Camilla Berglund | 07db5da | 2013-09-26 19:15:36 +0200 | [diff] [blame^] | 1235 | * @remarks **Windows:** Window creation will fail if the Microsoft GDI |
| 1236 | * software OpenGL implementation is the only one available. |
| 1237 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1238 | * @remarks **Windows:** If the executable has an icon resource named |
| 1239 | * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is |
| 1240 | * present, the `IDI_WINLOGO` icon will be used instead. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1241 | * |
Camilla Berglund | fd3813f | 2013-09-24 21:34:46 +0200 | [diff] [blame] | 1242 | * @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] | 1243 | * window, but the dock icon will be the same as the application bundle's icon. |
| 1244 | * Also, the first time a window is opened the menu bar is populated with |
| 1245 | * common commands like Hide, Quit and About. The (minimal) about dialog uses |
| 1246 | * information from the application's bundle. For more information on bundles, |
| 1247 | * see the Bundle Programming Guide provided by Apple. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1248 | * |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 1249 | * @remarks The swap interval is not set during window creation, but is left at |
| 1250 | * the default value for that platform. For more information, see @ref |
| 1251 | * glfwSwapInterval. |
| 1252 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1253 | * @note This function may only be called from the main thread. |
| 1254 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1255 | * @sa glfwDestroyWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1256 | * |
| 1257 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1258 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1259 | 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] | 1260 | |
| 1261 | /*! @brief Destroys the specified window and its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1262 | * |
| 1263 | * This function destroys the specified window and its context. On calling |
| 1264 | * this function, no further callbacks will be called for that window. |
| 1265 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1266 | * @param[in] window The window to destroy. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1267 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1268 | * @note This function may only be called from the main thread. |
| 1269 | * |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 1270 | * @note This function may not be called from a callback. |
| 1271 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1272 | * @note If the window's context is current on the main thread, it is |
| 1273 | * detached before being destroyed. |
| 1274 | * |
| 1275 | * @warning The window's context must not be current on any other thread. |
| 1276 | * |
| 1277 | * @sa glfwCreateWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1278 | * |
| 1279 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1280 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1281 | GLFWAPI void glfwDestroyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1282 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1283 | /*! @brief Checks the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1284 | * |
| 1285 | * This function returns the value of the close flag of the specified window. |
| 1286 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1287 | * @param[in] window The window to query. |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1288 | * @return The value of the close flag. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1289 | * |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 1290 | * @remarks This function may be called from secondary threads. |
| 1291 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1292 | * @ingroup window |
| 1293 | */ |
| 1294 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); |
| 1295 | |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1296 | /*! @brief Sets the close flag of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1297 | * |
| 1298 | * This function sets the value of the close flag of the specified window. |
| 1299 | * This can be used to override the user's attempt to close the window, or |
| 1300 | * to signal that it should be closed. |
| 1301 | * |
Camilla Berglund | 64afb19 | 2013-03-06 23:29:37 +0100 | [diff] [blame] | 1302 | * @param[in] window The window whose flag to change. |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1303 | * @param[in] value The new value. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1304 | * |
Camilla Berglund | 6632cc7 | 2013-07-11 02:00:48 +0200 | [diff] [blame] | 1305 | * @remarks This function may be called from secondary threads. |
| 1306 | * |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1307 | * @ingroup window |
Camilla Berglund | 6fadf37 | 2013-03-01 13:45:12 +0100 | [diff] [blame] | 1308 | */ |
| 1309 | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); |
| 1310 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1311 | /*! @brief Sets the title of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1312 | * |
| 1313 | * This function sets the window title, encoded as UTF-8, of the specified |
| 1314 | * window. |
| 1315 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1316 | * @param[in] window The window whose title to change. |
| 1317 | * @param[in] title The UTF-8 encoded window title. |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1318 | * |
| 1319 | * @note This function may only be called from the main thread. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1320 | * |
| 1321 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1322 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1323 | GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1324 | |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1325 | /*! @brief Retrieves the position of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1326 | * |
| 1327 | * This function retrieves the position, in screen coordinates, of the |
| 1328 | * upper-left corner of the client area of the specified window. |
| 1329 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1330 | * @param[in] window The window to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1331 | * @param[out] xpos Where to store the x-coordinate of the upper-left corner of |
| 1332 | * the client area, or `NULL`. |
| 1333 | * @param[out] ypos Where to store the y-coordinate of the upper-left corner of |
| 1334 | * the client area, or `NULL`. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1335 | * |
| 1336 | * @sa glfwSetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1337 | * |
| 1338 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1339 | */ |
| 1340 | GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); |
| 1341 | |
| 1342 | /*! @brief Sets the position of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1343 | * |
| 1344 | * This function sets the position, in screen coordinates, of the upper-left |
| 1345 | * corner of the client area of the window. |
| 1346 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1347 | * If the specified window is a full screen window, this function does nothing. |
| 1348 | * |
| 1349 | * If you wish to set an initial window position you should create a hidden |
| 1350 | * window (using @ref glfwWindowHint and `GLFW_VISIBLE`), set its position and |
| 1351 | * then show it. |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1352 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1353 | * @param[in] window The window to query. |
| 1354 | * @param[in] xpos The x-coordinate of the upper-left corner of the client area. |
| 1355 | * @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] | 1356 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1357 | * @note It is very rarely a good idea to move an already visible window, as it |
| 1358 | * will confuse and annoy the user. |
| 1359 | * |
| 1360 | * @note This function may only be called from the main thread. |
| 1361 | * |
| 1362 | * @note The window manager may put limits on what positions are allowed. |
| 1363 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1364 | * @bug **X11:** Some window managers ignore the set position of hidden (i.e. |
| 1365 | * unmapped) windows, instead placing them where it thinks is appropriate once |
| 1366 | * they are shown. |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1367 | * |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1368 | * @sa glfwGetWindowPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1369 | * |
| 1370 | * @ingroup window |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1371 | */ |
Camilla Berglund | 52f718d | 2013-02-12 12:01:12 +0100 | [diff] [blame] | 1372 | GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); |
Camilla Berglund | 7c19323 | 2013-01-24 19:30:31 +0100 | [diff] [blame] | 1373 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1374 | /*! @brief Retrieves the size of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1375 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1376 | * This function retrieves the size, in screen coordinates, of the client area |
| 1377 | * of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1378 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1379 | * @param[in] window The window whose size to retrieve. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1380 | * @param[out] width Where to store the width, in screen coordinates, of the |
| 1381 | * client area, or `NULL`. |
| 1382 | * @param[out] height Where to store the height, in screen coordinates, of the |
| 1383 | * client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1384 | * |
| 1385 | * @sa glfwSetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1386 | * |
| 1387 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1388 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1389 | GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1390 | |
| 1391 | /*! @brief Sets the size of the client area of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1392 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1393 | * This function sets the size, in screen coordinates, of the client area of |
| 1394 | * the specified window. |
| 1395 | * |
| 1396 | * For full screen windows, this function selects and switches to the resolution |
| 1397 | * closest to the specified size, without affecting the window's context. As |
| 1398 | * the context is unaffected, the bit depths of the framebuffer remain |
| 1399 | * unchanged. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1400 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1401 | * @param[in] window The window to resize. |
| 1402 | * @param[in] width The desired width of the specified window. |
| 1403 | * @param[in] height The desired height of the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1404 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1405 | * @note This function may only be called from the main thread. |
| 1406 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1407 | * @note The window manager may put limits on what window sizes are allowed. |
| 1408 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1409 | * @sa glfwGetWindowSize |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1410 | * |
| 1411 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1412 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1413 | GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1414 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1415 | /*! @brief Retrieves the size of the framebuffer of the specified window. |
| 1416 | * |
| 1417 | * This function retrieves the size, in pixels, of the framebuffer of the |
| 1418 | * specified window. |
| 1419 | * |
| 1420 | * @param[in] window The window whose framebuffer to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1421 | * @param[out] width Where to store the width, in pixels, of the framebuffer, |
| 1422 | * or `NULL`. |
| 1423 | * @param[out] height Where to store the height, in pixels, of the framebuffer, |
| 1424 | * or `NULL`. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1425 | * |
| 1426 | * @sa glfwSetFramebufferSizeCallback |
| 1427 | * |
| 1428 | * @ingroup window |
| 1429 | */ |
| 1430 | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); |
| 1431 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1432 | /*! @brief Iconifies the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1433 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1434 | * This function iconifies/minimizes the specified window, if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1435 | * restored. If it is a full screen window, the original monitor resolution is |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1436 | * restored until the window is restored. If the window is already iconified, |
| 1437 | * this function does nothing. |
| 1438 | * |
| 1439 | * @param[in] window The window to iconify. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1440 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1441 | * @note This function may only be called from the main thread. |
| 1442 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1443 | * @sa glfwRestoreWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1444 | * |
| 1445 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1446 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1447 | GLFWAPI void glfwIconifyWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1448 | |
| 1449 | /*! @brief Restores the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1450 | * |
| 1451 | * This function restores the specified window, if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1452 | * iconified/minimized. If it is a full screen window, the resolution chosen |
| 1453 | * for the window is restored on the selected monitor. If the window is |
| 1454 | * already restored, this function does nothing. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1455 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1456 | * @param[in] window The window to restore. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1457 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1458 | * @note This function may only be called from the main thread. |
| 1459 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1460 | * @sa glfwIconifyWindow |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1461 | * |
| 1462 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1463 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1464 | GLFWAPI void glfwRestoreWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1465 | |
| 1466 | /*! @brief Makes the specified window visible. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1467 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1468 | * This function makes the specified window visible, if it was previously |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1469 | * 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] | 1470 | * function does nothing. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1471 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1472 | * @param[in] window The window to make visible. |
| 1473 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1474 | * @note This function may only be called from the main thread. |
| 1475 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1476 | * @sa glfwHideWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1477 | * |
| 1478 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1479 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1480 | GLFWAPI void glfwShowWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1481 | |
| 1482 | /*! @brief Hides the specified window. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1483 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1484 | * This function hides the specified window, if it was previously visible. If |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1485 | * 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] | 1486 | * nothing. |
| 1487 | * |
| 1488 | * @param[in] window The window to hide. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1489 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1490 | * @note This function may only be called from the main thread. |
| 1491 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1492 | * @sa glfwShowWindow |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1493 | * |
| 1494 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1495 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1496 | GLFWAPI void glfwHideWindow(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1497 | |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1498 | /*! @brief Returns the monitor that the window uses for full screen mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1499 | * |
| 1500 | * 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] | 1501 | * in full screen on. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1502 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1503 | * @param[in] window The window to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1504 | * @return The monitor, or `NULL` if the window is in windowed mode. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1505 | * |
Camilla Berglund | 5f68e12 | 2012-11-27 17:07:28 +0100 | [diff] [blame] | 1506 | * @ingroup window |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1507 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1508 | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); |
Camilla Berglund | 41bc0d1 | 2012-11-27 16:55:04 +0100 | [diff] [blame] | 1509 | |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 1510 | /*! @brief Returns an attribute of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1511 | * |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 1512 | * This function returns an attribute of the specified window. There are many |
| 1513 | * attributes, some related to the window and others to its context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1514 | * |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1515 | * @param[in] window The window to query. |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 1516 | * @param[in] attrib The [window attribute](@ref window_attribs) whose value to |
| 1517 | * return. |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 1518 | * @return The value of the attribute, or zero if an error occurred. |
Camilla Berglund | 1e9383d | 2012-11-23 11:41:53 +0100 | [diff] [blame] | 1519 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1520 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1521 | */ |
Camilla Berglund | ad1f6f0 | 2013-05-27 15:30:32 +0200 | [diff] [blame] | 1522 | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1523 | |
| 1524 | /*! @brief Sets the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1525 | * |
| 1526 | * This function sets the user-defined pointer of the specified window. The |
| 1527 | * current value is retained until the window is destroyed. The initial value |
| 1528 | * is `NULL`. |
| 1529 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1530 | * @param[in] window The window whose pointer to set. |
| 1531 | * @param[in] pointer The new value. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1532 | * |
| 1533 | * @sa glfwGetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1534 | * |
| 1535 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1536 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1537 | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1538 | |
| 1539 | /*! @brief Returns the user pointer of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1540 | * |
| 1541 | * This function returns the current value of the user-defined pointer of the |
| 1542 | * specified window. The initial value is `NULL`. |
| 1543 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1544 | * @param[in] window The window whose pointer to return. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1545 | * |
| 1546 | * @sa glfwSetWindowUserPointer |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1547 | * |
| 1548 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1549 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1550 | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1551 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1552 | /*! @brief Sets the position callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1553 | * |
| 1554 | * This function sets the position callback of the specified window, which is |
| 1555 | * called when the window is moved. The callback is provided with the screen |
| 1556 | * position of the upper-left corner of the client area of the window. |
| 1557 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1558 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1559 | * @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] | 1560 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1561 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1562 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1563 | * |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1564 | * @ingroup window |
| 1565 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1566 | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun); |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 1567 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1568 | /*! @brief Sets the size callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1569 | * |
| 1570 | * This function sets the size callback of the specified window, which is |
| 1571 | * 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] | 1572 | * in screen coordinates, of the client area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1573 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1574 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1575 | * @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] | 1576 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1577 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1578 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1579 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1580 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1581 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1582 | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1583 | |
| 1584 | /*! @brief Sets the close callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1585 | * |
| 1586 | * This function sets the close callback of the specified window, which is |
| 1587 | * called when the user attempts to close the window, for example by clicking |
| 1588 | * the close widget in the title bar. |
| 1589 | * |
| 1590 | * The close flag is set before this callback is called, but you can modify it |
| 1591 | * at any time with @ref glfwSetWindowShouldClose. |
| 1592 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1593 | * The close callback is not triggered by @ref glfwDestroyWindow. |
| 1594 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1595 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1596 | * @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] | 1597 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1598 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1599 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1600 | * |
Camilla Berglund | fd3813f | 2013-09-24 21:34:46 +0200 | [diff] [blame] | 1601 | * @remarks **OS X:** Selecting Quit from the application menu will |
Camilla Berglund | 1bd5984 | 2013-01-13 21:28:18 +0100 | [diff] [blame] | 1602 | * trigger the close callback for all windows. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1603 | * |
| 1604 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1605 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1606 | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1607 | |
| 1608 | /*! @brief Sets the refresh callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1609 | * |
| 1610 | * This function sets the refresh callback of the specified window, which is |
| 1611 | * called when the client area of the window needs to be redrawn, for example |
| 1612 | * if the window has been exposed after having been covered by another window. |
| 1613 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1614 | * On compositing window systems such as Aero, Compiz or Aqua, where the window |
| 1615 | * contents are saved off-screen, this callback may be called only very |
| 1616 | * infrequently or never at all. |
| 1617 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1618 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1619 | * @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] | 1620 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1621 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1622 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1623 | * |
| 1624 | * @note On compositing window systems such as Aero, Compiz or Aqua, where the |
| 1625 | * window contents are saved off-screen, this callback may be called only very |
| 1626 | * infrequently or never at all. |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 1627 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1628 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1629 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1630 | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1631 | |
| 1632 | /*! @brief Sets the focus callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1633 | * |
| 1634 | * This function sets the focus callback of the specified window, which is |
| 1635 | * called when the window gains or loses focus. |
| 1636 | * |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 1637 | * After the focus callback is called for a window that lost focus, synthetic |
| 1638 | * key and mouse button release events will be generated for all such that had |
| 1639 | * been pressed. For more information, see @ref glfwSetKeyCallback and @ref |
| 1640 | * glfwSetMouseButtonCallback. |
| 1641 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1642 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1643 | * @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] | 1644 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1645 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1646 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1647 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1648 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1649 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1650 | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1651 | |
| 1652 | /*! @brief Sets the iconify callback for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1653 | * |
| 1654 | * This function sets the iconification callback of the specified window, which |
| 1655 | * is called when the window is iconified or restored. |
| 1656 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1657 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1658 | * @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] | 1659 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1660 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1661 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1662 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1663 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1664 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1665 | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1666 | |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1667 | /*! @brief Sets the framebuffer resize callback for the specified window. |
| 1668 | * |
| 1669 | * This function sets the framebuffer resize callback of the specified window, |
| 1670 | * which is called when the framebuffer of the specified window is resized. |
| 1671 | * |
| 1672 | * @param[in] window The window whose callback to set. |
| 1673 | * @param[in] cbfun The new callback, or `NULL` to remove the currently set |
| 1674 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1675 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1676 | * error occurred. |
Camilla Berglund | 3498163 | 2013-06-03 12:51:57 +0200 | [diff] [blame] | 1677 | * |
| 1678 | * @ingroup window |
| 1679 | */ |
| 1680 | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun); |
| 1681 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1682 | /*! @brief Processes all pending events. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1683 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 1684 | * This function processes only those events that have already been received |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1685 | * and then returns immediately. Processing events will cause the window and |
| 1686 | * input callbacks associated with those events to be called. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1687 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1688 | * This function is not required for joystick input to work. |
| 1689 | * |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 1690 | * @par New in GLFW 3 |
| 1691 | * This function is no longer called by @ref glfwSwapBuffers. You need to call |
| 1692 | * it or @ref glfwWaitEvents yourself. |
| 1693 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1694 | * @note This function may only be called from the main thread. |
| 1695 | * |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 1696 | * @note This function may not be called from a callback. |
| 1697 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1698 | * @note On some platforms, certain callbacks may be called outside of a call |
| 1699 | * to one of the event processing functions. |
| 1700 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1701 | * @sa glfwWaitEvents |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1702 | * |
| 1703 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1704 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1705 | GLFWAPI void glfwPollEvents(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1706 | |
| 1707 | /*! @brief Waits until events are pending and processes them. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1708 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1709 | * This function puts the calling thread to sleep until at least one event has |
Bruce Mitchener | 5f37d36 | 2013-06-27 17:28:31 +0700 | [diff] [blame] | 1710 | * been received. Once one or more events have been received, it behaves as if |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1711 | * @ref glfwPollEvents was called, i.e. the events are processed and the |
| 1712 | * function then returns immediately. Processing events will cause the window |
| 1713 | * and input callbacks associated with those events to be called. |
| 1714 | * |
| 1715 | * Since not all events are associated with callbacks, this function may return |
| 1716 | * without a callback having been called even if you are monitoring all |
| 1717 | * callbacks. |
| 1718 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1719 | * This function is not required for joystick input to work. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1720 | * |
Camilla Berglund | 9ad1d97 | 2012-11-22 19:08:30 +0100 | [diff] [blame] | 1721 | * @note This function may only be called from the main thread. |
| 1722 | * |
Camilla Berglund | b48128f | 2013-02-14 18:49:03 +0100 | [diff] [blame] | 1723 | * @note This function may not be called from a callback. |
| 1724 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1725 | * @note On some platforms, certain callbacks may be called outside of a call |
| 1726 | * to one of the event processing functions. |
| 1727 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1728 | * @sa glfwPollEvents |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1729 | * |
| 1730 | * @ingroup window |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1731 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 1732 | GLFWAPI void glfwWaitEvents(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 1733 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1734 | /*! @brief Returns the value of an input option for the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1735 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1736 | * @param[in] window The window to query. |
Camilla Berglund | 9264b5d | 2013-04-26 14:29:55 +0200 | [diff] [blame] | 1737 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1738 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1739 | * |
| 1740 | * @sa glfwSetInputMode |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1741 | * |
| 1742 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1743 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1744 | GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1745 | |
| 1746 | /*! @brief Sets an input option for the specified window. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1747 | * @param[in] window The window whose input mode to set. |
Camilla Berglund | 9264b5d | 2013-04-26 14:29:55 +0200 | [diff] [blame] | 1748 | * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1749 | * `GLFW_STICKY_MOUSE_BUTTONS`. |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1750 | * @param[in] value The new value of the specified input mode. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1751 | * |
Camilla Berglund | 9264b5d | 2013-04-26 14:29:55 +0200 | [diff] [blame] | 1752 | * If `mode` is `GLFW_CURSOR`, the value must be one of the supported input |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1753 | * modes: |
Camilla Berglund | 13ccf7d | 2013-04-07 13:46:38 +0200 | [diff] [blame] | 1754 | * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. |
| 1755 | * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1756 | * area of the window. |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 1757 | * - `GLFW_CURSOR_DISABLED` disables the cursor and removes any limitations on |
| 1758 | * cursor movement. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1759 | * |
| 1760 | * If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to |
| 1761 | * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are |
| 1762 | * enabled, a key press will ensure that @ref glfwGetKey returns @ref |
| 1763 | * GLFW_PRESS the next time it is called even if the key had been released |
Camilla Berglund | e6bfbba | 2013-06-12 16:06:21 +0200 | [diff] [blame] | 1764 | * before the call. This is useful when you are only interested in whether |
| 1765 | * keys have been pressed but not when or in which order. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1766 | * |
| 1767 | * If `mode` is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either `GL_TRUE` |
| 1768 | * to enable sticky mouse buttons, or `GL_FALSE` to disable it. If sticky |
| 1769 | * mouse buttons are enabled, a mouse button press will ensure that @ref |
| 1770 | * glfwGetMouseButton returns @ref GLFW_PRESS the next time it is called even |
Camilla Berglund | e6bfbba | 2013-06-12 16:06:21 +0200 | [diff] [blame] | 1771 | * if the mouse button had been released before the call. This is useful when |
| 1772 | * you are only interested in whether mouse buttons have been pressed but not |
| 1773 | * when or in which order. |
Camilla Berglund | 39fe1f1 | 2013-03-12 19:39:36 +0100 | [diff] [blame] | 1774 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1775 | * @sa glfwGetInputMode |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1776 | * |
| 1777 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1778 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1779 | GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1780 | |
| 1781 | /*! @brief Returns the last reported state of a keyboard key for the specified |
| 1782 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1783 | * |
| 1784 | * This function returns the last state reported for the specified key to the |
| 1785 | * specified window. The returned state is one of `GLFW_PRESS` or |
| 1786 | * `GLFW_RELEASE`. The higher-level state `GLFW_REPEAT` is only reported to |
| 1787 | * the key callback. |
| 1788 | * |
| 1789 | * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns |
| 1790 | * `GLFW_PRESS` the first time you call this function after a key has been |
| 1791 | * pressed, even if the key has already been released. |
| 1792 | * |
| 1793 | * The key functions deal with physical keys, with [key tokens](@ref keys) |
| 1794 | * named after their use on the standard US keyboard layout. If you want to |
| 1795 | * input text, use the Unicode character callback instead. |
| 1796 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1797 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1798 | * @param[in] key The desired [keyboard key](@ref keys). |
| 1799 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1800 | * |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 1801 | * @note `GLFW_KEY_UNKNOWN` is not a valid key for this function. |
| 1802 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1803 | * @ingroup input |
| 1804 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1805 | GLFWAPI int glfwGetKey(GLFWwindow* window, int key); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1806 | |
| 1807 | /*! @brief Returns the last reported state of a mouse button for the specified |
| 1808 | * window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1809 | * |
| 1810 | * This function returns the last state reported for the specified mouse button |
| 1811 | * to the specified window. |
| 1812 | * |
| 1813 | * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function |
| 1814 | * returns `GLFW_PRESS` the first time you call this function after a mouse |
| 1815 | * button has been pressed, even if the mouse button has already been released. |
| 1816 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1817 | * @param[in] window The desired window. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1818 | * @param[in] button The desired [mouse button](@ref buttons). |
| 1819 | * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1820 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1821 | * @ingroup input |
| 1822 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 1823 | GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1824 | |
| 1825 | /*! @brief Retrieves the last reported cursor position, relative to the client |
| 1826 | * area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1827 | * |
| 1828 | * This function returns the last reported position of the cursor to the |
| 1829 | * specified window. |
| 1830 | * |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 1831 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
| 1832 | * position is unbounded and limited only by the minimum and maximum values of |
| 1833 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1834 | * |
Camilla Berglund | 3ec2925 | 2013-04-25 18:03:15 +0200 | [diff] [blame] | 1835 | * The coordinate can be converted to their integer equivalents with the |
| 1836 | * `floor` function. Casting directly to an integer type works for positive |
| 1837 | * coordinates, but fails for negative ones. |
| 1838 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1839 | * @param[in] window The desired window. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1840 | * @param[out] xpos Where to store the cursor x-coordinate, relative to the |
| 1841 | * left edge of the client area, or `NULL`. |
| 1842 | * @param[out] ypos Where to store the cursor y-coordinate, relative to the to |
| 1843 | * top edge of the client area, or `NULL`. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1844 | * |
| 1845 | * @sa glfwSetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1846 | * |
| 1847 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1848 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 1849 | GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1850 | |
| 1851 | /*! @brief Sets the position of the cursor, relative to the client area of the window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1852 | * |
| 1853 | * This function sets the position of the cursor. The specified window must be |
| 1854 | * focused. If the window does not have focus when this function is called, it |
| 1855 | * fails silently. |
| 1856 | * |
Camilla Berglund | 6df692b | 2013-04-26 17:20:31 +0200 | [diff] [blame] | 1857 | * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor |
| 1858 | * position is unbounded and limited only by the minimum and maximum values of |
| 1859 | * a `double`. |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1860 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1861 | * @param[in] window The desired window. |
| 1862 | * @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] | 1863 | * client area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1864 | * @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] | 1865 | * client area. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1866 | * |
| 1867 | * @sa glfwGetCursorPos |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1868 | * |
| 1869 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1870 | */ |
Camilla Berglund | 129e94d | 2013-04-04 16:16:21 +0200 | [diff] [blame] | 1871 | GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1872 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1873 | /*! @brief Sets the key callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1874 | * |
| 1875 | * This function sets the key callback of the specific window, which is called |
| 1876 | * when a key is pressed, repeated or released. |
| 1877 | * |
Camilla Berglund | 948cc04 | 2013-04-16 02:02:22 +0200 | [diff] [blame] | 1878 | * The key functions deal with physical keys, with layout independent |
| 1879 | * [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] | 1880 | * layout. If you want to input text, use the |
| 1881 | * [character callback](@ref glfwSetCharCallback) instead. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1882 | * |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 1883 | * When a window loses focus, it will generate synthetic key release events |
| 1884 | * for all pressed keys. You can tell these events from user-generated events |
| 1885 | * by the fact that the synthetic ones are generated after the window has lost |
| 1886 | * focus, i.e. `GLFW_FOCUSED` will be false and the focus callback will have |
| 1887 | * already been called. |
| 1888 | * |
Camilla Berglund | 11615fc | 2013-05-30 17:19:12 +0200 | [diff] [blame] | 1889 | * The scancode of a key is specific to that platform or sometimes even to that |
| 1890 | * machine. Scancodes are intended to allow users to bind keys that don't have |
| 1891 | * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their |
| 1892 | * state is not saved and so it cannot be retrieved with @ref glfwGetKey. |
| 1893 | * |
| 1894 | * Sometimes GLFW needs to generate synthetic key events, in which case the |
| 1895 | * scancode may be zero. |
| 1896 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1897 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1898 | * @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] | 1899 | * set callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1900 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1901 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1902 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1903 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1904 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1905 | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1906 | |
| 1907 | /*! @brief Sets the Unicode character callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1908 | * |
| 1909 | * This function sets the character callback of the specific window, which is |
| 1910 | * called when a Unicode character is input. |
| 1911 | * |
| 1912 | * The character callback is intended for text input. If you want to know |
| 1913 | * whether a specific key was pressed or released, use the |
| 1914 | * [key callback](@ref glfwSetKeyCallback) instead. |
| 1915 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1916 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1917 | * @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] | 1918 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1919 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1920 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1921 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1922 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1923 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1924 | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1925 | |
| 1926 | /*! @brief Sets the mouse button callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1927 | * |
| 1928 | * This function sets the mouse button callback of the specified window, which |
| 1929 | * is called when a mouse button is pressed or released. |
| 1930 | * |
Camilla Berglund | 4538a52 | 2013-04-24 19:49:46 +0200 | [diff] [blame] | 1931 | * When a window loses focus, it will generate synthetic mouse button release |
| 1932 | * events for all pressed mouse buttons. You can tell these events from |
| 1933 | * user-generated events by the fact that the synthetic ones are generated |
| 1934 | * after the window has lost focus, i.e. `GLFW_FOCUSED` will be false and the |
| 1935 | * focus callback will have already been called. |
| 1936 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1937 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1938 | * @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] | 1939 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1940 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1941 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1942 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1943 | * @ingroup input |
| 1944 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1945 | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1946 | |
| 1947 | /*! @brief Sets the cursor position callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1948 | * |
| 1949 | * This function sets the cursor position callback of the specified window, |
| 1950 | * which is called when the cursor is moved. The callback is provided with the |
| 1951 | * position relative to the upper-left corner of the client area of the window. |
| 1952 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1953 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1954 | * @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] | 1955 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1956 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1957 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1958 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1959 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1960 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1961 | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1962 | |
| 1963 | /*! @brief Sets the cursor enter/exit callback. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1964 | * |
| 1965 | * This function sets the cursor boundary crossing callback of the specified |
| 1966 | * window, which is called when the cursor enters or leaves the client area of |
| 1967 | * the window. |
| 1968 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1969 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1970 | * @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] | 1971 | * callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1972 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1973 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1974 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1975 | * @ingroup input |
| 1976 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1977 | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1978 | |
| 1979 | /*! @brief Sets the scroll callback. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1980 | * |
| 1981 | * This function sets the scroll callback of the specified window, which is |
| 1982 | * called when a scrolling device is used, such as a mouse wheel or scrolling |
| 1983 | * area of a touchpad. |
| 1984 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1985 | * The scroll callback receives all scrolling input, like that from a mouse |
| 1986 | * wheel or a touchpad scrolling area. |
| 1987 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 1988 | * @param[in] window The window whose callback to set. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 1989 | * @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] | 1990 | * set callback. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 1991 | * @return The previously set callback, or `NULL` if no callback was set or an |
| 1992 | * error occurred. |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1993 | * |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 1994 | * @ingroup input |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 1995 | */ |
Camilla Berglund | 11a27de | 2013-04-08 21:21:21 +0200 | [diff] [blame] | 1996 | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1997 | |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 1998 | /*! @brief Returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 1999 | * |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 2000 | * This function returns whether the specified joystick is present. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2001 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2002 | * @param[in] joy The joystick to query. |
Camilla Berglund | fdd4518 | 2013-05-27 15:13:09 +0200 | [diff] [blame] | 2003 | * @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2004 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2005 | * @ingroup input |
| 2006 | */ |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 2007 | GLFWAPI int glfwJoystickPresent(int joy); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2008 | |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 2009 | /*! @brief Returns the values of all axes of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2010 | * |
| 2011 | * This function returns the values of all axes of the specified joystick. |
| 2012 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2013 | * @param[in] joy The joystick to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2014 | * @param[out] count Where to store the size of the returned array. This is |
| 2015 | * set to zero if an error occurred. |
| 2016 | * @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] | 2017 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2018 | * @note The returned array is allocated and freed by GLFW. You should not |
| 2019 | * free it yourself. |
| 2020 | * |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 2021 | * @note The returned array is valid only until the next call to @ref |
| 2022 | * glfwGetJoystickAxes for that joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2023 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2024 | * @ingroup input |
| 2025 | */ |
Camilla Berglund | 180a4ee | 2013-06-04 18:20:38 +0200 | [diff] [blame] | 2026 | GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2027 | |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 2028 | /*! @brief Returns the state of all buttons of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2029 | * |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 2030 | * This function returns the state of all buttons of the specified joystick. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2031 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2032 | * @param[in] joy The joystick to query. |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2033 | * @param[out] count Where to store the size of the returned array. This is |
| 2034 | * set to zero if an error occurred. |
Camilla Berglund | e93bade | 2013-06-16 02:33:33 +0200 | [diff] [blame] | 2035 | * @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] | 2036 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2037 | * @note The returned array is allocated and freed by GLFW. You should not |
| 2038 | * free it yourself. |
| 2039 | * |
Camilla Berglund | 7f2eb7b | 2013-04-24 19:25:42 +0200 | [diff] [blame] | 2040 | * @note The returned array is valid only until the next call to @ref |
| 2041 | * glfwGetJoystickButtons for that joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2042 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2043 | * @ingroup input |
| 2044 | */ |
Camilla Berglund | 180a4ee | 2013-06-04 18:20:38 +0200 | [diff] [blame] | 2045 | GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2046 | |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 2047 | /*! @brief Returns the name of the specified joystick. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2048 | * |
| 2049 | * This function returns the name, encoded as UTF-8, of the specified joystick. |
| 2050 | * |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 2051 | * @param[in] joy The joystick to query. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2052 | * @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] | 2053 | * is not present. |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 2054 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2055 | * @note The returned string is allocated and freed by GLFW. You should not |
| 2056 | * free it yourself. |
| 2057 | * |
Camilla Berglund | d4a08b1 | 2012-12-02 17:13:41 +0100 | [diff] [blame] | 2058 | * @note The returned string is valid only until the next call to @ref |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2059 | * glfwGetJoystickName for that joystick. |
| 2060 | * |
| 2061 | * @ingroup input |
Camilla Berglund | 7d9b5c0 | 2012-12-02 16:55:09 +0100 | [diff] [blame] | 2062 | */ |
Camilla Berglund | 93a1d1c | 2012-09-07 01:01:34 +0200 | [diff] [blame] | 2063 | GLFWAPI const char* glfwGetJoystickName(int joy); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2064 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2065 | /*! @brief Sets the clipboard to the specified string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2066 | * |
| 2067 | * This function sets the system clipboard to the specified, UTF-8 encoded |
| 2068 | * string. The string is copied before returning, so you don't have to retain |
| 2069 | * it afterwards. |
| 2070 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2071 | * @param[in] window The window that will own the clipboard contents. |
| 2072 | * @param[in] string A UTF-8 encoded string. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2073 | * |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 2074 | * @note This function may only be called from the main thread. |
| 2075 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2076 | * @sa glfwGetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2077 | * |
| 2078 | * @ingroup clipboard |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2079 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2080 | GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2081 | |
| 2082 | /*! @brief Retrieves the contents of the clipboard as a string. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2083 | * |
| 2084 | * This function returns the contents of the system clipboard, if it contains |
| 2085 | * or is convertible to a UTF-8 encoded string. |
| 2086 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2087 | * @param[in] window The window that will request the clipboard contents. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2088 | * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL` |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 2089 | * if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2090 | * |
Camilla Berglund | a3ff29a | 2012-12-02 15:47:10 +0100 | [diff] [blame] | 2091 | * @note This function may only be called from the main thread. |
| 2092 | * |
Camilla Berglund | c3bb5c9 | 2013-06-05 16:04:04 +0200 | [diff] [blame] | 2093 | * @note The returned string is allocated and freed by GLFW. You should not |
| 2094 | * free it yourself. |
| 2095 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2096 | * @note The returned string is valid only until the next call to @ref |
| 2097 | * glfwGetClipboardString or @ref glfwSetClipboardString. |
| 2098 | * |
| 2099 | * @sa glfwSetClipboardString |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2100 | * |
| 2101 | * @ingroup clipboard |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2102 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2103 | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 2104 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2105 | /*! @brief Returns the value of the GLFW timer. |
| 2106 | * |
| 2107 | * This function returns the value of the GLFW timer. Unless the timer has |
| 2108 | * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW |
| 2109 | * was initialized. |
| 2110 | * |
Camilla Berglund | 5d6256c | 2013-02-25 17:53:02 +0100 | [diff] [blame] | 2111 | * @return The current value, in seconds, or zero if an error occurred. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2112 | * |
| 2113 | * @remarks This function may be called from secondary threads. |
| 2114 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2115 | * @note The resolution of the timer is system dependent, but is usually on the |
| 2116 | * order of a few micro- or nanoseconds. It uses the highest-resolution |
| 2117 | * monotonic time source on each supported platform. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2118 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2119 | * @ingroup time |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2120 | */ |
Camilla Berglund | 9a71669 | 2010-09-08 16:40:43 +0200 | [diff] [blame] | 2121 | GLFWAPI double glfwGetTime(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2122 | |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2123 | /*! @brief Sets the GLFW timer. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2124 | * |
| 2125 | * This function sets the value of the GLFW timer. It then continues to count |
| 2126 | * up from that value. |
| 2127 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2128 | * @param[in] time The new value, in seconds. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2129 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2130 | * @note The resolution of the timer is system dependent, but is usually on the |
| 2131 | * order of a few micro- or nanoseconds. It uses the highest-resolution |
| 2132 | * monotonic time source on each supported platform. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2133 | * |
| 2134 | * @ingroup time |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2135 | */ |
| 2136 | GLFWAPI void glfwSetTime(double time); |
| 2137 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2138 | /*! @brief Makes the context of the specified window current for the calling |
| 2139 | * thread. |
| 2140 | * |
| 2141 | * This function makes the context of the specified window current on the |
| 2142 | * calling thread. A context can only be made current on a single thread at |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2143 | * a time and each thread can have only a single current context at a time. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2144 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2145 | * @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] | 2146 | * detach the current context. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2147 | * |
| 2148 | * @remarks This function may be called from secondary threads. |
| 2149 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2150 | * @sa glfwGetCurrentContext |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2151 | * |
| 2152 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2153 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2154 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2155 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2156 | /*! @brief Returns the window whose context is current on the calling thread. |
| 2157 | * |
| 2158 | * This function returns the window whose context is current on the calling |
| 2159 | * thread. |
| 2160 | * |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2161 | * @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] | 2162 | * context is current. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2163 | * |
| 2164 | * @remarks This function may be called from secondary threads. |
| 2165 | * |
| 2166 | * @sa glfwMakeContextCurrent |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2167 | * |
| 2168 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2169 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2170 | GLFWAPI GLFWwindow* glfwGetCurrentContext(void); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2171 | |
| 2172 | /*! @brief Swaps the front and back buffers of the specified window. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2173 | * |
| 2174 | * This function swaps the front and back buffers of the specified window. If |
| 2175 | * the swap interval is greater than zero, the GPU driver waits the specified |
| 2176 | * number of screen updates before swapping the buffers. |
| 2177 | * |
Camilla Berglund | 9492fc5 | 2013-01-17 17:51:12 +0100 | [diff] [blame] | 2178 | * @param[in] window The window whose buffers to swap. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2179 | * |
| 2180 | * @remarks This function may be called from secondary threads. |
| 2181 | * |
Camilla Berglund | 401033c | 2013-03-12 19:17:07 +0100 | [diff] [blame] | 2182 | * @par New in GLFW 3 |
| 2183 | * This function no longer calls @ref glfwPollEvents. You need to call it or |
| 2184 | * @ref glfwWaitEvents yourself. |
| 2185 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2186 | * @sa glfwSwapInterval |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2187 | * |
| 2188 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2189 | */ |
Camilla Berglund | 9af960e | 2013-01-05 21:13:28 +0100 | [diff] [blame] | 2190 | GLFWAPI void glfwSwapBuffers(GLFWwindow* window); |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2191 | |
| 2192 | /*! @brief Sets the swap interval for the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2193 | * |
| 2194 | * This function sets the swap interval for the current context, i.e. the |
| 2195 | * number of screen updates to wait before swapping the buffers of a window and |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2196 | * returning from @ref glfwSwapBuffers. This is sometimes called 'vertical |
| 2197 | * synchronization', 'vertical retrace synchronization' or 'vsync'. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2198 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2199 | * Contexts that support either of the `WGL_EXT_swap_control_tear` and |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2200 | * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals, |
| 2201 | * which allow the driver to swap even if a frame arrives a little bit late. |
| 2202 | * You can check for the presence of these extensions using @ref |
| 2203 | * glfwExtensionSupported. For more information about swap tearing, see the |
| 2204 | * extension specifications. |
| 2205 | * |
Camilla Berglund | 5fd409b | 2013-06-05 17:53:13 +0200 | [diff] [blame] | 2206 | * @param[in] interval The minimum number of screen updates to wait for |
| 2207 | * until the buffers are swapped by @ref glfwSwapBuffers. |
| 2208 | * |
| 2209 | * @remarks This function may be called from secondary threads. |
| 2210 | * |
Camilla Berglund | 3af1c41 | 2013-09-19 21:37:01 +0200 | [diff] [blame] | 2211 | * @note This function is not called during window creation, leaving the swap |
| 2212 | * interval set to whatever is the default on that platform. This is done |
| 2213 | * because some swap interval extensions used by GLFW do not allow the swap |
| 2214 | * interval to be reset to zero once it has been set to a non-zero value. |
| 2215 | * |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2216 | * @note Some GPU drivers do not honor the requested swap interval, either |
| 2217 | * because of user settings that override the request or due to bugs in the |
| 2218 | * driver. |
| 2219 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2220 | * @sa glfwSwapBuffers |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2221 | * |
| 2222 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2223 | */ |
| 2224 | GLFWAPI void glfwSwapInterval(int interval); |
| 2225 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2226 | /*! @brief Returns whether the specified extension is available. |
| 2227 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 2228 | * This function returns whether the specified |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 2229 | * [OpenGL or context creation API extension](@ref context_glext) is supported |
| 2230 | * by the current context. For example, on Windows both the OpenGL and WGL |
| 2231 | * extension strings are checked. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2232 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2233 | * @param[in] extension The ASCII encoded name of the extension. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2234 | * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2235 | * |
| 2236 | * @remarks This function may be called from secondary threads. |
| 2237 | * |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2238 | * @note As this functions searches one or more extension strings on each call, |
| 2239 | * it is recommended that you cache its results if it's going to be used |
Camilla Berglund | 8282a8f | 2013-04-10 23:01:12 +0200 | [diff] [blame] | 2240 | * frequently. The extension strings will not change during the lifetime of |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2241 | * a context, so there is no danger in doing this. |
Camilla Berglund | e248fb6 | 2013-03-29 14:06:23 +0100 | [diff] [blame] | 2242 | * |
| 2243 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2244 | */ |
| 2245 | GLFWAPI int glfwExtensionSupported(const char* extension); |
| 2246 | |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2247 | /*! @brief Returns the address of the specified function for the current |
| 2248 | * context. |
| 2249 | * |
Camilla Berglund | 608109c | 2013-04-11 20:18:46 +0200 | [diff] [blame] | 2250 | * This function returns the address of the specified |
Camilla Berglund | 1f5f20e | 2013-05-27 17:10:34 +0200 | [diff] [blame] | 2251 | * [client API or extension function](@ref context_glext), if it is supported |
| 2252 | * by the current context. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2253 | * |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2254 | * @param[in] procname The ASCII encoded name of the function. |
Camilla Berglund | 71d2b57 | 2013-03-12 15:33:05 +0100 | [diff] [blame] | 2255 | * @return The address of the function, or `NULL` if the function is |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2256 | * unavailable. |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2257 | * |
| 2258 | * @remarks This function may be called from secondary threads. |
Camilla Berglund | 2d5fb77 | 2013-03-18 19:11:02 +0100 | [diff] [blame] | 2259 | * |
| 2260 | * @note The addresses of these functions are not guaranteed to be the same for |
| 2261 | * all contexts, especially if they use different client APIs or even different |
| 2262 | * context creation hints. |
| 2263 | * |
| 2264 | * @ingroup context |
Camilla Berglund | bce2cd6 | 2012-11-22 16:38:24 +0100 | [diff] [blame] | 2265 | */ |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 2266 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2267 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2268 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 2269 | /************************************************************************* |
| 2270 | * Global definition cleanup |
| 2271 | *************************************************************************/ |
| 2272 | |
| 2273 | /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ |
| 2274 | |
Camilla Berglund | 4afc67c | 2011-07-27 17:09:17 +0200 | [diff] [blame] | 2275 | #ifdef GLFW_WINGDIAPI_DEFINED |
| 2276 | #undef WINGDIAPI |
| 2277 | #undef GLFW_WINGDIAPI_DEFINED |
| 2278 | #endif |
| 2279 | |
| 2280 | #ifdef GLFW_CALLBACK_DEFINED |
| 2281 | #undef CALLBACK |
| 2282 | #undef GLFW_CALLBACK_DEFINED |
| 2283 | #endif |
| 2284 | |
| 2285 | /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ |
| 2286 | |
| 2287 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2288 | #ifdef __cplusplus |
| 2289 | } |
| 2290 | #endif |
| 2291 | |
Camilla Berglund | f8df91d | 2013-01-15 01:59:56 +0100 | [diff] [blame] | 2292 | #endif /* _glfw3_h_ */ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 2293 | |