Cleanup.
This commit is contained in:
parent
d1093eace8
commit
cc6649db0d
@ -12,6 +12,7 @@
|
|||||||
#endif // BX_PLATFORM_WINDOWS
|
#endif // BX_PLATFORM_WINDOWS
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
#include <SDL2/SDL_syswm.h>
|
||||||
#include <bgfxplatform.h>
|
#include <bgfxplatform.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -161,12 +161,10 @@ namespace bgfx
|
|||||||
|
|
||||||
#endif // BX_PLATFORM_
|
#endif // BX_PLATFORM_
|
||||||
|
|
||||||
#if defined(_SDL_H)
|
#if defined(_SDL_syswm_h)
|
||||||
// If SDL.h is included before bgfxplatform.h we can enable SDL window
|
// If SDL_syswm.h is included before bgfxplatform.h we can enable SDL window
|
||||||
// interop convenience code.
|
// interop convenience code.
|
||||||
|
|
||||||
# include <SDL2/SDL_syswm.h>
|
|
||||||
|
|
||||||
namespace bgfx
|
namespace bgfx
|
||||||
{
|
{
|
||||||
///
|
///
|
||||||
@ -179,13 +177,20 @@ namespace bgfx
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlatformData pd;
|
||||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
||||||
x11SetDisplayWindow(wmi.info.x11.display, wmi.info.x11.window);
|
pd.ndt = wmi.info.x11.display;
|
||||||
|
pd.nwh = (void*)(uintptr_t)wmi.info.x11.window;
|
||||||
# elif BX_PLATFORM_OSX
|
# elif BX_PLATFORM_OSX
|
||||||
osxSetNSWindow(wmi.info.cocoa.window);
|
pd.ndt = NULL;
|
||||||
|
pd.nwh = wmi.info.cocoa.window;
|
||||||
# elif BX_PLATFORM_WINDOWS
|
# elif BX_PLATFORM_WINDOWS
|
||||||
winSetHwnd(wmi.info.win.window);
|
pd.ndt = NULL;
|
||||||
|
pd.nwh = wmi.info.win.window;
|
||||||
# endif // BX_PLATFORM_
|
# endif // BX_PLATFORM_
|
||||||
|
pd.context = NULL;
|
||||||
|
pd.backbuffer = NULL;
|
||||||
|
setPlatformData(pd);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -212,19 +217,22 @@ namespace bgfx
|
|||||||
{
|
{
|
||||||
inline void glfwSetWindow(GLFWwindow* _window)
|
inline void glfwSetWindow(GLFWwindow* _window)
|
||||||
{
|
{
|
||||||
|
PlatformData pd;
|
||||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
||||||
::Display* display = glfwGetX11Display();
|
pd.ndt = glfwGetX11Display();
|
||||||
::Window window = glfwGetX11Window(_window);
|
pd.nwh = (void*)(uintptr_t)glfwGetX11Window(_window);
|
||||||
void* glx = glfwGetGLXContext(_window);
|
pd.context = glfwGetGLXContext(_window);
|
||||||
x11SetDisplayWindow(display, window, glx);
|
|
||||||
# elif BX_PLATFORM_OSX
|
# elif BX_PLATFORM_OSX
|
||||||
void* window = glfwGetCocoaWindow(_window);
|
pd.ndt = NULL;
|
||||||
void* nsgl = glfwGetNSGLContext(_window);
|
pd.nwh = glfwGetCocoaWindow(_window);
|
||||||
osxSetNSWindow(window, nsgl);
|
pd.context = glfwGetNSGLContext(_window);
|
||||||
# elif BX_PLATFORM_WINDOWS
|
# elif BX_PLATFORM_WINDOWS
|
||||||
HWND hwnd = glfwGetWin32Window(_window);
|
pd.ndt = NULL;
|
||||||
winSetHwnd(hwnd);
|
pd.nwh = glfwGetWin32Window(_window);
|
||||||
|
pd.context = NULL;
|
||||||
# endif // BX_PLATFORM_WINDOWS
|
# endif // BX_PLATFORM_WINDOWS
|
||||||
|
pd.backbuffer = NULL;
|
||||||
|
setPlatformData(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace bgfx
|
} // namespace bgfx
|
||||||
|
Loading…
Reference in New Issue
Block a user