Original Post
🔒 Locked
API independant engine
Advertisement
Try using a central interface:
And then all you would have to do is to keep a pointer to a CGraphics interface and dynamically allocate whichever class you need.
[edit]Forgot to declare as virtual...
[edited by - fyhuang on May 16, 2004 9:13:37 AM]
class CGraphics
{
virtual void SetMode( int w, int h );
};
And deriving a seperate class for each API:
class CDirectX : CGraphics
{
LPDIRECT3DDEVICE8 Device;
void SetMode( int w, int h );
};
class COpenGL : CGraphics
{
GLRC hRC;
void SetMode( int w, int h );
};
And then all you would have to do is to keep a pointer to a CGraphics interface and dynamically allocate whichever class you need.
[edit]Forgot to declare as virtual...
[edited by - fyhuang on May 16, 2004 9:13:37 AM]
Striving for Graphics API Independence - Three parts so far...
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement