Loop without device->run()

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Loop without device->run()

Post by 3DModelerMan »

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?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Loop without device->run()

Post by Mel »

It doesn't look like a good idea, as it also handles the windows messages, besides the timer. unless you managed those messages on your own, you need the dev->run() method to have the Irrlicht window running properly.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Loop without device->run()

Post by 3DModelerMan »

I guess I should just use the normal way then... I'll just separate the drawing from the device management.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Loop without device->run()

Post by 3DModelerMan »

Do I have to set the device not to recieve input events if I want to use direct input?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Loop without device->run()

Post by Mel »

From my experience, i can't tell really, but my guess is that the messages that aren't catched by the Irrlicht's message handler will go to the Direct Input handler you create, so, it is posible. But anything that relies on the input system of Irrlicht may not work properly (FPS and Maya cameras, the whole GUI system...)
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Mikhail9
Posts: 54
Joined: Mon Jun 29, 2009 8:41 am

Re: Loop without device->run()

Post by Mikhail9 »

Mel wrote:From my experience, i can't tell really, but my guess is that the messages that aren't catched by the Irrlicht's message handler will go to the Direct Input handler you create, so, it is posible. But anything that relies on the input system of Irrlicht may not work properly (FPS and Maya cameras, the whole GUI system...)
Depending on how you do things, Irrlicht may still catch input events and run the GUI when you are in windowed mode and DirectInput is cooperative. In full screen, however, DirectInput is generally in exclusive mode and Irrlicht won't get any input messages, breaking the GUI.
Post Reply