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.

Loop without device->run()

Postby 3DModelerMan » Thu Jan 19, 2012 2:43 pm

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:
cpp 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:
cpp 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/3DModelerMan/replicator#tipjar
User avatar
3DModelerMan
 
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Loop without device->run()

Postby Mel » Thu Jan 19, 2012 5:33 pm

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.
http://santiagong.daportfolio.com/
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 1783
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Loop without device->run()

Postby 3DModelerMan » Thu Jan 19, 2012 11:52 pm

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/3DModelerMan/replicator#tipjar
User avatar
3DModelerMan
 
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Loop without device->run()

Postby 3DModelerMan » Fri Jan 20, 2012 12:08 am

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/3DModelerMan/replicator#tipjar
User avatar
3DModelerMan
 
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Loop without device->run()

Postby Mel » Fri Jan 20, 2012 8:57 pm

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...)
http://santiagong.daportfolio.com/
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 1783
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Loop without device->run()

Postby Mikhail9 » Mon Jan 23, 2012 4:09 am

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.
Mikhail9
 
Posts: 54
Joined: Mon Jun 29, 2009 8:41 am


Return to Beginners Help

Who is online

Users browsing this forum: Google [Bot] and 0 guests