/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ### File Specific: main-programmer: Patrick Boenzli co-programmer: */ /* class definition header */ #include "orxonox.h" #include "data_tank.h" /* standard headers */ #include #include /* openGL Headers */ #include using namespace std; Orxonox::Orxonox () {} Orxonox::~Orxonox () {} /* this is a singleton class to prevent dublicates */ Orxonox* Orxonox::singleton_ref = 0; Orxonox* Orxonox::getInstance (void) { if (singleton_ref == NULL) singleton_ref = new Orxonox(); return singleton_ref; } int Orxonox::globalInit (int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow("orxOnox"); /* window event dispatchers */ glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutSpecialFunc(specFunc); } int Orxonox::menuInit (void) { glClearColor(0.0, 0.0, 0.0, 0.0); } int Orxonox::gameInit (void) { } void Orxonox::keyboard(unsigned char key, int x, int y) { switch(key) { case 27: exit(0); break; } } void Orxonox::specFunc(int key, int x, int y) { switch(key) { case GLUT_KEY_UP: cout << "key_up" << endl; break; case GLUT_KEY_DOWN: cout << "key_down" << endl; break; case GLUT_KEY_RIGHT: cout << "key_right" << endl; break; case GLUT_KEY_LEFT: cout << "key_left" << endl; break; } } void Orxonox::display (void) { glClear(GL_COLOR_BUFFER_BIT); glutSwapBuffers(); } void Orxonox::reshape (int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //pb why a second time? } int main (int argc, char** argv) { Orxonox *orx = Orxonox::getInstance(); (*orx).globalInit(argc, argv); (*orx).menuInit(); World* wd = new World; Player* pl = new Player; (*wd).addPlayer(pl); (*wd).addPlayer(pl); (*wd).addPlayer(pl); (*wd).addPlayer(pl); NPC* nl = new NPC; (*wd).addNPC(nl); (*wd).addNPC(nl); (*wd).addNPC(nl); (*wd).addNPC(nl); (*wd).addNPC(nl); (*wd).addNPC(nl); (*wd).testThaTest(); glutMainLoop(); return 0; }