mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Begun adaptation of Win32 port to new API.
This commit is contained in:
parent
4cbe749932
commit
cf2df6e478
@ -43,7 +43,7 @@
|
||||
// Include files
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include "../../include/GL/glfw.h"
|
||||
#include "../../include/GL/glfw3.h"
|
||||
|
||||
|
||||
//========================================================================
|
||||
@ -261,6 +261,11 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void);
|
||||
#endif // _GLFW_NO_DLOAD_WINMM
|
||||
|
||||
|
||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 Win32
|
||||
#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryWin32 Win32
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL WGL
|
||||
|
||||
|
||||
//========================================================================
|
||||
// GLFW platform specific types
|
||||
//========================================================================
|
||||
@ -272,71 +277,13 @@ typedef INT_PTR GLFWintptr;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Window structure
|
||||
// Platform-specific OpenGL context structure
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWwin_struct _GLFWwin;
|
||||
|
||||
struct _GLFWwin_struct {
|
||||
|
||||
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
|
||||
|
||||
// User callback functions
|
||||
GLFWwindowsizefun windowSizeCallback;
|
||||
GLFWwindowclosefun windowCloseCallback;
|
||||
GLFWwindowrefreshfun windowRefreshCallback;
|
||||
GLFWmousebuttonfun mouseButtonCallback;
|
||||
GLFWmouseposfun mousePosCallback;
|
||||
GLFWmousewheelfun mouseWheelCallback;
|
||||
GLFWkeyfun keyCallback;
|
||||
GLFWcharfun charCallback;
|
||||
|
||||
// User selected window settings
|
||||
int fullscreen; // Fullscreen flag
|
||||
int mouseLock; // Mouse-lock flag
|
||||
int sysKeysDisabled; // System keys disabled flag
|
||||
int windowNoResize; // Resize- and maximize gadgets disabled flag
|
||||
int refreshRate; // Vertical monitor refresh rate
|
||||
|
||||
// Window status & parameters
|
||||
int opened; // Flag telling if window is opened or not
|
||||
int active; // Application active flag
|
||||
int iconified; // Window iconified flag
|
||||
int width, height; // Window width and heigth
|
||||
int accelerated; // GL_TRUE if window is HW accelerated
|
||||
|
||||
// Framebuffer attributes
|
||||
int redBits;
|
||||
int greenBits;
|
||||
int blueBits;
|
||||
int alphaBits;
|
||||
int depthBits;
|
||||
int stencilBits;
|
||||
int accumRedBits;
|
||||
int accumGreenBits;
|
||||
int accumBlueBits;
|
||||
int accumAlphaBits;
|
||||
int auxBuffers;
|
||||
int stereo;
|
||||
int samples;
|
||||
|
||||
// OpenGL extensions and context attributes
|
||||
int glMajor, glMinor, glRevision;
|
||||
int glForward, glDebug, glProfile;
|
||||
|
||||
PFNGLGETSTRINGIPROC GetStringi;
|
||||
|
||||
|
||||
// ========= PLATFORM SPECIFIC PART ======================================
|
||||
|
||||
typedef struct _GLFWcontextWGL
|
||||
{
|
||||
// Platform specific window resources
|
||||
HDC DC; // Private GDI device context
|
||||
HGLRC context; // Permanent rendering context
|
||||
HWND window; // Window handle
|
||||
ATOM classAtom; // Window class atom
|
||||
int modeID; // Mode ID for fullscreen mode
|
||||
HHOOK keyboardHook; // Keyboard hook handle
|
||||
DWORD dwStyle; // Window styles used for window creation
|
||||
DWORD dwExStyle; // --"--
|
||||
|
||||
// Platform specific extensions (context specific)
|
||||
WGLSWAPINTERVALEXT_T SwapIntervalEXT;
|
||||
@ -348,59 +295,39 @@ struct _GLFWwin_struct {
|
||||
GLboolean has_WGL_ARB_multisample;
|
||||
GLboolean has_WGL_ARB_pixel_format;
|
||||
GLboolean has_WGL_ARB_create_context;
|
||||
} _GLFWcontextWGL;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific window structure
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWwindowWin32
|
||||
{
|
||||
// Platform specific window resources
|
||||
HWND handle; // Window handle
|
||||
ATOM classAtom; // Window class atom
|
||||
int modeID; // Mode ID for fullscreen mode
|
||||
HHOOK keyboardHook; // Keyboard hook handle
|
||||
DWORD dwStyle; // Window styles used for window creation
|
||||
DWORD dwExStyle; // --"--
|
||||
|
||||
// Various platform specific internal variables
|
||||
int oldMouseLock; // Old mouse-lock flag (used for remembering
|
||||
// mouse-lock state when iconifying)
|
||||
int oldMouseLockValid;
|
||||
int desiredRefreshRate; // Desired vertical monitor refresh rate
|
||||
|
||||
};
|
||||
|
||||
GLFWGLOBAL _GLFWwin _glfwWin;
|
||||
int mouseMoved;
|
||||
int oldMouseX, oldMouseY;
|
||||
} _GLFWwindowWin32;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// User input status (most of this should go in _GLFWwin)
|
||||
// Platform-specific library global data
|
||||
//------------------------------------------------------------------------
|
||||
GLFWGLOBAL struct {
|
||||
|
||||
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
|
||||
|
||||
// Mouse status
|
||||
int MousePosX, MousePosY;
|
||||
int WheelPos;
|
||||
char MouseButton[ GLFW_MOUSE_BUTTON_LAST+1 ];
|
||||
|
||||
// Keyboard status
|
||||
char Key[ GLFW_KEY_LAST+1 ];
|
||||
int LastChar;
|
||||
|
||||
// User selected settings
|
||||
int StickyKeys;
|
||||
int StickyMouseButtons;
|
||||
int KeyRepeat;
|
||||
|
||||
|
||||
// ========= PLATFORM SPECIFIC PART ======================================
|
||||
|
||||
// Platform specific internal variables
|
||||
int MouseMoved, OldMouseX, OldMouseY;
|
||||
|
||||
} _glfwInput;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Library global data
|
||||
//------------------------------------------------------------------------
|
||||
GLFWGLOBAL struct {
|
||||
|
||||
// Window opening hints
|
||||
_GLFWhints hints;
|
||||
|
||||
// ========= PLATFORM SPECIFIC PART ======================================
|
||||
|
||||
HINSTANCE instance; // Instance of the application
|
||||
typedef struct _GLFWlibraryWin32
|
||||
{
|
||||
// Instance of the application
|
||||
HINSTANCE instance;
|
||||
|
||||
// Timer data
|
||||
struct {
|
||||
@ -408,14 +335,14 @@ GLFWGLOBAL struct {
|
||||
double Resolution;
|
||||
unsigned int t0_32;
|
||||
__int64 t0_64;
|
||||
} Timer;
|
||||
} timer;
|
||||
|
||||
// System information
|
||||
struct {
|
||||
int winVer;
|
||||
int hasUnicode;
|
||||
DWORD foregroundLockTimeout;
|
||||
} Sys;
|
||||
} sys;
|
||||
|
||||
#if !defined(_GLFW_NO_DLOAD_WINMM) || !defined(_GLFW_NO_DLOAD_GDI32)
|
||||
// Library handles and function pointers
|
||||
@ -438,10 +365,10 @@ GLFWGLOBAL struct {
|
||||
JOYGETPOSEX_T joyGetPosEx;
|
||||
TIMEGETTIME_T timeGetTime;
|
||||
#endif // _GLFW_NO_DLOAD_WINMM
|
||||
} Libs;
|
||||
} libs;
|
||||
#endif
|
||||
|
||||
} _glfwLibrary;
|
||||
} _GLFWlibraryWin32;
|
||||
|
||||
|
||||
//========================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user