Pressing ESC to close the rendering window ?

Hello,

In other engines, there is default inbuilt option of hitting the ESC key to close the rendering window and stopping the running application. Is this present in the Panda engine or does it have other different key to do this or do I have to implement it myself in my code ?

Please advice.

Thanks,

In PandaFramework:

void 	define_key (const string &event_name, const string &description, EventHandler::EventCallbackFunction *function, void *data);

So, you have to:

PandaFramework framework;

void exit_event ( const Event *e, void *data )
{
framework->close_all_windows();
}

In your setup section (before looping):

window->enable_keyboard();
framework.define_key ("escape", "Quit", exit_event, (void *) NULL);

This will halt by-the-hard-way your game, it’s recomendable that loop yourself the PandaFramework, so you can stop it when you want.

@EdmundosTown: Thanks a lot for helping me out … :slight_smile:

I will look into it … thanks.