mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04: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 files
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.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
|
#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
|
// GLFW platform specific types
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -272,71 +277,13 @@ typedef INT_PTR GLFWintptr;
|
|||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Window structure
|
// Platform-specific OpenGL context structure
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
typedef struct _GLFWwin_struct _GLFWwin;
|
typedef struct _GLFWcontextWGL
|
||||||
|
{
|
||||||
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 ======================================
|
|
||||||
|
|
||||||
// Platform specific window resources
|
// Platform specific window resources
|
||||||
HDC DC; // Private GDI device context
|
HDC DC; // Private GDI device context
|
||||||
HGLRC context; // Permanent rendering 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)
|
// Platform specific extensions (context specific)
|
||||||
WGLSWAPINTERVALEXT_T SwapIntervalEXT;
|
WGLSWAPINTERVALEXT_T SwapIntervalEXT;
|
||||||
@ -348,59 +295,39 @@ struct _GLFWwin_struct {
|
|||||||
GLboolean has_WGL_ARB_multisample;
|
GLboolean has_WGL_ARB_multisample;
|
||||||
GLboolean has_WGL_ARB_pixel_format;
|
GLboolean has_WGL_ARB_pixel_format;
|
||||||
GLboolean has_WGL_ARB_create_context;
|
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
|
// Various platform specific internal variables
|
||||||
int oldMouseLock; // Old mouse-lock flag (used for remembering
|
int oldMouseLock; // Old mouse-lock flag (used for remembering
|
||||||
// mouse-lock state when iconifying)
|
// mouse-lock state when iconifying)
|
||||||
int oldMouseLockValid;
|
int oldMouseLockValid;
|
||||||
int desiredRefreshRate; // Desired vertical monitor refresh rate
|
int desiredRefreshRate; // Desired vertical monitor refresh rate
|
||||||
|
int mouseMoved;
|
||||||
};
|
int oldMouseX, oldMouseY;
|
||||||
|
} _GLFWwindowWin32;
|
||||||
GLFWGLOBAL _GLFWwin _glfwWin;
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// User input status (most of this should go in _GLFWwin)
|
// Platform-specific library global data
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
GLFWGLOBAL struct {
|
typedef struct _GLFWlibraryWin32
|
||||||
|
{
|
||||||
// ========= PLATFORM INDEPENDENT MANDATORY PART =========================
|
// Instance of the application
|
||||||
|
HINSTANCE instance;
|
||||||
// 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
|
|
||||||
|
|
||||||
// Timer data
|
// Timer data
|
||||||
struct {
|
struct {
|
||||||
@ -408,14 +335,14 @@ GLFWGLOBAL struct {
|
|||||||
double Resolution;
|
double Resolution;
|
||||||
unsigned int t0_32;
|
unsigned int t0_32;
|
||||||
__int64 t0_64;
|
__int64 t0_64;
|
||||||
} Timer;
|
} timer;
|
||||||
|
|
||||||
// System information
|
// System information
|
||||||
struct {
|
struct {
|
||||||
int winVer;
|
int winVer;
|
||||||
int hasUnicode;
|
int hasUnicode;
|
||||||
DWORD foregroundLockTimeout;
|
DWORD foregroundLockTimeout;
|
||||||
} Sys;
|
} sys;
|
||||||
|
|
||||||
#if !defined(_GLFW_NO_DLOAD_WINMM) || !defined(_GLFW_NO_DLOAD_GDI32)
|
#if !defined(_GLFW_NO_DLOAD_WINMM) || !defined(_GLFW_NO_DLOAD_GDI32)
|
||||||
// Library handles and function pointers
|
// Library handles and function pointers
|
||||||
@ -438,10 +365,10 @@ GLFWGLOBAL struct {
|
|||||||
JOYGETPOSEX_T joyGetPosEx;
|
JOYGETPOSEX_T joyGetPosEx;
|
||||||
TIMEGETTIME_T timeGetTime;
|
TIMEGETTIME_T timeGetTime;
|
||||||
#endif // _GLFW_NO_DLOAD_WINMM
|
#endif // _GLFW_NO_DLOAD_WINMM
|
||||||
} Libs;
|
} libs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} _glfwLibrary;
|
} _GLFWlibraryWin32;
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user