nuclear@0: #include nuclear@0: #include nuclear@0: #ifdef __APPLE__ nuclear@0: #include nuclear@0: #else nuclear@0: #include nuclear@0: #endif nuclear@0: #include "app.h" nuclear@0: nuclear@0: static void display(); nuclear@0: static void keydown(unsigned char key, int x, int y); nuclear@0: static void keyup(unsigned char key, int x, int y); nuclear@0: static void mouse(int bn, int st, int x, int y); nuclear@0: nuclear@0: int main(int argc, char **argv) nuclear@0: { nuclear@0: glutInit(&argc, argv); nuclear@0: glutInitWindowSize(1280, 720); nuclear@0: glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_MULTISAMPLE); nuclear@0: glutCreateWindow("Curve Draw"); nuclear@0: nuclear@0: glutDisplayFunc(display); nuclear@0: glutReshapeFunc(app_reshape); nuclear@0: glutKeyboardFunc(keydown); nuclear@0: glutKeyboardUpFunc(keyup); nuclear@0: glutMouseFunc(mouse); nuclear@0: glutMotionFunc(app_mouse_motion); nuclear@0: glutPassiveMotionFunc(app_mouse_motion); nuclear@0: nuclear@0: if(!app_init(argc, argv)) { nuclear@0: return 1; nuclear@0: } nuclear@0: atexit(app_cleanup); nuclear@0: nuclear@0: glutMainLoop(); nuclear@0: return 0; nuclear@0: } nuclear@0: nuclear@0: void post_redisplay() nuclear@0: { nuclear@0: glutPostRedisplay(); nuclear@0: } nuclear@0: nuclear@0: static void display() nuclear@0: { nuclear@0: app_draw(); nuclear@0: glutSwapBuffers(); nuclear@0: } nuclear@0: nuclear@0: static void keydown(unsigned char key, int x, int y) nuclear@0: { nuclear@0: app_keyboard(key, true); nuclear@0: } nuclear@0: nuclear@0: static void keyup(unsigned char key, int x, int y) nuclear@0: { nuclear@0: app_keyboard(key, false); nuclear@0: } nuclear@0: nuclear@0: static void mouse(int bn, int st, int x, int y) nuclear@0: { nuclear@0: app_mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y); nuclear@0: }