X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fpc%2Fmain_glut.c;fp=src%2Fpc%2Fmain_glut.c;h=0000000000000000000000000000000000000000;hb=39dec6b602af5f02cc5297c21da7207debff52b8;hp=a21cbcaf159d967794ebc01741744d2410a8c0b2;hpb=295b86a1a8efdfe4fb0d9dba6152eb956441603c;p=andemo diff --git a/src/pc/main_glut.c b/src/pc/main_glut.c deleted file mode 100644 index a21cbca..0000000 --- a/src/pc/main_glut.c +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include -#include -#include "opengl.h" -#include "miniglut.h" -#include "demo.h" - -static void display(void); -static void keypress(unsigned char key, int x, int y); -static void skeypress(int key, int x, int y); -static void mouse(int bn, int st, int x, int y); -static int translate_key(int key); - -static long start_time; - - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitWindowSize(1280, 800); - glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - glutCreateWindow("Mindlapse"); - - glutDisplayFunc(display); - glutIdleFunc(glutPostRedisplay); - glutReshapeFunc(demo_reshape); - glutKeyboardFunc(keypress); - glutSpecialFunc(skeypress); - glutMouseFunc(mouse); - glutMotionFunc(demo_motion); - - if(demo_init() == -1) { - return 1; - } - atexit(demo_cleanup); - - start_time = glutGet(GLUT_ELAPSED_TIME); - glutMainLoop(); - return 0; -} - -void swap_buffers(void) -{ - glutSwapBuffers(); -} - -static void display(void) -{ - time_msec = glutGet(GLUT_ELAPSED_TIME) - start_time; - - demo_display(); - - glutSwapBuffers(); - assert(glGetError() == GL_NO_ERROR); -} - -static void keypress(unsigned char key, int x, int y) -{ - if(key == 27) exit(0); - - demo_keyboard(key, 1); -} - -static void skeypress(int key, int x, int y) -{ - if((key = translate_key(key))) { - demo_keyboard(key, 1); - } -} - -static void mouse(int bn, int st, int x, int y) -{ - int bidx = bn - GLUT_LEFT_BUTTON; - int press = st == GLUT_DOWN; - - demo_mouse(bidx, press, x, y); -} - -static int translate_key(int key) -{ - if(key >= GLUT_KEY_F1 && key <= GLUT_KEY_F12) { - return key - GLUT_KEY_F1 + KEY_F1; - } - switch(key) { - case GLUT_KEY_LEFT: - return KEY_LEFT; - case GLUT_KEY_RIGHT: - return KEY_RIGHT; - case GLUT_KEY_UP: - return KEY_UP; - case GLUT_KEY_DOWN: - return KEY_DOWN; - case GLUT_KEY_PAGE_UP: - return KEY_PGUP; - case GLUT_KEY_PAGE_DOWN: - return KEY_PGDOWN; - default: - break; - } - return 0; -}