src/Main.cpp

Go to the documentation of this file.
00001 
00008 /*
00009 This file is part of Teapot Colony Wars.
00010 
00011 Teapot Colony Wars is free software: you can redistribute it and/or modify
00012 it under the terms of the GNU General Public License as published by
00013 the Free Software Foundation, either version 2 of the License, or
00014 (at your option) any later version.
00015 
00016 Teapot Colony Wars is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 GNU General Public License for more details.
00020 
00021 You should have received a copy of the GNU General Public License
00022 along with Teapot Colony Wars.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #include <cstdlib>
00026 #include <config.h>
00027 #include <GL/glut.h>
00028 
00029 #include "Display.h"
00030 
00031 /*
00032  * Méthodes globales appellant les différentes fonctions de Display
00033  * sur son instance. Permet d'obtenir des pointeurs sur ces fonctions pour
00034  * les passer aux fonctions de callback de glut.
00035  */
00036 
00040 void display_init() {
00041   Display::instance()->init();
00042 }
00043 
00047 void display_quit() {
00048   Display::instance()->quit();
00049 }
00050 
00054 void display_draw() {
00055   Display::instance()->draw();
00056 }
00057 
00064 void display_reshape(int width, int height) {
00065   Display::instance()->reshape(width, height);
00066 }
00067 
00075 void display_inputKey(unsigned char key, int x, int y) {
00076   Display::instance()->inputKey(key, x, y);
00077 }
00078 
00087 void display_inputMouse(int button, int state, int x, int y) {
00088   Display::instance()->inputMouse(button, state, x, y);
00089 }
00090 
00097 int main(int argc, char *argv[]) {
00098   int win;
00099 
00100   glutInit(&argc, argv);
00101   glutInitDisplayMode(GLUT_DEPTH | GLUT_ACCUM | GLUT_RGBA | GLUT_DOUBLE);
00102   glutInitWindowSize(1024,768);
00103   glutInitWindowPosition(0, 0);
00104   win = glutCreateWindow(PACKAGE " " VERSION);
00105   glutDisplayFunc(display_draw);
00106   glutFullScreen();
00107   glutReshapeFunc(display_reshape);
00108   glutKeyboardFunc(display_inputKey);
00109   glutMouseFunc(display_inputMouse);
00110   display_init();
00111   atexit(display_quit);
00112   glutMainLoop();
00113 
00114   return 0;
00115 }

Generated on Sat Feb 2 22:22:54 2008 for Teapot Colony Wars by  doxygen 1.5.4