mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Win32: Make timer functions backend independent
This is work towards allowing the Null backend to build for Windows using the Win32 timer API, without the Win32 backend being enabled.
This commit is contained in:
parent
b6834bf2a1
commit
bdfe6b09af
@ -22,10 +22,11 @@ if (_GLFW_COCOA)
|
|||||||
nsgl_context.m egl_context.c osmesa_context.c)
|
nsgl_context.m egl_context.c osmesa_context.c)
|
||||||
elseif (_GLFW_WIN32)
|
elseif (_GLFW_WIN32)
|
||||||
target_compile_definitions(glfw PRIVATE _GLFW_WIN32)
|
target_compile_definitions(glfw PRIVATE _GLFW_WIN32)
|
||||||
target_sources(glfw PRIVATE win32_platform.h win32_joystick.h win32_thread.h
|
target_sources(glfw PRIVATE win32_platform.h win32_joystick.h win32_time.h
|
||||||
win32_init.c win32_joystick.c win32_monitor.c
|
win32_thread.h win32_init.c win32_joystick.c
|
||||||
win32_time.c win32_thread.c win32_window.c
|
win32_monitor.c win32_time.c win32_thread.c
|
||||||
wgl_context.c egl_context.c osmesa_context.c)
|
win32_window.c wgl_context.c egl_context.c
|
||||||
|
osmesa_context.c)
|
||||||
elseif (_GLFW_X11)
|
elseif (_GLFW_X11)
|
||||||
target_compile_definitions(glfw PRIVATE _GLFW_X11)
|
target_compile_definitions(glfw PRIVATE _GLFW_X11)
|
||||||
target_sources(glfw PRIVATE x11_platform.h xkb_unicode.h posix_time.h
|
target_sources(glfw PRIVATE x11_platform.h xkb_unicode.h posix_time.h
|
||||||
|
@ -352,6 +352,7 @@ typedef struct VkWin32SurfaceCreateInfoKHR
|
|||||||
typedef VkResult (APIENTRY *PFN_vkCreateWin32SurfaceKHR)(VkInstance,const VkWin32SurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
typedef VkResult (APIENTRY *PFN_vkCreateWin32SurfaceKHR)(VkInstance,const VkWin32SurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
||||||
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice,uint32_t);
|
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice,uint32_t);
|
||||||
|
|
||||||
|
#include "win32_time.h"
|
||||||
#include "win32_thread.h"
|
#include "win32_thread.h"
|
||||||
#include "win32_joystick.h"
|
#include "win32_joystick.h"
|
||||||
|
|
||||||
@ -361,7 +362,6 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(
|
|||||||
|
|
||||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32
|
||||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32
|
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32
|
||||||
#define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32
|
|
||||||
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32
|
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32
|
||||||
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32
|
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32
|
||||||
|
|
||||||
@ -518,13 +518,6 @@ typedef struct _GLFWcursorWin32
|
|||||||
HCURSOR handle;
|
HCURSOR handle;
|
||||||
} _GLFWcursorWin32;
|
} _GLFWcursorWin32;
|
||||||
|
|
||||||
// Win32-specific global timer data
|
|
||||||
//
|
|
||||||
typedef struct _GLFWtimerWin32
|
|
||||||
{
|
|
||||||
uint64_t frequency;
|
|
||||||
} _GLFWtimerWin32;
|
|
||||||
|
|
||||||
|
|
||||||
GLFWbool _glfwRegisterWindowClassWin32(void);
|
GLFWbool _glfwRegisterWindowClassWin32(void);
|
||||||
void _glfwUnregisterWindowClassWin32(void);
|
void _glfwUnregisterWindowClassWin32(void);
|
||||||
|
38
src/win32_time.h
Normal file
38
src/win32_time.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 Win32 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied
|
||||||
|
// warranty. In no event will the authors be held liable for any damages
|
||||||
|
// arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it
|
||||||
|
// freely, subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented; you must not
|
||||||
|
// claim that you wrote the original software. If you use this software
|
||||||
|
// in a product, an acknowledgment in the product documentation would
|
||||||
|
// be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such, and must not
|
||||||
|
// be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32
|
||||||
|
|
||||||
|
// Win32-specific global timer data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWtimerWin32
|
||||||
|
{
|
||||||
|
uint64_t frequency;
|
||||||
|
} _GLFWtimerWin32;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user