Skip to content

Commit

Permalink
Merge pull request bulletphysics#237 from erwincoumans/master
Browse files Browse the repository at this point in the history
escape quits SimpleOpenGLApp
  • Loading branch information
erwincoumans committed Sep 5, 2014
2 parents b125a96 + 6180884 commit 3205f71
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions btgui/OpenGLWindow/SimpleOpenGL3App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 3205f71

Please sign in to comment.