Removed SDL hack to get window handle for Direct3D9. Instead use SDL builtin functionality.
This commit is contained in:
Родитель
c1fbbd9628
Коммит
4bf765d711
|
@ -57,6 +57,8 @@
|
||||||
#include "VertexDeclaration.h"
|
#include "VertexDeclaration.h"
|
||||||
#include "Zone.h"
|
#include "Zone.h"
|
||||||
|
|
||||||
|
#include <SDL_syswm.h>
|
||||||
|
|
||||||
#include "DebugNew.h"
|
#include "DebugNew.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -76,8 +78,6 @@ extern "C" {
|
||||||
namespace Urho3D
|
namespace Urho3D
|
||||||
{
|
{
|
||||||
|
|
||||||
extern "C" HWND WIN_GetWindowHandle(SDL_Window* window);
|
|
||||||
|
|
||||||
static const D3DCMPFUNC d3dCmpFunc[] =
|
static const D3DCMPFUNC d3dCmpFunc[] =
|
||||||
{
|
{
|
||||||
D3DCMP_ALWAYS,
|
D3DCMP_ALWAYS,
|
||||||
|
@ -196,6 +196,15 @@ static unsigned GetD3DColor(const Color& color)
|
||||||
return (((a) & 0xff) << 24) | (((r) & 0xff) << 16) | (((g) & 0xff) << 8) | ((b) & 0xff);
|
return (((a) & 0xff) << 24) | (((r) & 0xff) << 16) | (((g) & 0xff) << 8) | ((b) & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HWND GetWindowHandle(SDL_Window* window)
|
||||||
|
{
|
||||||
|
SDL_SysWMinfo sysInfo;
|
||||||
|
|
||||||
|
SDL_VERSION(&sysInfo.version);
|
||||||
|
SDL_GetWindowWMInfo(window, &sysInfo);
|
||||||
|
return sysInfo.info.win.window;
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned depthStencilFormat = D3DFMT_D24S8;
|
static unsigned depthStencilFormat = D3DFMT_D24S8;
|
||||||
|
|
||||||
Graphics::Graphics(Context* context) :
|
Graphics::Graphics(Context* context) :
|
||||||
|
@ -427,7 +436,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
|
||||||
impl_->presentParams_.MultiSampleType = multiSample > 1 ? (D3DMULTISAMPLE_TYPE)multiSample : D3DMULTISAMPLE_NONE;
|
impl_->presentParams_.MultiSampleType = multiSample > 1 ? (D3DMULTISAMPLE_TYPE)multiSample : D3DMULTISAMPLE_NONE;
|
||||||
impl_->presentParams_.MultiSampleQuality = 0;
|
impl_->presentParams_.MultiSampleQuality = 0;
|
||||||
impl_->presentParams_.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
impl_->presentParams_.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||||
impl_->presentParams_.hDeviceWindow = WIN_GetWindowHandle(impl_->window_);
|
impl_->presentParams_.hDeviceWindow = GetWindowHandle(impl_->window_);
|
||||||
impl_->presentParams_.EnableAutoDepthStencil = TRUE;
|
impl_->presentParams_.EnableAutoDepthStencil = TRUE;
|
||||||
impl_->presentParams_.AutoDepthStencilFormat = D3DFMT_D24S8;
|
impl_->presentParams_.AutoDepthStencilFormat = D3DFMT_D24S8;
|
||||||
impl_->presentParams_.Flags = D3DPRESENT_LINEAR_CONTENT;
|
impl_->presentParams_.Flags = D3DPRESENT_LINEAR_CONTENT;
|
||||||
|
@ -585,7 +594,7 @@ bool Graphics::TakeScreenShot(Image& destImage)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HWND hwnd = WIN_GetWindowHandle(impl_->window_);
|
HWND hwnd = GetWindowHandle(impl_->window_);
|
||||||
GetClientRect(hwnd, &sourceRect);
|
GetClientRect(hwnd, &sourceRect);
|
||||||
ClientToScreen(hwnd, (LPPOINT)&sourceRect);
|
ClientToScreen(hwnd, (LPPOINT)&sourceRect);
|
||||||
}
|
}
|
||||||
|
@ -2464,7 +2473,7 @@ bool Graphics::CreateDevice(unsigned adapter, unsigned deviceType)
|
||||||
if (FAILED(impl_->interface_->CreateDevice(
|
if (FAILED(impl_->interface_->CreateDevice(
|
||||||
adapter,
|
adapter,
|
||||||
(D3DDEVTYPE)deviceType,
|
(D3DDEVTYPE)deviceType,
|
||||||
WIN_GetWindowHandle(impl_->window_),
|
GetWindowHandle(impl_->window_),
|
||||||
behaviorFlags,
|
behaviorFlags,
|
||||||
&impl_->presentParams_,
|
&impl_->presentParams_,
|
||||||
&impl_->device_)))
|
&impl_->device_)))
|
||||||
|
|
|
@ -59,12 +59,6 @@ static ATOM SDL_HelperWindowClass = 0;
|
||||||
#define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX)
|
#define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX)
|
||||||
#define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE)
|
#define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE)
|
||||||
|
|
||||||
// Urho3D: added function for Direct3D9 initialization
|
|
||||||
HWND WIN_GetWindowHandle(SDL_Window* window)
|
|
||||||
{
|
|
||||||
return ((SDL_WindowData *)window->driverdata)->hwnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DWORD
|
static DWORD
|
||||||
GetWindowStyle(SDL_Window * window)
|
GetWindowStyle(SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче