Add health/xp/level interface

This commit is contained in:
2016-05-28 16:04:44 +02:00
parent 34ea491f39
commit ae80c7a5bf
16 changed files with 289 additions and 54 deletions
+13 -7
View File
@@ -21,7 +21,7 @@ int main(int argc, char* argv[])
glutDisplayFunc([]() { app->draw(); } );
glutIdleFunc([]() { app->update(); } );
glutReshapeFunc([](int w, int h) { app->width = w; app->height = h; glViewport(0, 0, w, h); });
glutReshapeFunc([](int w, int h) { CrystalPoint::width = w; CrystalPoint::height = h; glViewport(0, 0, w, h); });
//Keyboard
glutKeyboardFunc([](unsigned char c, int, int) { app->keyboardState.keys[c] = true; });
@@ -29,8 +29,7 @@ int main(int argc, char* argv[])
glutSpecialFunc([](int c, int, int) { app->keyboardState.special[c] = true; });
glutSpecialUpFunc([](int c, int, int) { app->keyboardState.special[c] = false; });
//Mouse
glutPassiveMotionFunc([](int x, int y)
auto mousemotion = [](int x, int y)
{
if (justMoved)
{
@@ -41,11 +40,18 @@ int main(int argc, char* argv[])
int dy = y - app->height / 2;
if ((dx != 0 || dy != 0) && abs(dx) < 400 && abs(dy) < 400)
{
app->mouseOffset = app->mouseOffset + Vec2f(dx,dy);
app->mouseOffset = app->mouseOffset + Vec2f(dx, dy);
glutWarpPointer(app->width / 2, app->height / 2);
justMoved = true;
}
});
};
//Mouse
glutPassiveMotionFunc(mousemotion);
glutMotionFunc(mousemotion);
CrystalPoint::height = GLUT_WINDOW_HEIGHT;
CrystalPoint::width = GLUT_WINDOW_WIDTH;
glutMainLoop();
return 0;
@@ -57,7 +63,7 @@ void configureOpenGL()
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(800, 600);
glutCreateWindow("Crystal Point");
//glutFullScreen();
glutFullScreen();
//Depth testing
glEnable(GL_DEPTH_TEST);
@@ -86,5 +92,5 @@ void configureOpenGL()
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glutSetCursor(GLUT_CURSOR_CROSSHAIR);
glutSetCursor(GLUT_CURSOR_NONE);
}