Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

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

Location:
orxonox/trunk/core
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/core/Makefile

    r1849 r1850  
    11
    2 CPLUSPLUS = g++
     2CC = gcc
     3CXX = g++
    34APP_LIB_DEPS = -lglut -lGLU -lGL -lm -L/usr/X11R6/lib -lXt -lX11
    45GL_LIB = libGL.so
     
    89OSMESA_LIB = libOSMesa.so
    910
    10 CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -I/usr/X11R6/include
     11CFLAGS = -O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include
    1112CXXFLAGS = -fPIC -O3
    1213GLUT_CFLAGS = -fexceptions
     
    2526        orxonox \
    2627
     28HEADERS = \
     29        orxonox.h \
     30        data_core.h
     31       
     32SOURCES = \
     33        orxonox.cc \
     34        data_core.cc
     35
     36OBJECTS = \
     37        orxonox.o \
     38        data_tank.o
     39
     40TARGET = orxonox
     41
    2742.SUFFIXES:
    2843.SUFFIXES: .cc
    2944
    30 .cc: $(LIB_DEP)
    31         $(CPLUSPLUS) -I$(INCDIR) $(CFLAGS) $< $(LIBS) -o $@
     45#.cc: $(LIB_DEP)
     46#       $(CXX) -I$(INCDIR) $(CFLAGS) $< $(LIBS) -o $@
    3247
    33 default:
    34 targets: $(PROGS)
     48.cc.o:
     49        $(CXX) -c $(CFLAGS) -I$(INCDIR) -o $@ $<
     50
     51
     52#### build
     53
     54all: $(TARGET)
     55
     56$(TARGET): $(LIB_DEP) $(OBJECTS)
     57        $(CXX) $(LIBS) -o $(TARGET) $(OBJECTS)
     58
     59
     60help:
     61        @echo "Cleaning targets:"
     62        @echo "  clean          - remove most generated files"
     63        @echo ""
     64        @echo "Generic targets:"
     65        @echo "  all            - Build all targets"
     66        @echo ""
     67        @echo "For further info see the README file"
    3568       
    36 
    3769clean:
    3870        rm -rf *.o *~ $(PROGS)
    3971
     72
     73####compile
     74
     75orxonox.o: orxonox.cc \
     76                orxonox.h \
     77
     78data_tank.o: data_tank.cc \
     79                data_tank.h     
     80       
     81#EOF
  • 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}
  • orxonox/trunk/core/orxonox.h

    r1803 r1850  
    22#define ORXONOX_H
    33
     4#define NULL 0
     5
    46class Orxonox {
    57
     8 private:
     9  static Orxonox *singleton_ref;
     10  Orxonox ();
     11  ~Orxonox ();
     12
    613 public:
    7   Orxonox();
    8   ~Orxonox();
    914
    10   int globalInit(int argc, char** argv);
    11   int menuInit();
    12   int gameInit();
     15  static Orxonox* getInstance (void);
    1316
     17  int globalInit (int argc, char** argv);
     18  int menuInit (void);
     19  int gameInit (void);
     20  static void display (void);
     21  static void reshape (int w, int h);
    1422};
    1523
    1624#endif
     25
Note: See TracChangeset for help on using the changeset viewer.