mirror of
https://github.com/Relintai/sfw.git
synced 2025-01-03 05:09:36 +01:00
Fixes for windows.
This commit is contained in:
parent
febe2396f1
commit
2afdc35935
@ -5752,6 +5752,30 @@ GLFWAPI int glfwVulkanSupported(void);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
|
GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
|
||||||
|
|
||||||
|
/*! @brief Returns the `HWND` of the specified window as a void*, only works on windows
|
||||||
|
*
|
||||||
|
* @return The `HWND` of the specified window, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||||
|
*
|
||||||
|
* @remark The `HDC` associated with the window can be queried with the
|
||||||
|
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
||||||
|
* function.
|
||||||
|
* @code
|
||||||
|
* HDC dc = GetDC(glfwGetWin32WindowAsVPTR(window));
|
||||||
|
* @endcode
|
||||||
|
* This DC is private and does not need to be released.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI void *glfwGetWin32WindowAsVPTR(GLFWwindow* window);
|
||||||
|
|
||||||
#if defined(VK_VERSION_1_0)
|
#if defined(VK_VERSION_1_0)
|
||||||
|
|
||||||
/*! @brief Returns the address of the specified Vulkan instance function.
|
/*! @brief Returns the address of the specified Vulkan instance function.
|
||||||
@ -10984,7 +11008,7 @@ inline void __glfw_ptr_swap_tmpl(T &x, T &y) {
|
|||||||
x = y; \
|
x = y; \
|
||||||
y = t; \
|
y = t; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Per-thread error structure
|
// Per-thread error structure
|
||||||
@ -17045,6 +17069,18 @@ const char* _glfwGetVulkanResultString(VkResult result)
|
|||||||
////// GLFW public API //////
|
////// GLFW public API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
GLFWAPI void *glfwGetWin32WindowAsVPTR(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
#if defined(_WIN64) || defined(_WIN32)
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return window->win32.handle;
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
GLFWAPI int glfwVulkanSupported(void)
|
GLFWAPI int glfwVulkanSupported(void)
|
||||||
{
|
{
|
||||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||||
|
@ -90,13 +90,11 @@
|
|||||||
|
|
||||||
// GLFW
|
// GLFW
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN64) || defined(_WIN32)
|
||||||
#undef APIENTRY
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#ifndef GLFW_EXPOSE_NATIVE_WIN32
|
#include <windows.h>
|
||||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
|
||||||
#endif
|
|
||||||
//#include <GLFW/glfw3native.h> // for glfwGetWin32Window()
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#ifndef GLFW_EXPOSE_NATIVE_COCOA
|
#ifndef GLFW_EXPOSE_NATIVE_COCOA
|
||||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||||
@ -627,7 +625,7 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
|||||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||||
main_viewport->PlatformHandle = (void*)bd->Window;
|
main_viewport->PlatformHandle = (void*)bd->Window;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
main_viewport->PlatformHandleRaw = glfwGetWin32Window(bd->Window);
|
main_viewport->PlatformHandleRaw = glfwGetWin32WindowAsVPTR(bd->Window);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
main_viewport->PlatformHandleRaw = (void*)glfwGetCocoaWindow(bd->Window);
|
main_viewport->PlatformHandleRaw = (void*)glfwGetCocoaWindow(bd->Window);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user