Merge pull request #237 from erwincoumans/master

escape quits SimpleOpenGLApp
This commit is contained in:
erwincoumans 2014-09-04 18:00:44 -07:00
commit 3205f71e5e

View File

@ -48,13 +48,27 @@ struct SimpleInternalData
static SimpleOpenGL3App* gApp=0;
void SimpleResizeCallback( float width, float height)
static void SimpleResizeCallback( float width, float height)
{
gApp->m_instancingRenderer->resize(width,height);
gApp->m_primRenderer->setScreenSize(width,height);
}
static void SimpleKeyboardCallback(int key, int state)
{
if (key==B3G_ESCAPE && gApp && gApp->m_window)
{
gApp->m_window->setRequestExit();
} else
{
b3DefaultKeyboardCallback(key,state);
}
}
static GLuint BindFont(const CTexFont *_Font)
{
GLuint TexID = 0;
@ -135,8 +149,8 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height)
m_window->setMouseMoveCallback(b3DefaultMouseMoveCallback);
m_window->setMouseButtonCallback(b3DefaultMouseButtonCallback);
m_window->setKeyboardCallback(b3DefaultKeyboardCallback);
m_window->setWheelCallback(b3DefaultWheelCallback);
m_window->setKeyboardCallback(SimpleKeyboardCallback);
m_window->setWheelCallback(b3DefaultWheelCallback);
m_window->setResizeCallback(SimpleResizeCallback);
TwGenerateDefaultFonts();