Original Post
Greetings! I was wondering, are there any guidelines on how to create an API? I tried many times to write my own engine but there is allways something I do not like about the interface. For example I do not like Ogre3D or Irrlicht because they almost force you to derive from their baseclases to start an application. Some APIs you just plug in when required and you can use them like plain C. OpenGL for example. You just initialize it and call glBegin() .. glEnd() that's it. No derivations what-so-ever. Because of the object oriented nature of DirectX I do not like that some base variable IDirect3DDevice9 etc.. are lying arround in my global splace of a .lib or .dll. I would like to have them encapsulated. But on the other way, i would like to avoid this:
class CMyRenderDevice : public CMySingleton<CMyRenderDevice>
{
...
public:
bool BeginScene(void);
bool EndScene(void);
}
bool engineBeginScene(void)
{
CMyRenderDevice().GetSingleton().BeginScene();
}
bool engineEndScene(void)
{
CMyRenderDevice().GetSingleton().EndScene();
}
Any suggestions or even better tutorials how to achive souch things in the most elegant way? Thank you in advance!