I try to split up my DirectX stuff and GUI stuff into two classes. It has come to the part where it compiles, but this snippet return false:
CODE
if(FAILED(pd3d->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, hwnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &pd3dDevice)))
{
MessageBox(NULL, "CD failed!", "Fatal error!", MB_OK);
return false;
}
It is part of the class DxManager, I think it's the
hwnd that fails. hwnd is part of the Gui class
Here is the Gui class
CODE
class Gui
{
public:
Gui();
virtual ~Gui();
bool InitWindow(HINSTANCE hInstance);
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
protected:
HINSTANCE hInstance;
HWND hwnd;
private:
int width, height;
};
and here is the DxManager class
CODE
class DxManager : public Gui
{
public:
DxManager();
virtual ~DxManager();
bool InitDirect3D();
void StartRender();
void StopRender();
void CleanUp();
void BlitToSurface();
private:
bool fullscreen;
};
Anyone that can help me understand what is wrong?
*** EDIT ***I used some breakpoints and found this (check attachments), If I comment the snippet at the beginning of the thread the app will run like it should without any errors. So I guess my guess about HWND was correct. It looks like it lose it's value, is it possible to make it keep it?
This post has been edited by FrozenSnake: 5 Nov, 2009 - 05:36 PM