Hi,
1.) I have a small problem deciding which is better or am I doing it wrong. First I have 3 classes as follow:
class CS3DEDx9System
{
//some stuff here
public:
void dummyFunc();
};
class CS3DEWin32
{
//Win stuff
public:
void dummyFunc2();
};
class CS3DEDisplayManager: public IRunnable
{
public:
// methods
void Whatever();
virtual HRESULT RunTask(); //this represent thread execution routine
private:
CS3DEWin32 *win;
CS3DEDx9System *dx;
};
This is some class that uses the DisplayManager
class MainInterface
{
public:
void DoSomething():
CS3DEDisplayManager *DispMan;
};
Now the problem is when I was programming the Dx and Win class I tried for them to be as much isolated and self contained in order to use them again with out worrying about dependencies. Now time came to use them together in my small game engine library which in this case is the MainInterface class, and if i want to access a method in dx class for example than i need to wrap the method again in DispMan and this function would call the appropriate function; as follows:
CS3DEDisplayManager::Whatever()
{
dx->dummyFunc();
}
Now this seems a lot of code needs to warped. Am I doing this wrong and insted should declare the dx and Win class a like this ?:
class CS3DEDisplayManager: public CS3DEDx9System, public: CS3DEWin32, public IRunnable
If you wondering why I use The In between class DispMan is becuase the DispMan class represents a thread that will execute and dx and win32 needs to be in the same thread plus I use no D3DMULTITHREAD flag so a lot of methods will be needed to be warped to make sure only the thread that created dx will run Resource Creation Code But the user will only deal with the maininterface class
Is this the right approach or am I missing something?
2.) this should be easy for you guys but it gives me trouble
if( PeekMessage( &uMsg, NULL, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &uMsg );
if(PeekMessage( &uMsg, hWnd, 0,0, PM_REMOVE)
{
if( uMsg.message == WM_SIZE) //does not work
{
onWindowResize();
}
}
DispatchMessage( &uMsg );
}
It does not work if I try to put this code after DispatchMessage or before TranslateMessage it never hits that OnWindowResize. The hWnd belong to the MainWindow any suggestions how to do this properly ?
Thank you for any responses and reading this long post, if more info is required just let me know. ~Janusz