How to close the window

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
daniel_jianfeng
Posts: 12
Joined: Sun Mar 31, 2013 12:43 pm

How to close the window

Post by daniel_jianfeng »

In my own project, I used the irrlicht.But now I want to close the window by code not by mouse or by keyboard. Is there a method available?
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Re: How to clost the window

Post by greenya »

You have to call

Code: Select all

device->closeDevice();
This can be called from any place. This will force one of the next "device->run()" to return false.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: How to close the window

Post by hybrid »

Next time, please simply edit your own post (use the edit button) and post in Beginner's section right away.
daniel_jianfeng
Posts: 12
Joined: Sun Mar 31, 2013 12:43 pm

Re: How to close the window

Post by daniel_jianfeng »

Thank you, hybrid. I get it.
daniel_jianfeng
Posts: 12
Joined: Sun Mar 31, 2013 12:43 pm

Re: How to close the window

Post by daniel_jianfeng »

My project is a little special, there is no loop in my code. So the method closeDevice is not suitable in this case. Do you have any other solution, greenya.

Code: Select all

while(device->run()){}
device->closeDevice();
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Re: How to close the window

Post by greenya »

I really suggest you to learn some c++ programming and learn from the examples which are provided with Irrlicht SDK. Because you ask stuff which is already there. If you have problems understanding the examples, then you need to get some knowledge about c++ in general, types, variables and code execution flow.

For example the 09.Meshviewer has a menu and when you click File->Exit, the application closes, and the code just executes closeDevice() method. That is your case.
Post Reply