Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1 | //======================================================================== |
Camilla Berglund | 6e553c7 | 2011-03-06 01:46:39 +0100 | [diff] [blame] | 2 | // GLFW - An OpenGL library |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3 | // Platform: Any |
Camilla Berglund | 38b0ccb | 2010-09-07 17:41:26 +0200 | [diff] [blame] | 4 | // API version: 3.0 |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5 | // WWW: http://www.glfw.org/ |
| 6 | //------------------------------------------------------------------------ |
| 7 | // Copyright (c) 2002-2006 Marcus Geelnard |
| 8 | // Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org> |
| 9 | // |
| 10 | // This software is provided 'as-is', without any express or implied |
| 11 | // warranty. In no event will the authors be held liable for any damages |
| 12 | // arising from the use of this software. |
| 13 | // |
| 14 | // Permission is granted to anyone to use this software for any purpose, |
| 15 | // including commercial applications, and to alter it and redistribute it |
| 16 | // freely, subject to the following restrictions: |
| 17 | // |
| 18 | // 1. The origin of this software must not be misrepresented; you must not |
| 19 | // claim that you wrote the original software. If you use this software |
| 20 | // in a product, an acknowledgment in the product documentation would |
| 21 | // be appreciated but is not required. |
| 22 | // |
| 23 | // 2. Altered source versions must be plainly marked as such, and must not |
| 24 | // be misrepresented as being the original software. |
| 25 | // |
| 26 | // 3. This notice may not be removed or altered from any source |
| 27 | // distribution. |
| 28 | // |
| 29 | //======================================================================== |
| 30 | |
| 31 | #ifndef _internal_h_ |
| 32 | #define _internal_h_ |
| 33 | |
| 34 | //======================================================================== |
| 35 | // GLFWGLOBAL is a macro that places all global variables in the init.c |
| 36 | // module (all other modules reference global variables as 'extern') |
| 37 | //======================================================================== |
| 38 | |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 39 | #if defined(_init_c_) |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 40 | #define GLFWGLOBAL |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 41 | #else |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 42 | #define GLFWGLOBAL extern |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 43 | #endif |
| 44 | |
| 45 | |
| 46 | //======================================================================== |
| 47 | // Input handling definitions |
| 48 | //======================================================================== |
| 49 | |
| 50 | // Internal key and button state/action definitions |
| 51 | #define GLFW_STICK 2 |
| 52 | |
| 53 | |
Camilla Berglund | 1a99827 | 2012-04-22 21:49:38 +0200 | [diff] [blame] | 54 | //======================================================================== |
| 55 | // Internal type declarations |
| 56 | //======================================================================== |
| 57 | |
| 58 | typedef struct _GLFWhints _GLFWhints; |
| 59 | typedef struct _GLFWwndconfig _GLFWwndconfig; |
| 60 | typedef struct _GLFWfbconfig _GLFWfbconfig; |
| 61 | typedef struct _GLFWwindow _GLFWwindow; |
| 62 | typedef struct _GLFWlibrary _GLFWlibrary; |
| 63 | |
| 64 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 65 | //------------------------------------------------------------------------ |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 66 | // Platform specific definitions goes in platform.h (which also includes |
| 67 | // glfw.h) |
| 68 | //------------------------------------------------------------------------ |
| 69 | |
Camilla Berglund | 3ca63a0 | 2010-09-17 00:54:11 +0200 | [diff] [blame] | 70 | #include "config.h" |
Camilla Berglund | 3be0c05 | 2010-11-17 14:52:47 +0100 | [diff] [blame] | 71 | |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 72 | #include "../include/GL/glfw3.h" |
Camilla Berglund | a98c66c | 2011-09-22 14:15:07 +0200 | [diff] [blame] | 73 | |
| 74 | // This path may need to be changed if you build GLFW using your own setup |
| 75 | // We ship and use our own copy of glext.h since GLFW uses fairly new |
| 76 | // extensions and not all operating systems come with an up-to-date version |
Camilla Berglund | 3b733b9 | 2011-09-06 17:32:41 +0200 | [diff] [blame] | 77 | #include "../support/GL/glext.h" |
Camilla Berglund | 3be0c05 | 2010-11-17 14:52:47 +0100 | [diff] [blame] | 78 | |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 79 | #if defined(_GLFW_COCOA_NSGL) |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 80 | #include "cocoa_platform.h" |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 81 | #elif defined(_GLFW_WIN32_WGL) |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 82 | #include "win32_platform.h" |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 83 | #elif defined(_GLFW_X11_GLX) |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 84 | #include "x11_platform.h" |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 85 | #else |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 86 | #error "No supported platform selected" |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 87 | #endif |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 88 | |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 89 | |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 90 | //------------------------------------------------------------------------ |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 91 | // Window hints, set by glfwOpenWindowHint and consumed by glfwOpenWindow |
| 92 | // A bucket of semi-random stuff lumped together for historical reasons |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 93 | // This is used only by the platform independent code and only to store |
| 94 | // parameters passed to us by glfwOpenWindowHint |
| 95 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 96 | struct _GLFWhints |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 97 | { |
Camilla Berglund | 950a3be | 2010-09-09 19:58:51 +0200 | [diff] [blame] | 98 | int redBits; |
| 99 | int greenBits; |
| 100 | int blueBits; |
| 101 | int alphaBits; |
| 102 | int depthBits; |
| 103 | int stencilBits; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 104 | int refreshRate; |
| 105 | int accumRedBits; |
| 106 | int accumGreenBits; |
| 107 | int accumBlueBits; |
| 108 | int accumAlphaBits; |
| 109 | int auxBuffers; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 110 | GLboolean stereo; |
Camilla Berglund | a18cd1b | 2011-11-02 16:56:34 +0100 | [diff] [blame] | 111 | GLboolean resizable; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 112 | int samples; |
| 113 | int glMajor; |
| 114 | int glMinor; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 115 | GLboolean glForward; |
| 116 | GLboolean glDebug; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 117 | int glProfile; |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 118 | int glRobustness; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 119 | }; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 120 | |
| 121 | |
| 122 | //------------------------------------------------------------------------ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 123 | // Parameters relating to the creation of the context and window but not |
| 124 | // directly related to the properties of the framebuffer |
| 125 | // This is used to pass window and context creation parameters from the |
| 126 | // platform independent code to the platform specific code |
| 127 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 128 | struct _GLFWwndconfig |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 129 | { |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 130 | int mode; |
| 131 | const char* title; |
| 132 | int refreshRate; |
Camilla Berglund | a18cd1b | 2011-11-02 16:56:34 +0100 | [diff] [blame] | 133 | GLboolean resizable; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 134 | int glMajor; |
| 135 | int glMinor; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 136 | GLboolean glForward; |
| 137 | GLboolean glDebug; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 138 | int glProfile; |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 139 | int glRobustness; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 140 | _GLFWwindow* share; |
| 141 | }; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 142 | |
| 143 | |
| 144 | //------------------------------------------------------------------------ |
| 145 | // Framebuffer configuration descriptor, i.e. buffers and their sizes |
| 146 | // Also a platform specific ID used to map back to the actual backend APIs |
| 147 | // This is used to pass framebuffer parameters from the platform independent |
| 148 | // code to the platform specific code, and also to enumerate and select |
| 149 | // available framebuffer configurations |
| 150 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 151 | struct _GLFWfbconfig |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 152 | { |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 153 | int redBits; |
| 154 | int greenBits; |
| 155 | int blueBits; |
| 156 | int alphaBits; |
| 157 | int depthBits; |
| 158 | int stencilBits; |
| 159 | int accumRedBits; |
| 160 | int accumGreenBits; |
| 161 | int accumBlueBits; |
| 162 | int accumAlphaBits; |
| 163 | int auxBuffers; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 164 | GLboolean stereo; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 165 | int samples; |
| 166 | GLFWintptr platformID; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 167 | }; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 168 | |
| 169 | |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 170 | //------------------------------------------------------------------------ |
| 171 | // Window structure |
| 172 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 173 | struct _GLFWwindow |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 174 | { |
Camilla Berglund | 326d997 | 2010-09-10 00:06:23 +0200 | [diff] [blame] | 175 | struct _GLFWwindow* next; |
| 176 | |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 177 | // Window settings and state |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 178 | GLboolean iconified; // GL_TRUE if this window is iconified |
Camilla Berglund | 867e747 | 2010-09-16 06:02:44 +0200 | [diff] [blame] | 179 | GLboolean closeRequested; // GL_TRUE if this window should be closed |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 180 | int width, height; |
Camilla Berglund | 318f731 | 2010-09-14 03:53:22 +0200 | [diff] [blame] | 181 | int positionX, positionY; |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 182 | int mode; // GLFW_WINDOW or GLFW_FULLSCREEN |
Camilla Berglund | a18cd1b | 2011-11-02 16:56:34 +0100 | [diff] [blame] | 183 | GLboolean resizable; // GL_TRUE if user may resize this window |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 184 | int refreshRate; // monitor refresh rate |
Camilla Berglund | 48f5a7e | 2010-09-09 22:44:38 +0200 | [diff] [blame] | 185 | void* userPointer; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 186 | |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 187 | // Window input state |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 188 | GLboolean stickyKeys; |
| 189 | GLboolean stickyMouseButtons; |
| 190 | GLboolean keyRepeat; |
Camilla Berglund | ce288a8 | 2012-02-04 00:51:35 +0100 | [diff] [blame] | 191 | GLboolean systemKeys; // system keys enabled flag |
Camilla Berglund | 2660b27 | 2011-10-13 15:20:59 +0200 | [diff] [blame] | 192 | int cursorPosX, cursorPosY; |
Camilla Berglund | b1656d7 | 2011-09-06 13:55:29 +0200 | [diff] [blame] | 193 | int cursorMode; |
Camilla Berglund | 4ef9aec | 2012-03-28 21:54:09 +0200 | [diff] [blame] | 194 | double scrollX, scrollY; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 195 | char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1]; |
| 196 | char key[GLFW_KEY_LAST + 1]; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 197 | |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 198 | // Framebuffer attributes |
Camilla Berglund | 053737e | 2012-08-02 01:18:35 +0200 | [diff] [blame] | 199 | GLint redBits; |
| 200 | GLint greenBits; |
| 201 | GLint blueBits; |
| 202 | GLint alphaBits; |
| 203 | GLint depthBits; |
| 204 | GLint stencilBits; |
| 205 | GLint accumRedBits; |
| 206 | GLint accumGreenBits; |
| 207 | GLint accumBlueBits; |
| 208 | GLint accumAlphaBits; |
| 209 | GLint auxBuffers; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 210 | GLboolean stereo; |
Camilla Berglund | 053737e | 2012-08-02 01:18:35 +0200 | [diff] [blame] | 211 | GLint samples; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 212 | |
| 213 | // OpenGL extensions and context attributes |
| 214 | int glMajor, glMinor, glRevision; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 215 | GLboolean glForward, glDebug; |
| 216 | int glProfile; |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 217 | int glRobustness; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 218 | PFNGLGETSTRINGIPROC GetStringi; |
| 219 | |
Camilla Berglund | e9eb841 | 2010-10-14 16:40:10 +0200 | [diff] [blame] | 220 | // These are defined in the current port's platform.h |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 221 | _GLFW_PLATFORM_WINDOW_STATE; |
Camilla Berglund | 3228755 | 2010-09-09 20:36:23 +0200 | [diff] [blame] | 222 | _GLFW_PLATFORM_CONTEXT_STATE; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 223 | }; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 224 | |
| 225 | |
| 226 | //------------------------------------------------------------------------ |
| 227 | // Library global data |
| 228 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 229 | struct _GLFWlibrary |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 230 | { |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 231 | _GLFWhints hints; |
Camilla Berglund | 326d997 | 2010-09-10 00:06:23 +0200 | [diff] [blame] | 232 | |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 233 | _GLFWwindow* windowListHead; |
| 234 | _GLFWwindow* currentWindow; |
| 235 | _GLFWwindow* activeWindow; |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 236 | |
Camilla Berglund | 4044c2d | 2010-10-24 18:28:55 +0200 | [diff] [blame] | 237 | GLFWwindowsizefun windowSizeCallback; |
| 238 | GLFWwindowclosefun windowCloseCallback; |
| 239 | GLFWwindowrefreshfun windowRefreshCallback; |
| 240 | GLFWwindowfocusfun windowFocusCallback; |
| 241 | GLFWwindowiconifyfun windowIconifyCallback; |
| 242 | GLFWmousebuttonfun mouseButtonCallback; |
Camilla Berglund | cef9dea | 2012-06-22 13:53:02 +0200 | [diff] [blame] | 243 | GLFWcursorposfun cursorPosCallback; |
Camilla Berglund | 1ddafc2 | 2012-01-30 22:30:40 +0100 | [diff] [blame] | 244 | GLFWcursorenterfun cursorEnterCallback; |
Camilla Berglund | 4044c2d | 2010-10-24 18:28:55 +0200 | [diff] [blame] | 245 | GLFWscrollfun scrollCallback; |
| 246 | GLFWkeyfun keyCallback; |
| 247 | GLFWcharfun charCallback; |
| 248 | |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 249 | GLFWgammaramp currentRamp; |
| 250 | GLFWgammaramp originalRamp; |
| 251 | int originalRampSize; |
Camilla Berglund | 79bef68 | 2012-05-24 11:46:51 +0200 | [diff] [blame] | 252 | GLboolean rampChanged; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 253 | |
Camilla Berglund | e9eb841 | 2010-10-14 16:40:10 +0200 | [diff] [blame] | 254 | // This is defined in the current port's platform.h |
Camilla Berglund | 21e77fe | 2012-04-22 15:53:02 +0200 | [diff] [blame] | 255 | _GLFW_PLATFORM_LIBRARY_WINDOW_STATE; |
| 256 | _GLFW_PLATFORM_LIBRARY_OPENGL_STATE; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 257 | }; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 258 | |
| 259 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 260 | //======================================================================== |
| 261 | // System independent global variables (GLFW internals) |
| 262 | //======================================================================== |
| 263 | |
| 264 | // Flag indicating if GLFW has been initialized |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 265 | #if defined(_init_c_) |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 266 | GLboolean _glfwInitialized = GL_FALSE; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 267 | #else |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 268 | GLFWGLOBAL GLboolean _glfwInitialized; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 269 | #endif |
| 270 | |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 271 | GLFWGLOBAL _GLFWlibrary _glfwLibrary; |
| 272 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 273 | |
| 274 | //======================================================================== |
| 275 | // Prototypes for platform specific implementation functions |
| 276 | //======================================================================== |
| 277 | |
| 278 | // Init/terminate |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 279 | int _glfwPlatformInit(void); |
| 280 | int _glfwPlatformTerminate(void); |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 281 | const char* _glfwPlatformGetVersionString(void); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 282 | |
Camilla Berglund | ce288a8 | 2012-02-04 00:51:35 +0100 | [diff] [blame] | 283 | // Input |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 284 | void _glfwPlatformEnableSystemKeys(_GLFWwindow* window); |
| 285 | void _glfwPlatformDisableSystemKeys(_GLFWwindow* window); |
Camilla Berglund | cef9dea | 2012-06-22 13:53:02 +0200 | [diff] [blame] | 286 | void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y); |
Camilla Berglund | c1dd245 | 2012-04-06 14:37:31 +0200 | [diff] [blame] | 287 | void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 288 | |
| 289 | // Fullscreen |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 290 | int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount); |
| 291 | void _glfwPlatformGetDesktopMode(GLFWvidmode* mode); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 292 | |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 293 | // Gamma ramp |
Camilla Berglund | 85bcd1f | 2010-10-13 22:42:31 +0200 | [diff] [blame] | 294 | void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 295 | void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp); |
| 296 | |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 297 | // Clipboard |
Camilla Berglund | bf1ada0 | 2012-04-09 16:00:54 +0200 | [diff] [blame] | 298 | void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string); |
Camilla Berglund | f868712 | 2012-04-12 00:51:58 +0200 | [diff] [blame] | 299 | const char* _glfwPlatformGetClipboardString(_GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 300 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 301 | // Joystick |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 302 | int _glfwPlatformGetJoystickParam(int joy, int param); |
| 303 | int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes); |
| 304 | int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 305 | |
| 306 | // Time |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 307 | double _glfwPlatformGetTime(void); |
| 308 | void _glfwPlatformSetTime(double time); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 309 | |
| 310 | // Window management |
Camilla Berglund | 819d044 | 2010-09-13 23:42:51 +0200 | [diff] [blame] | 311 | int _glfwPlatformOpenWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 312 | void _glfwPlatformCloseWindow(_GLFWwindow* window); |
| 313 | void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title); |
| 314 | void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height); |
| 315 | void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y); |
| 316 | void _glfwPlatformIconifyWindow(_GLFWwindow* window); |
| 317 | void _glfwPlatformRestoreWindow(_GLFWwindow* window); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 318 | |
| 319 | // Event management |
| 320 | void _glfwPlatformPollEvents(void); |
| 321 | void _glfwPlatformWaitEvents(void); |
| 322 | |
| 323 | // OpenGL context management |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 324 | void _glfwPlatformMakeContextCurrent(_GLFWwindow* window); |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 325 | void _glfwPlatformSwapBuffers(void); |
| 326 | void _glfwPlatformSwapInterval(int interval); |
| 327 | void _glfwPlatformRefreshWindowParams(void); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 328 | int _glfwPlatformExtensionSupported(const char* extension); |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 329 | GLFWglproc _glfwPlatformGetProcAddress(const char* procname); |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 330 | void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 331 | |
| 332 | |
| 333 | //======================================================================== |
| 334 | // Prototypes for platform independent internal functions |
| 335 | //======================================================================== |
| 336 | |
Camilla Berglund | 3089e60 | 2010-09-16 03:48:19 +0200 | [diff] [blame] | 337 | // Fullscren management (fullscreen.c) |
| 338 | void _glfwSplitBPP(int bpp, int* red, int* green, int* blue); |
| 339 | |
Camilla Berglund | 596f56f | 2011-03-07 13:56:28 +0100 | [diff] [blame] | 340 | // Error handling (error.c) |
Camilla Berglund | f1e7d7c | 2010-11-23 17:45:23 +0100 | [diff] [blame] | 341 | void _glfwSetError(int error, const char* description); |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 342 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 343 | // Window management (window.c) |
Camilla Berglund | 0f481cb | 2011-03-07 14:16:31 +0100 | [diff] [blame] | 344 | void _glfwSetDefaultWindowHints(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 345 | |
Camilla Berglund | b016d64 | 2012-01-31 15:27:15 +0100 | [diff] [blame] | 346 | // Window event notification (window.c) |
Camilla Berglund | d0840bd | 2011-10-09 17:10:40 +0200 | [diff] [blame] | 347 | void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated); |
| 348 | void _glfwInputWindowPos(_GLFWwindow* window, int x, int y); |
| 349 | void _glfwInputWindowSize(_GLFWwindow* window, int width, int height); |
| 350 | void _glfwInputWindowIconify(_GLFWwindow* window, int iconified); |
Camilla Berglund | 72ef537 | 2011-10-09 21:12:13 +0200 | [diff] [blame] | 351 | void _glfwInputWindowDamage(_GLFWwindow* window); |
Camilla Berglund | d0840bd | 2011-10-09 17:10:40 +0200 | [diff] [blame] | 352 | |
Camilla Berglund | b016d64 | 2012-01-31 15:27:15 +0100 | [diff] [blame] | 353 | // Input event notification (input.c) |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 354 | void _glfwInputKey(_GLFWwindow* window, int key, int action); |
Camilla Berglund | 93ea341 | 2010-09-09 19:33:37 +0200 | [diff] [blame] | 355 | void _glfwInputChar(_GLFWwindow* window, int character); |
Camilla Berglund | 4ef9aec | 2012-03-28 21:54:09 +0200 | [diff] [blame] | 356 | void _glfwInputScroll(_GLFWwindow* window, double x, double y); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 357 | void _glfwInputMouseClick(_GLFWwindow* window, int button, int action); |
Camilla Berglund | d0840bd | 2011-10-09 17:10:40 +0200 | [diff] [blame] | 358 | void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y); |
Camilla Berglund | c4806b9 | 2012-01-30 22:59:38 +0100 | [diff] [blame] | 359 | void _glfwInputCursorEnter(_GLFWwindow* window, int entered); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 360 | |
Camilla Berglund | 596f56f | 2011-03-07 13:56:28 +0100 | [diff] [blame] | 361 | // OpenGL context helpers (opengl.c) |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 362 | int _glfwStringInExtensionString(const char* string, const GLubyte* extensions); |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 363 | const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, |
| 364 | const _GLFWfbconfig* alternatives, |
| 365 | unsigned int count); |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame^] | 366 | GLboolean _glfwRefreshContextParams(void); |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 367 | GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig); |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame^] | 368 | GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 369 | |
| 370 | |
| 371 | #endif // _internal_h_ |