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 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 34 | |
| 35 | //======================================================================== |
| 36 | // Input handling definitions |
| 37 | //======================================================================== |
| 38 | |
| 39 | // Internal key and button state/action definitions |
| 40 | #define GLFW_STICK 2 |
| 41 | |
| 42 | |
Camilla Berglund | 1a99827 | 2012-04-22 21:49:38 +0200 | [diff] [blame] | 43 | //======================================================================== |
| 44 | // Internal type declarations |
| 45 | //======================================================================== |
| 46 | |
| 47 | typedef struct _GLFWhints _GLFWhints; |
| 48 | typedef struct _GLFWwndconfig _GLFWwndconfig; |
| 49 | typedef struct _GLFWfbconfig _GLFWfbconfig; |
| 50 | typedef struct _GLFWwindow _GLFWwindow; |
| 51 | typedef struct _GLFWlibrary _GLFWlibrary; |
Camilla Berglund | a0429e4 | 2012-07-11 00:33:19 +0200 | [diff] [blame] | 52 | typedef struct _GLFWmonitor _GLFWmonitor; |
Camilla Berglund | 1a99827 | 2012-04-22 21:49:38 +0200 | [diff] [blame] | 53 | |
| 54 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 55 | //------------------------------------------------------------------------ |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 56 | // Platform specific definitions goes in platform.h (which also includes |
| 57 | // glfw.h) |
| 58 | //------------------------------------------------------------------------ |
| 59 | |
Camilla Berglund | 3ca63a0 | 2010-09-17 00:54:11 +0200 | [diff] [blame] | 60 | #include "config.h" |
Camilla Berglund | 3be0c05 | 2010-11-17 14:52:47 +0100 | [diff] [blame] | 61 | |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 62 | #include "../include/GL/glfw3.h" |
Camilla Berglund | a98c66c | 2011-09-22 14:15:07 +0200 | [diff] [blame] | 63 | |
| 64 | // This path may need to be changed if you build GLFW using your own setup |
| 65 | // We ship and use our own copy of glext.h since GLFW uses fairly new |
| 66 | // 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] | 67 | #include "../support/GL/glext.h" |
Camilla Berglund | 3be0c05 | 2010-11-17 14:52:47 +0100 | [diff] [blame] | 68 | |
Camilla Berglund | 34d3833 | 2012-11-27 15:02:26 +0100 | [diff] [blame] | 69 | #if defined(_GLFW_COCOA) |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 70 | #include "cocoa_platform.h" |
Camilla Berglund | 34d3833 | 2012-11-27 15:02:26 +0100 | [diff] [blame] | 71 | #elif defined(_GLFW_WIN32) |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 72 | #include "win32_platform.h" |
Camilla Berglund | 34d3833 | 2012-11-27 15:02:26 +0100 | [diff] [blame] | 73 | #elif defined(_GLFW_X11) |
Camilla Berglund | f6dfaf5 | 2012-02-05 16:56:26 +0100 | [diff] [blame] | 74 | #include "x11_platform.h" |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 75 | #else |
Camilla Berglund | 5da8ed2 | 2012-12-02 19:01:20 +0100 | [diff] [blame] | 76 | #error "No supported window creation API selected" |
Camilla Berglund | 53f4f54 | 2011-07-26 15:16:34 +0200 | [diff] [blame] | 77 | #endif |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 78 | |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 79 | |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 80 | //------------------------------------------------------------------------ |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 81 | // Window hints, set by glfwWindowHint and consumed by glfwCreateWindow |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 82 | // A bucket of semi-random stuff lumped together for historical reasons |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 83 | // This is used only by the platform independent code and only to store |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 84 | // parameters passed to us by glfwWindowHint |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 85 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 86 | struct _GLFWhints |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 87 | { |
Camilla Berglund | 950a3be | 2010-09-09 19:58:51 +0200 | [diff] [blame] | 88 | int redBits; |
| 89 | int greenBits; |
| 90 | int blueBits; |
| 91 | int alphaBits; |
| 92 | int depthBits; |
| 93 | int stencilBits; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 94 | int accumRedBits; |
| 95 | int accumGreenBits; |
| 96 | int accumBlueBits; |
| 97 | int accumAlphaBits; |
| 98 | int auxBuffers; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 99 | GLboolean stereo; |
Camilla Berglund | a18cd1b | 2011-11-02 16:56:34 +0100 | [diff] [blame] | 100 | GLboolean resizable; |
Camilla Berglund | 8bb5c59 | 2012-08-21 21:18:09 +0200 | [diff] [blame] | 101 | GLboolean visible; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 102 | int samples; |
Camilla Berglund | 69a9005 | 2012-12-02 16:10:00 +0100 | [diff] [blame] | 103 | GLboolean sRGB; |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 104 | int clientAPI; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 105 | int glMajor; |
| 106 | int glMinor; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 107 | GLboolean glForward; |
| 108 | GLboolean glDebug; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 109 | int glProfile; |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 110 | int glRobustness; |
m@bitsnbites.eu | c9f4ded | 2012-10-28 00:23:28 +0200 | [diff] [blame] | 111 | int positionX; |
| 112 | int positionY; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 113 | }; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 114 | |
| 115 | |
| 116 | //------------------------------------------------------------------------ |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 117 | // Parameters relating to the creation of the context and window but not |
| 118 | // directly related to the properties of the framebuffer |
| 119 | // This is used to pass window and context creation parameters from the |
| 120 | // platform independent code to the platform specific code |
| 121 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 122 | struct _GLFWwndconfig |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 123 | { |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 124 | const char* title; |
Camilla Berglund | a18cd1b | 2011-11-02 16:56:34 +0100 | [diff] [blame] | 125 | GLboolean resizable; |
Camilla Berglund | 8bb5c59 | 2012-08-21 21:18:09 +0200 | [diff] [blame] | 126 | GLboolean visible; |
m@bitsnbites.eu | c9f4ded | 2012-10-28 00:23:28 +0200 | [diff] [blame] | 127 | int positionX; |
| 128 | int positionY; |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 129 | int clientAPI; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 130 | int glMajor; |
| 131 | int glMinor; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 132 | GLboolean glForward; |
| 133 | GLboolean glDebug; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 134 | int glProfile; |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 135 | int glRobustness; |
Camilla Berglund | 1be1636 | 2012-09-27 21:37:36 +0200 | [diff] [blame] | 136 | _GLFWmonitor* monitor; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 137 | _GLFWwindow* share; |
| 138 | }; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 139 | |
| 140 | |
| 141 | //------------------------------------------------------------------------ |
| 142 | // Framebuffer configuration descriptor, i.e. buffers and their sizes |
| 143 | // Also a platform specific ID used to map back to the actual backend APIs |
| 144 | // This is used to pass framebuffer parameters from the platform independent |
| 145 | // code to the platform specific code, and also to enumerate and select |
| 146 | // available framebuffer configurations |
| 147 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 148 | struct _GLFWfbconfig |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 149 | { |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 150 | int redBits; |
| 151 | int greenBits; |
| 152 | int blueBits; |
| 153 | int alphaBits; |
| 154 | int depthBits; |
| 155 | int stencilBits; |
| 156 | int accumRedBits; |
| 157 | int accumGreenBits; |
| 158 | int accumBlueBits; |
| 159 | int accumAlphaBits; |
| 160 | int auxBuffers; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 161 | GLboolean stereo; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 162 | int samples; |
Camilla Berglund | 69a9005 | 2012-12-02 16:10:00 +0100 | [diff] [blame] | 163 | GLboolean sRGB; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 164 | GLFWintptr platformID; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 165 | }; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 166 | |
| 167 | |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 168 | //------------------------------------------------------------------------ |
| 169 | // Window structure |
| 170 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 171 | struct _GLFWwindow |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 172 | { |
Camilla Berglund | 326d997 | 2010-09-10 00:06:23 +0200 | [diff] [blame] | 173 | struct _GLFWwindow* next; |
| 174 | |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 175 | // Window settings and state |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 176 | GLboolean iconified; // GL_TRUE if this window is iconified |
Camilla Berglund | 867e747 | 2010-09-16 06:02:44 +0200 | [diff] [blame] | 177 | GLboolean closeRequested; // GL_TRUE if this window should be closed |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 178 | int width, height; |
Camilla Berglund | 318f731 | 2010-09-14 03:53:22 +0200 | [diff] [blame] | 179 | int positionX, positionY; |
Camilla Berglund | a18cd1b | 2011-11-02 16:56:34 +0100 | [diff] [blame] | 180 | GLboolean resizable; // GL_TRUE if user may resize this window |
Camilla Berglund | 8bb5c59 | 2012-08-21 21:18:09 +0200 | [diff] [blame] | 181 | GLboolean visible; // GL_TRUE if this window is visible |
Camilla Berglund | 48f5a7e | 2010-09-09 22:44:38 +0200 | [diff] [blame] | 182 | void* userPointer; |
Camilla Berglund | 1be1636 | 2012-09-27 21:37:36 +0200 | [diff] [blame] | 183 | _GLFWmonitor* monitor; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 184 | |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 185 | // Window input state |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 186 | GLboolean stickyKeys; |
| 187 | GLboolean stickyMouseButtons; |
Camilla Berglund | 2660b27 | 2011-10-13 15:20:59 +0200 | [diff] [blame] | 188 | int cursorPosX, cursorPosY; |
Camilla Berglund | b1656d7 | 2011-09-06 13:55:29 +0200 | [diff] [blame] | 189 | int cursorMode; |
Camilla Berglund | 4ef9aec | 2012-03-28 21:54:09 +0200 | [diff] [blame] | 190 | double scrollX, scrollY; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 191 | char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1]; |
| 192 | char key[GLFW_KEY_LAST + 1]; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 193 | |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 194 | // OpenGL extensions and context attributes |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 195 | int clientAPI; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 196 | int glMajor, glMinor, glRevision; |
Camilla Berglund | 70b9a1f | 2010-10-25 12:36:14 +0200 | [diff] [blame] | 197 | GLboolean glForward, glDebug; |
| 198 | int glProfile; |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 199 | int glRobustness; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 200 | PFNGLGETSTRINGIPROC GetStringi; |
| 201 | |
Camilla Berglund | 1a3d47d | 2012-11-30 13:56:42 +0100 | [diff] [blame] | 202 | GLFWwindowposfun windowPosCallback; |
Camilla Berglund | 18d71c2 | 2012-10-28 13:45:11 +0100 | [diff] [blame] | 203 | GLFWwindowsizefun windowSizeCallback; |
| 204 | GLFWwindowclosefun windowCloseCallback; |
| 205 | GLFWwindowrefreshfun windowRefreshCallback; |
| 206 | GLFWwindowfocusfun windowFocusCallback; |
| 207 | GLFWwindowiconifyfun windowIconifyCallback; |
| 208 | GLFWmousebuttonfun mouseButtonCallback; |
| 209 | GLFWcursorposfun cursorPosCallback; |
| 210 | GLFWcursorenterfun cursorEnterCallback; |
| 211 | GLFWscrollfun scrollCallback; |
| 212 | GLFWkeyfun keyCallback; |
| 213 | GLFWcharfun charCallback; |
| 214 | |
Camilla Berglund | e9eb841 | 2010-10-14 16:40:10 +0200 | [diff] [blame] | 215 | // These are defined in the current port's platform.h |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 216 | _GLFW_PLATFORM_WINDOW_STATE; |
Camilla Berglund | 3228755 | 2010-09-09 20:36:23 +0200 | [diff] [blame] | 217 | _GLFW_PLATFORM_CONTEXT_STATE; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 218 | }; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 219 | |
| 220 | |
| 221 | //------------------------------------------------------------------------ |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 222 | // Display structure |
| 223 | //------------------------------------------------------------------------ |
Marcel Metz | 426df42 | 2011-10-03 03:24:35 -0400 | [diff] [blame] | 224 | struct _GLFWmonitor |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 225 | { |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 226 | void* userPointer; |
| 227 | |
Camilla Berglund | 9738728 | 2011-10-06 23:28:56 +0200 | [diff] [blame] | 228 | char* name; |
Camilla Berglund | 20a49a7 | 2012-09-13 17:46:40 +0200 | [diff] [blame] | 229 | |
| 230 | GLboolean primary; |
| 231 | |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 232 | // physical dimensions in millimeters. |
| 233 | int physicalWidth; |
| 234 | int physicalHeight; |
| 235 | // logical orientation of the screen on the desktop |
Camilla Berglund | 2108360 | 2012-10-22 02:39:22 +0200 | [diff] [blame] | 236 | int positionX; |
| 237 | int positionY; |
Marcel Metz | 58d4323 | 2011-10-02 16:13:47 -0400 | [diff] [blame] | 238 | |
Camilla Berglund | 854e634 | 2012-08-03 02:57:33 +0200 | [diff] [blame] | 239 | GLFWvidmode* modes; |
Camilla Berglund | b66e1de | 2012-12-27 18:37:55 +0100 | [diff] [blame] | 240 | int modeCount; |
Camilla Berglund | 854e634 | 2012-08-03 02:57:33 +0200 | [diff] [blame] | 241 | |
Marcel Metz | 58d4323 | 2011-10-02 16:13:47 -0400 | [diff] [blame] | 242 | // These are defined in the current port's platform.h |
Marcel Metz | 426df42 | 2011-10-03 03:24:35 -0400 | [diff] [blame] | 243 | _GLFW_PLATFORM_MONITOR_STATE; |
Marcel Metz | beacbb3 | 2011-05-07 10:53:50 +0200 | [diff] [blame] | 244 | }; |
| 245 | |
| 246 | //------------------------------------------------------------------------ |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 247 | // Library global data |
| 248 | //------------------------------------------------------------------------ |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 249 | struct _GLFWlibrary |
Camilla Berglund | 12d17b9 | 2010-09-09 20:18:10 +0200 | [diff] [blame] | 250 | { |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 251 | _GLFWhints hints; |
Camilla Berglund | 326d997 | 2010-09-10 00:06:23 +0200 | [diff] [blame] | 252 | |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 253 | _GLFWwindow* windowListHead; |
Camilla Berglund | 14355d6 | 2012-11-22 17:04:44 +0100 | [diff] [blame] | 254 | _GLFWwindow* focusedWindow; |
Camilla Berglund | 830f2b4 | 2012-09-12 19:35:52 +0200 | [diff] [blame] | 255 | |
| 256 | _GLFWmonitor** monitors; |
| 257 | int monitorCount; |
Camilla Berglund | 7c426d1 | 2012-11-01 00:07:01 +0100 | [diff] [blame] | 258 | GLFWmonitorfun monitorCallback; |
Camilla Berglund | 4044c2d | 2010-10-24 18:28:55 +0200 | [diff] [blame] | 259 | |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 260 | GLFWgammaramp currentRamp; |
| 261 | GLFWgammaramp originalRamp; |
| 262 | int originalRampSize; |
Camilla Berglund | 79bef68 | 2012-05-24 11:46:51 +0200 | [diff] [blame] | 263 | GLboolean rampChanged; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 264 | |
Camilla Berglund | e9eb841 | 2010-10-14 16:40:10 +0200 | [diff] [blame] | 265 | // This is defined in the current port's platform.h |
Camilla Berglund | 21e77fe | 2012-04-22 15:53:02 +0200 | [diff] [blame] | 266 | _GLFW_PLATFORM_LIBRARY_WINDOW_STATE; |
| 267 | _GLFW_PLATFORM_LIBRARY_OPENGL_STATE; |
Camilla Berglund | 99ddce3 | 2010-10-04 18:17:53 +0200 | [diff] [blame] | 268 | }; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 269 | |
| 270 | |
Camilla Berglund | aaaac00 | 2012-08-26 20:11:32 +0200 | [diff] [blame] | 271 | //------------------------------------------------------------------------ |
| 272 | // Global state shared between compilation units of GLFW |
| 273 | // These are exported from and documented in init.c |
| 274 | //------------------------------------------------------------------------ |
Camilla Berglund | 5d52ad1 | 2012-08-26 18:42:15 +0200 | [diff] [blame] | 275 | extern GLboolean _glfwInitialized; |
Camilla Berglund | 5d52ad1 | 2012-08-26 18:42:15 +0200 | [diff] [blame] | 276 | extern _GLFWlibrary _glfwLibrary; |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 277 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 278 | |
| 279 | //======================================================================== |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 280 | // Prototypes for the platform API |
| 281 | // This is the interface exposed by the platform-specific code for each |
| 282 | // platform and is called by the shared code of the public API |
| 283 | // It mirrors the public API except it uses objects instead of handles |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 284 | //======================================================================== |
| 285 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 286 | // Platform init and version |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 287 | int _glfwPlatformInit(void); |
Camilla Berglund | 9af61d0 | 2012-12-30 01:15:48 +0100 | [diff] [blame] | 288 | void _glfwPlatformTerminate(void); |
Camilla Berglund | d6fe447 | 2010-09-13 18:05:59 +0200 | [diff] [blame] | 289 | const char* _glfwPlatformGetVersionString(void); |
Camilla Berglund | f5d74c4 | 2010-09-09 21:06:59 +0200 | [diff] [blame] | 290 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 291 | // Input mode support |
Camilla Berglund | cef9dea | 2012-06-22 13:53:02 +0200 | [diff] [blame] | 292 | void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y); |
Camilla Berglund | c1dd245 | 2012-04-06 14:37:31 +0200 | [diff] [blame] | 293 | void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 294 | |
Camilla Berglund | 830f2b4 | 2012-09-12 19:35:52 +0200 | [diff] [blame] | 295 | // Monitor support |
| 296 | _GLFWmonitor** _glfwPlatformGetMonitors(int* count); |
| 297 | void _glfwPlatformDestroyMonitor(_GLFWmonitor* monitor); |
| 298 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 299 | // Video mode support |
Camilla Berglund | 854e634 | 2012-08-03 02:57:33 +0200 | [diff] [blame] | 300 | GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count); |
Camilla Berglund | 89b42d0 | 2012-08-30 01:53:23 +0200 | [diff] [blame] | 301 | void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 302 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 303 | // Gamma ramp support |
Camilla Berglund | 85bcd1f | 2010-10-13 22:42:31 +0200 | [diff] [blame] | 304 | void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp); |
Camilla Berglund | 2630d49 | 2010-10-13 04:04:43 +0200 | [diff] [blame] | 305 | void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp); |
| 306 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 307 | // Clipboard support |
Camilla Berglund | bf1ada0 | 2012-04-09 16:00:54 +0200 | [diff] [blame] | 308 | void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string); |
Camilla Berglund | f868712 | 2012-04-12 00:51:58 +0200 | [diff] [blame] | 309 | const char* _glfwPlatformGetClipboardString(_GLFWwindow* window); |
Ralph Eastwood | 31c9154 | 2011-09-21 10:09:47 +0100 | [diff] [blame] | 310 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 311 | // Joystick input |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 312 | int _glfwPlatformGetJoystickParam(int joy, int param); |
Camilla Berglund | 2502e4d | 2012-08-29 18:31:12 +0200 | [diff] [blame] | 313 | int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numaxes); |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 314 | int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons, int numbuttons); |
Camilla Berglund | 93a1d1c | 2012-09-07 01:01:34 +0200 | [diff] [blame] | 315 | const char* _glfwPlatformGetJoystickName(int joy); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 316 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 317 | // Time input |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 318 | double _glfwPlatformGetTime(void); |
| 319 | void _glfwPlatformSetTime(double time); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 320 | |
| 321 | // Window management |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 322 | int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig); |
| 323 | void _glfwPlatformDestroyWindow(_GLFWwindow* window); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 324 | void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title); |
| 325 | void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 326 | void _glfwPlatformIconifyWindow(_GLFWwindow* window); |
| 327 | void _glfwPlatformRestoreWindow(_GLFWwindow* window); |
Riku Salminen | 596132c | 2012-08-21 21:01:57 +0300 | [diff] [blame] | 328 | void _glfwPlatformShowWindow(_GLFWwindow* window); |
| 329 | void _glfwPlatformHideWindow(_GLFWwindow* window); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 330 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 331 | // Event processing |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 332 | void _glfwPlatformPollEvents(void); |
| 333 | void _glfwPlatformWaitEvents(void); |
| 334 | |
| 335 | // OpenGL context management |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 336 | void _glfwPlatformMakeContextCurrent(_GLFWwindow* window); |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 337 | _GLFWwindow* _glfwPlatformGetCurrentContext(void); |
Camilla Berglund | 585a840 | 2012-08-06 18:13:37 +0200 | [diff] [blame] | 338 | void _glfwPlatformSwapBuffers(_GLFWwindow* window); |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 339 | void _glfwPlatformSwapInterval(int interval); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 340 | int _glfwPlatformExtensionSupported(const char* extension); |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 341 | GLFWglproc _glfwPlatformGetProcAddress(const char* procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 342 | |
| 343 | |
| 344 | //======================================================================== |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 345 | // Prototypes for the event API |
| 346 | // This is used by the platform-specific code to notify the shared code of |
| 347 | // events that can be translated into state changes and/or callback calls, |
| 348 | // instead of directly calling callbacks or modifying shared state |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 349 | //======================================================================== |
| 350 | |
Camilla Berglund | b016d64 | 2012-01-31 15:27:15 +0100 | [diff] [blame] | 351 | // Window event notification (window.c) |
Camilla Berglund | 14355d6 | 2012-11-22 17:04:44 +0100 | [diff] [blame] | 352 | void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused); |
Camilla Berglund | d0840bd | 2011-10-09 17:10:40 +0200 | [diff] [blame] | 353 | void _glfwInputWindowPos(_GLFWwindow* window, int x, int y); |
| 354 | void _glfwInputWindowSize(_GLFWwindow* window, int width, int height); |
| 355 | void _glfwInputWindowIconify(_GLFWwindow* window, int iconified); |
Camilla Berglund | 8bb5c59 | 2012-08-21 21:18:09 +0200 | [diff] [blame] | 356 | void _glfwInputWindowVisibility(_GLFWwindow* window, int visible); |
Camilla Berglund | 72ef537 | 2011-10-09 21:12:13 +0200 | [diff] [blame] | 357 | void _glfwInputWindowDamage(_GLFWwindow* window); |
Camilla Berglund | 2410e2a | 2012-08-10 13:31:15 +0200 | [diff] [blame] | 358 | void _glfwInputWindowCloseRequest(_GLFWwindow* window); |
Camilla Berglund | d0840bd | 2011-10-09 17:10:40 +0200 | [diff] [blame] | 359 | |
Camilla Berglund | b016d64 | 2012-01-31 15:27:15 +0100 | [diff] [blame] | 360 | // Input event notification (input.c) |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 361 | void _glfwInputKey(_GLFWwindow* window, int key, int action); |
Camilla Berglund | 93ea341 | 2010-09-09 19:33:37 +0200 | [diff] [blame] | 362 | void _glfwInputChar(_GLFWwindow* window, int character); |
Camilla Berglund | 4ef9aec | 2012-03-28 21:54:09 +0200 | [diff] [blame] | 363 | void _glfwInputScroll(_GLFWwindow* window, double x, double y); |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 364 | void _glfwInputMouseClick(_GLFWwindow* window, int button, int action); |
Camilla Berglund | d0840bd | 2011-10-09 17:10:40 +0200 | [diff] [blame] | 365 | void _glfwInputCursorMotion(_GLFWwindow* window, int x, int y); |
Camilla Berglund | c4806b9 | 2012-01-30 22:59:38 +0100 | [diff] [blame] | 366 | void _glfwInputCursorEnter(_GLFWwindow* window, int entered); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 367 | |
Camilla Berglund | 830f2b4 | 2012-09-12 19:35:52 +0200 | [diff] [blame] | 368 | // Monitor event notification (monitor.c) |
| 369 | void _glfwInputMonitorChange(void); |
| 370 | |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 371 | |
| 372 | //======================================================================== |
| 373 | // Prototypes for internal utility functions |
| 374 | // These functions are shared code and may be used by any part of GLFW |
| 375 | // Each platform may add its own utility functions, but those may only be |
| 376 | // called by the platform-specific code |
| 377 | //======================================================================== |
| 378 | |
| 379 | // Fullscren management (fullscreen.c) |
Camilla Berglund | cf42282 | 2012-12-31 03:04:04 +0100 | [diff] [blame] | 380 | const GLFWvidmode* _glfwChooseVideoMode(const GLFWvidmode* desired, |
| 381 | const GLFWvidmode* alternatives, |
| 382 | unsigned int count); |
Camilla Berglund | 2a8b2cc | 2012-08-27 03:25:58 +0200 | [diff] [blame] | 383 | int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second); |
| 384 | void _glfwSplitBPP(int bpp, int* red, int* green, int* blue); |
| 385 | |
| 386 | // Error handling (init.c) |
| 387 | void _glfwSetError(int error, const char* format, ...); |
| 388 | |
Camilla Berglund | 596f56f | 2011-03-07 13:56:28 +0100 | [diff] [blame] | 389 | // OpenGL context helpers (opengl.c) |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 390 | int _glfwStringInExtensionString(const char* string, const GLubyte* extensions); |
Camilla Berglund | d46b222 | 2010-09-08 17:30:21 +0200 | [diff] [blame] | 391 | const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, |
| 392 | const _GLFWfbconfig* alternatives, |
| 393 | unsigned int count); |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 394 | GLboolean _glfwRefreshContextParams(void); |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 395 | GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig); |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 396 | GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 397 | |
Marcel Metz | 6f970f5 | 2012-01-30 12:04:16 +0100 | [diff] [blame] | 398 | // Monitor management (monitor.c) |
Camilla Berglund | 830f2b4 | 2012-09-12 19:35:52 +0200 | [diff] [blame] | 399 | _GLFWmonitor* _glfwCreateMonitor(const char* name, |
Camilla Berglund | 20a49a7 | 2012-09-13 17:46:40 +0200 | [diff] [blame] | 400 | GLboolean primary, |
Camilla Berglund | 830f2b4 | 2012-09-12 19:35:52 +0200 | [diff] [blame] | 401 | int physicalWidth, int physicalHeight, |
Camilla Berglund | 2108360 | 2012-10-22 02:39:22 +0200 | [diff] [blame] | 402 | int x, int y); |
Camilla Berglund | 830f2b4 | 2012-09-12 19:35:52 +0200 | [diff] [blame] | 403 | void _glfwDestroyMonitor(_GLFWmonitor* monitor); |
| 404 | void _glfwDestroyMonitors(void); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 405 | |
| 406 | #endif // _internal_h_ |