Compare commits

...

1 Commits

Author SHA1 Message Date
Zach Bacon 91268b7ccf initial bring up for direct3d9 support
Signed-off-by: Zach Bacon <zachbacon@vba-m.com>
2023-02-02 10:58:35 -05:00
1 changed files with 17 additions and 9 deletions

View File

@ -1109,7 +1109,7 @@ void GameArea::OnIdle(wxIdleEvent& event)
panel = new GLDrawingPanel(this, basic_width, basic_height);
break;
#endif
#if defined(__WXMSW__) && !defined(NO_D3D)
#ifdef __WXMSW__
case config::RenderMethod::kDirect3d:
panel = new DXDrawingPanel(this, basic_width, basic_height);
break;
@ -2405,10 +2405,10 @@ void GLDrawingPanel::DrawArea(wxWindowDC& dc)
#endif // GL support
#if defined(__WXMSW__) && !defined(NO_D3D)
#ifdef __WXMSW__
#define DIRECT3D_VERSION 0x0900
#include <d3d9.h> // main include file
//#include <d3dx9core.h> // required for font rendering
#include <d3dx9core.h> // required for font rendering
#include <dxerr9.h> // contains debug functions
DXDrawingPanel::DXDrawingPanel(wxWindow* parent, int _width, int _height)
@ -2419,13 +2419,21 @@ DXDrawingPanel::DXDrawingPanel(wxWindow* parent, int _width, int _height)
void DXDrawingPanel::DrawArea(wxWindowDC& dc)
{
// FIXME: implement
if (!did_init) {
DrawingPanelInit();
IDirect3DDevice9 * Device;
D3DPRESENT_PARAMETERS present_params;
ZeroMemory( &present_params, sizeof(present_params) );
present_params.Windowed = true;
present_params.SwapEffect = D3DSWAPEFFECT_DISCARD;
present_params.BackBufferFormat = D3DFMT_UNKNOWN;
present_params.BackBufferWidth = GetSize().x;
present_params.BackBufferHeight = GetSize().y;
if ( FAILED( D3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, (HWND)GetWindow()->GetHandle()/*get handle from wxWidgets, vitally important*/, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_params, &Device) ))
{
wxMessageBox( "Failed to CreateDevice for Direct3D", "Error");
throw "aaaaaaaaaaaaaa!!!"; // I agree that this error handling scheme is not very professional
}
if (todraw) {
}
}
#endif