cubemapper

annotate src/main.cc @ 0:8fc9e1d3aad2

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 27 Jul 2017 20:36:12 +0300
parents
children d7a29cb7ac8d
rev   line source
nuclear@0 1 #include <stdlib.h>
nuclear@0 2 #ifdef __APPLE__
nuclear@0 3 #include <GLUT/glut.h>
nuclear@0 4 #else
nuclear@0 5 #include <GL/glut.h>
nuclear@0 6 #endif
nuclear@0 7 #include "app.h"
nuclear@0 8
nuclear@0 9 static void display();
nuclear@0 10 static void reshape(int x, int y);
nuclear@0 11 static void keydown(unsigned char key, int x, int y);
nuclear@0 12 static void mouse(int bn, int st, int x, int y);
nuclear@0 13 static void motion(int x, int y);
nuclear@0 14
nuclear@0 15 int main(int argc, char **argv)
nuclear@0 16 {
nuclear@0 17 glutInit(&argc, argv);
nuclear@0 18 glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
nuclear@0 19 glutInitWindowSize(1024, 768);
nuclear@0 20 glutCreateWindow("cubemapper");
nuclear@0 21
nuclear@0 22 glutDisplayFunc(display);
nuclear@0 23 glutReshapeFunc(reshape);
nuclear@0 24 glutKeyboardFunc(keydown);
nuclear@0 25 glutMouseFunc(mouse);
nuclear@0 26 glutMotionFunc(motion);
nuclear@0 27
nuclear@0 28 if(!app_init(argc, argv)) {
nuclear@0 29 return 1;
nuclear@0 30 }
nuclear@0 31
nuclear@0 32 glutMainLoop();
nuclear@0 33 return 0;
nuclear@0 34 }
nuclear@0 35
nuclear@0 36 void app_quit()
nuclear@0 37 {
nuclear@0 38 app_cleanup();
nuclear@0 39 exit(0);
nuclear@0 40 }
nuclear@0 41
nuclear@0 42 void app_redisplay()
nuclear@0 43 {
nuclear@0 44 glutPostRedisplay();
nuclear@0 45 }
nuclear@0 46
nuclear@0 47 void app_swap_buffers()
nuclear@0 48 {
nuclear@0 49 glutSwapBuffers();
nuclear@0 50 }
nuclear@0 51
nuclear@0 52 static void display()
nuclear@0 53 {
nuclear@0 54 app_draw();
nuclear@0 55 }
nuclear@0 56
nuclear@0 57 static void reshape(int x, int y)
nuclear@0 58 {
nuclear@0 59 app_reshape(x, y);
nuclear@0 60 }
nuclear@0 61
nuclear@0 62 static void keydown(unsigned char key, int x, int y)
nuclear@0 63 {
nuclear@0 64 app_keyboard(key, true);
nuclear@0 65 }
nuclear@0 66
nuclear@0 67 static void mouse(int bn, int st, int x, int y)
nuclear@0 68 {
nuclear@0 69 app_mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y);
nuclear@0 70 }
nuclear@0 71
nuclear@0 72 static void motion(int x, int y)
nuclear@0 73 {
nuclear@0 74 app_mouse_motion(x, y);
nuclear@0 75 }