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