Skip to content

Commit

Permalink
add input to eglut backend
Browse files Browse the repository at this point in the history
  • Loading branch information
lubosz committed Oct 5, 2012
1 parent fd634c2 commit d8dccba
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions apps/eglut/backend-egl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

#include "DemoLauncher.h"
#include "Renderer/OpenGL.h"
#include "Scene/Scene.h"

DemoLauncher * launcher;

static void draw(void) {
launcher->draw();
eglutPostRedisplay();
}

/* new window size or exposure */
Expand All @@ -29,20 +31,24 @@ static void reshape(GLint width, GLint height) {
// glTranslatef(0.0, 0.0, -10.0);
}

//static void special_key(int special) {
// switch (special) {
// case EGLUT_KEY_LEFT:
// break;
// case EGLUT_KEY_RIGHT:
// break;
// case EGLUT_KEY_UP:
// break;
// case EGLUT_KEY_DOWN:
// break;
// default:
// break;
// }
//}
static void special_key(int special) {
switch (special) {
case EGLUT_KEY_LEFT:
Scene::Instance().getCurrentCamera()->leftDirection(0.1);
break;
case EGLUT_KEY_RIGHT:
Scene::Instance().getCurrentCamera()->rightDirection(0.1);
break;
case EGLUT_KEY_UP:
Scene::Instance().getCurrentCamera()->forwardDirection(0.1);
break;
case EGLUT_KEY_DOWN:
Scene::Instance().getCurrentCamera()->backwardDirection(0.1);
break;
default:
break;
}
}

int main(int argc, char *argv[]) {
eglutInitWindowSize(1920, 1200);
Expand All @@ -58,9 +64,7 @@ int main(int argc, char *argv[]) {

eglutReshapeFunc(reshape);
eglutDisplayFunc(draw);
// eglutSpecialFunc(special_key);


eglutSpecialFunc(special_key);
eglutMainLoop();

return 0;
Expand Down

0 comments on commit d8dccba

Please sign in to comment.