nuclear@16: /* nuclear@16: curvedraw - a simple program to draw curves nuclear@16: Copyright (C) 2015 John Tsiombikas nuclear@16: nuclear@16: This program is free software: you can redistribute it and/or modify nuclear@16: it under the terms of the GNU General Public License as published by nuclear@16: the Free Software Foundation, either version 3 of the License, or nuclear@16: (at your option) any later version. nuclear@16: nuclear@16: This program is distributed in the hope that it will be useful, nuclear@16: but WITHOUT ANY WARRANTY; without even the implied warranty of nuclear@16: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nuclear@16: GNU General Public License for more details. nuclear@16: nuclear@16: You should have received a copy of the GNU General Public License nuclear@16: along with this program. If not, see . nuclear@16: */ 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: }