mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-03 10:27:40 +00:00
Make sure we're actually running on Windows before using D3D renderers
This commit is contained in:
parent
4d5f139f0f
commit
d6c8485f28
4 changed files with 17 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue