00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _glfw3_internal_h_
00029 #define _glfw3_internal_h_
00030
00031
00032 #if defined(_GLFW_USE_CONFIG_H)
00033 #include "glfw_config.h"
00034 #endif
00035
00036 #define _GLFW_VERSION_NUMBER "3.1.2"
00037
00038 #if defined(GLFW_INCLUDE_GLCOREARB) || \
00039 defined(GLFW_INCLUDE_ES1) || \
00040 defined(GLFW_INCLUDE_ES2) || \
00041 defined(GLFW_INCLUDE_ES3) || \
00042 defined(GLFW_INCLUDE_NONE) || \
00043 defined(GLFW_INCLUDE_GLEXT) || \
00044 defined(GLFW_INCLUDE_GLU) || \
00045 defined(GLFW_DLL)
00046 #error "You may not define any header option macros when compiling GLFW"
00047 #endif
00048
00049 #if defined(_GLFW_USE_OPENGL)
00050
00051 #elif defined(_GLFW_USE_GLESV1)
00052 #define GLFW_INCLUDE_ES1
00053 #elif defined(_GLFW_USE_GLESV2)
00054 #define GLFW_INCLUDE_ES2
00055 #else
00056 #error "No supported client library selected"
00057 #endif
00058
00059
00060
00061 #define GL_GLEXT_LEGACY
00062
00063 #include "../include/GLFW/glfw3.h"
00064
00065 #if defined(_GLFW_USE_OPENGL)
00066
00067
00068
00069 #include "../deps/GL/glext.h"
00070 #endif
00071
00072 typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield);
00073 typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum);
00074 typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
00075
00076 typedef struct _GLFWwndconfig _GLFWwndconfig;
00077 typedef struct _GLFWctxconfig _GLFWctxconfig;
00078 typedef struct _GLFWfbconfig _GLFWfbconfig;
00079 typedef struct _GLFWwindow _GLFWwindow;
00080 typedef struct _GLFWlibrary _GLFWlibrary;
00081 typedef struct _GLFWmonitor _GLFWmonitor;
00082 typedef struct _GLFWcursor _GLFWcursor;
00083
00084 #if defined(_GLFW_COCOA)
00085 #include "cocoa_platform.h"
00086 #elif defined(_GLFW_WIN32)
00087 #include "win32_platform.h"
00088 #elif defined(_GLFW_X11)
00089 #include "x11_platform.h"
00090 #elif defined(_GLFW_WAYLAND)
00091 #include "wl_platform.h"
00092 #elif defined(_GLFW_MIR)
00093 #include "mir_platform.h"
00094 #else
00095 #error "No supported window creation API selected"
00096 #endif
00097
00098
00099
00100
00101
00102
00126
00127
00128
00129
00130
00131 #define _GLFW_REQUIRE_INIT() \
00132 if (!_glfwInitialized) \
00133 { \
00134 _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
00135 return; \
00136 }
00137 #define _GLFW_REQUIRE_INIT_OR_RETURN(x) \
00138 if (!_glfwInitialized) \
00139 { \
00140 _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
00141 return x; \
00142 }
00143
00144
00145 #define _GLFW_SWAP_POINTERS(x, y) \
00146 { \
00147 void* t; \
00148 t = x; \
00149 x = y; \
00150 y = t; \
00151 }
00152
00153
00154
00155
00156
00157
00164 struct _GLFWwndconfig
00165 {
00166 int width;
00167 int height;
00168 const char* title;
00169 GLboolean resizable;
00170 GLboolean visible;
00171 GLboolean decorated;
00172 GLboolean focused;
00173 GLboolean autoIconify;
00174 GLboolean floating;
00175 _GLFWmonitor* monitor;
00176 };
00177
00178
00185 struct _GLFWctxconfig
00186 {
00187 int api;
00188 int major;
00189 int minor;
00190 GLboolean forward;
00191 GLboolean debug;
00192 int profile;
00193 int robustness;
00194 int release;
00195 _GLFWwindow* share;
00196 };
00197
00198
00207 struct _GLFWfbconfig
00208 {
00209 int redBits;
00210 int greenBits;
00211 int blueBits;
00212 int alphaBits;
00213 int depthBits;
00214 int stencilBits;
00215 int accumRedBits;
00216 int accumGreenBits;
00217 int accumBlueBits;
00218 int accumAlphaBits;
00219 int auxBuffers;
00220 int stereo;
00221 int samples;
00222 int sRGB;
00223 int doublebuffer;
00224
00225
00226 _GLFW_PLATFORM_FBCONFIG;
00227 };
00228
00229
00232 struct _GLFWwindow
00233 {
00234 struct _GLFWwindow* next;
00235
00236
00237 GLboolean resizable;
00238 GLboolean decorated;
00239 GLboolean autoIconify;
00240 GLboolean floating;
00241 GLboolean closed;
00242 void* userPointer;
00243 GLFWvidmode videoMode;
00244 _GLFWmonitor* monitor;
00245 _GLFWcursor* cursor;
00246
00247
00248 GLboolean stickyKeys;
00249 GLboolean stickyMouseButtons;
00250 double cursorPosX, cursorPosY;
00251 int cursorMode;
00252 char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
00253 char keys[GLFW_KEY_LAST + 1];
00254
00255
00256 struct {
00257 int api;
00258 int major, minor, revision;
00259 GLboolean forward, debug;
00260 int profile;
00261 int robustness;
00262 int release;
00263 } context;
00264
00265 #if defined(_GLFW_USE_OPENGL)
00266 PFNGLGETSTRINGIPROC GetStringi;
00267 #endif
00268 PFNGLGETINTEGERVPROC GetIntegerv;
00269 PFNGLGETSTRINGPROC GetString;
00270 PFNGLCLEARPROC Clear;
00271
00272 struct {
00273 GLFWwindowposfun pos;
00274 GLFWwindowsizefun size;
00275 GLFWwindowclosefun close;
00276 GLFWwindowrefreshfun refresh;
00277 GLFWwindowfocusfun focus;
00278 GLFWwindowiconifyfun iconify;
00279 GLFWframebuffersizefun fbsize;
00280 GLFWmousebuttonfun mouseButton;
00281 GLFWcursorposfun cursorPos;
00282 GLFWcursorenterfun cursorEnter;
00283 GLFWscrollfun scroll;
00284 GLFWkeyfun key;
00285 GLFWcharfun character;
00286 GLFWcharmodsfun charmods;
00287 GLFWdropfun drop;
00288 } callbacks;
00289
00290
00291 _GLFW_PLATFORM_WINDOW_STATE;
00292
00293 _GLFW_PLATFORM_CONTEXT_STATE;
00294 };
00295
00296
00299 struct _GLFWmonitor
00300 {
00301 char* name;
00302
00303
00304 int widthMM, heightMM;
00305
00306 GLFWvidmode* modes;
00307 int modeCount;
00308 GLFWvidmode currentMode;
00309
00310 GLFWgammaramp originalRamp;
00311 GLFWgammaramp currentRamp;
00312
00313
00314 _GLFW_PLATFORM_MONITOR_STATE;
00315 };
00316
00317
00320 struct _GLFWcursor
00321 {
00322 _GLFWcursor* next;
00323
00324
00325 _GLFW_PLATFORM_CURSOR_STATE;
00326 };
00327
00330 struct _GLFWlibrary
00331 {
00332 struct {
00333 _GLFWfbconfig framebuffer;
00334 _GLFWwndconfig window;
00335 _GLFWctxconfig context;
00336 int refreshRate;
00337 } hints;
00338
00339 double cursorPosX, cursorPosY;
00340
00341 _GLFWcursor* cursorListHead;
00342
00343 _GLFWwindow* windowListHead;
00344 _GLFWwindow* cursorWindow;
00345
00346 _GLFWmonitor** monitors;
00347 int monitorCount;
00348
00349 struct {
00350 GLFWmonitorfun monitor;
00351 } callbacks;
00352
00353
00354 _GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
00355
00356 _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE;
00357
00358 _GLFW_PLATFORM_LIBRARY_TIME_STATE;
00359
00360 _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE;
00361
00362 _GLFW_PLATFORM_LIBRARY_TLS_STATE;
00363 };
00364
00365
00366
00367
00368
00369
00372 extern GLboolean _glfwInitialized;
00373
00378 extern _GLFWlibrary _glfw;
00379
00380
00381
00382
00383
00384
00389 int _glfwPlatformInit(void);
00390
00394 void _glfwPlatformTerminate(void);
00395
00403 const char* _glfwPlatformGetVersionString(void);
00404
00408 void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos);
00409
00413 void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
00414
00419 void _glfwPlatformApplyCursorMode(_GLFWwindow* window);
00420
00424 _GLFWmonitor** _glfwPlatformGetMonitors(int* count);
00425
00434 GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second);
00435
00439 void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos);
00440
00444 GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count);
00445
00448 void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
00449
00453 void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
00454
00458 void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
00459
00463 void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string);
00464
00471 const char* _glfwPlatformGetClipboardString(_GLFWwindow* window);
00472
00476 int _glfwPlatformJoystickPresent(int joy);
00477
00481 const float* _glfwPlatformGetJoystickAxes(int joy, int* count);
00482
00486 const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count);
00487
00491 const char* _glfwPlatformGetJoystickName(int joy);
00492
00496 double _glfwPlatformGetTime(void);
00497
00501 void _glfwPlatformSetTime(double time);
00502
00505 int _glfwPlatformCreateWindow(_GLFWwindow* window,
00506 const _GLFWwndconfig* wndconfig,
00507 const _GLFWctxconfig* ctxconfig,
00508 const _GLFWfbconfig* fbconfig);
00509
00512 void _glfwPlatformDestroyWindow(_GLFWwindow* window);
00513
00517 void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
00518
00522 void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos);
00523
00527 void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos);
00528
00532 void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height);
00533
00537 void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
00538
00542 void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height);
00543
00547 void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
00548
00552 void _glfwPlatformIconifyWindow(_GLFWwindow* window);
00553
00557 void _glfwPlatformRestoreWindow(_GLFWwindow* window);
00558
00562 void _glfwPlatformShowWindow(_GLFWwindow* window);
00563
00566 void _glfwPlatformUnhideWindow(_GLFWwindow* window);
00567
00571 void _glfwPlatformHideWindow(_GLFWwindow* window);
00572
00576 int _glfwPlatformWindowFocused(_GLFWwindow* window);
00577
00581 int _glfwPlatformWindowIconified(_GLFWwindow* window);
00582
00586 int _glfwPlatformWindowVisible(_GLFWwindow* window);
00587
00591 void _glfwPlatformPollEvents(void);
00592
00596 void _glfwPlatformWaitEvents(void);
00597
00601 void _glfwPlatformPostEmptyEvent(void);
00602
00606 void _glfwPlatformMakeContextCurrent(_GLFWwindow* window);
00607
00611 _GLFWwindow* _glfwPlatformGetCurrentContext(void);
00612
00616 void _glfwPlatformSwapBuffers(_GLFWwindow* window);
00617
00621 void _glfwPlatformSwapInterval(int interval);
00622
00626 int _glfwPlatformExtensionSupported(const char* extension);
00627
00631 GLFWglproc _glfwPlatformGetProcAddress(const char* procname);
00632
00636 int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
00637
00641 int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape);
00642
00646 void _glfwPlatformDestroyCursor(_GLFWcursor* cursor);
00647
00651 void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
00652
00653
00654
00655
00656
00657
00664 void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused);
00665
00672 void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos);
00673
00680 void _glfwInputWindowSize(_GLFWwindow* window, int width, int height);
00681
00688 void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height);
00689
00696 void _glfwInputWindowIconify(_GLFWwindow* window, int iconified);
00697
00701 void _glfwInputWindowDamage(_GLFWwindow* window);
00702
00707 void _glfwInputWindowCloseRequest(_GLFWwindow* window);
00708
00717 void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods);
00718
00727 void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, int plain);
00728
00735 void _glfwInputScroll(_GLFWwindow* window, double x, double y);
00736
00743 void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
00744
00753 void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y);
00754
00761 void _glfwInputCursorEnter(_GLFWwindow* window, int entered);
00762
00765 void _glfwInputMonitorChange(void);
00766
00773 void _glfwInputError(int error, const char* format, ...);
00774
00781 void _glfwInputDrop(_GLFWwindow* window, int count, const char** names);
00782
00783
00784
00785
00786
00787
00790 const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
00791 const GLFWvidmode* desired);
00792
00796 int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second);
00797
00801 void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
00802
00809 int _glfwStringInExtensionString(const char* string, const char* extensions);
00810
00819 const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
00820 const _GLFWfbconfig* alternatives,
00821 unsigned int count);
00822
00828 GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig);
00829
00840 GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig);
00841
00849 GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig);
00850
00853 void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
00854
00857 void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
00858
00867 _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM);
00868
00872 void _glfwFreeMonitor(_GLFWmonitor* monitor);
00873
00876 void _glfwFreeMonitors(_GLFWmonitor** monitors, int count);
00877
00878 #endif // _glfw3_internal_h_