Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1850 in orxonox.OLD for orxonox/trunk/core/orxonox.cc


Ignore:
Timestamp:
Apr 21, 2004, 1:11:19 AM (21 years ago)
Author:
patrick
Message:

orxonox/trunk: new Makfile, orxonox with window, data_tank added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/core/orxonox.cc

    r1849 r1850  
     1/*
     2   orxonox - the future of 3D-vertical-scrollers
     3
     4   Copyright (C) 2004 orx
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 2, or (at your option)
     9   any later version.
     10
     11   This program is distributed in the hope that it will be useful,
     12   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14   GNU General Public License for more details.
     15
     16   You should have received a copy of the GNU General Public License
     17   along with this program; if not, write to the Free Software Foundation,
     18   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
     19
     20*/
     21
     22
     23
     24
     25
     26
    127/* class definition header */
    228#include "orxonox.h"
     
    1339
    1440
    15 Orxonox::Orxonox() {}
    16 Orxonox::~Orxonox() {}
     41Orxonox::Orxonox () {}
    1742
    1843
    19 int Orxonox::globalInit(int argc, char** argv)
     44
     45Orxonox::~Orxonox () {}
     46
     47
     48/* this is a singleton class to prevent dublicates */
     49Orxonox* Orxonox::singleton_ref = 0;
     50Orxonox* Orxonox::getInstance (void)
     51{
     52  if (singleton_ref == NULL)
     53    singleton_ref = new Orxonox();
     54  return singleton_ref;
     55}
     56
     57
     58
     59int Orxonox::globalInit (int argc, char** argv)
    2060{
    2161  glutInit(&argc, argv);
     
    2565  glutCreateWindow("orxOnox");
    2666  /* window event dispatchers */
    27   /*
    28     glutDisplayFunc(display);
    29     glutReshapeFunc(resphape);
    30     glutMainLoop();
    31   */
     67  glutDisplayFunc(display);
     68  glutReshapeFunc(reshape);
    3269}
    3370
    3471
    35 int Orxonox::menuInit()
     72
     73int Orxonox::menuInit (void)
    3674{
    3775  glClearColor(0.0, 0.0, 0.0, 0.0);
     76}
     77
     78
     79
     80int Orxonox::gameInit (void)
     81{
    3882
    3983}
     
    4185
    4286
    43 int Orxonox::gameInit()
     87void Orxonox::display (void)
    4488{
     89  glClear(GL_COLOR_BUFFER_BIT);
     90  glutSwapBuffers();
     91}
    4592
     93
     94
     95void Orxonox::reshape (int w, int h)
     96{
     97  glViewport(0, 0, (GLsizei) w, (GLsizei) h);
     98  glMatrixMode(GL_PROJECTION);
     99  glLoadIdentity();
     100  glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0);
     101  glMatrixMode(GL_MODELVIEW);
     102  glLoadIdentity(); //pb why a second time?
    46103}
    47104
    48105
    49 int main( int argc, char** argv )
     106
     107int main (int argc, char** argv)
    50108
    51   Orxonox orx;
    52   orx.globalInit(argc, argv);
    53   orx.menuInit();
    54  
     109  Orxonox *orx = Orxonox::getInstance();
     110  (*orx).globalInit(argc, argv);
     111  (*orx).menuInit();
     112  glutMainLoop();
    55113  return 0;
    56114}
Note: See TracChangeset for help on using the changeset viewer.