I'm trying to write a framework for my games where the rendering, audio, physics, etc. Are all seperate modules, I have my basic core framework setup, and now I'm trying to do the rendering module. The problem is that I can't figure out how I should be running it's rendering code. My module class looks like this:
Code: Select all
class IModule : public IEventListener
{
public:
virtual void update(const float& dt)=0;
virtual void draw()=0;
virtual void onEvent(CEvent& event)=0;
virtual unsigned int getId()=0;
};
The update and draw functions are called in my separate main loop. Would it work if I just called this:
Code: Select all
device->getTimer()->tick();
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
from within my draw() function? I just won't be able to get input from the device then right? What other problems should I be looking out for?