mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-17 06:21:11 +00:00
Make sure we're actually running on Windows before using D3D renderers
This commit is contained in:
@@ -1595,6 +1595,7 @@ int D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propertie
|
||||
{
|
||||
D3D_RenderData *data;
|
||||
HRESULT result;
|
||||
HWND hwnd;
|
||||
D3DPRESENT_PARAMETERS pparams;
|
||||
IDirect3DSwapChain9 *chain;
|
||||
D3DCAPS9 caps;
|
||||
@@ -1603,6 +1604,11 @@ int D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propertie
|
||||
SDL_DisplayID displayID;
|
||||
const SDL_DisplayMode *fullscreen_mode = NULL;
|
||||
|
||||
hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
|
||||
if (!hwnd) {
|
||||
return SDL_SetError("Couldn't get window handle");
|
||||
}
|
||||
|
||||
SDL_SetupRendererColorspace(renderer, create_props);
|
||||
|
||||
if (renderer->output_colorspace != SDL_COLORSPACE_SRGB) {
|
||||
@@ -1654,7 +1660,7 @@ int D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propertie
|
||||
}
|
||||
|
||||
SDL_zero(pparams);
|
||||
pparams.hDeviceWindow = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
|
||||
pparams.hDeviceWindow = hwnd;
|
||||
pparams.BackBufferWidth = w;
|
||||
pparams.BackBufferHeight = h;
|
||||
pparams.BackBufferCount = 1;
|
||||
|
||||
Reference in New Issue
Block a user