Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/core/orxonox.cc @ 1858

Last change on this file since 1858 was 1858, checked in by patrick, 20 years ago

orxonox/trunk/core: world draw function

File size: 2.7 KB
Line 
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   ### File Specific:
22   main-programmer: Patrick Boenzli
23   co-programmer:
24*/
25
26
27
28
29
30
31/* class definition header */
32#include "orxonox.h"
33#include "data_tank.h"
34
35/* standard headers */
36#include <iostream>
37#include <cstdio>
38
39/* openGL Headers */
40#include <GL/glut.h>
41
42using namespace std;
43
44
45
46Orxonox::Orxonox () {}
47
48
49
50Orxonox::~Orxonox () {}
51
52
53/* this is a singleton class to prevent dublicates */
54Orxonox* Orxonox::singleton_ref = 0;
55Orxonox* Orxonox::getInstance (void)
56{
57  if (singleton_ref == NULL)
58    singleton_ref = new Orxonox();
59  return singleton_ref;
60}
61
62
63
64int Orxonox::globalInit (int argc, char** argv) 
65{
66  glutInit(&argc, argv);
67  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
68  glutInitWindowSize(500, 500);
69  glutInitWindowPosition(100, 100);
70  glutCreateWindow("orxOnox");
71  /* window event dispatchers */
72  glutDisplayFunc(display);
73  glutReshapeFunc(reshape);
74  glutKeyboardFunc(keyboard);
75}
76
77
78
79int Orxonox::menuInit (void)
80{
81  glClearColor(0.0, 0.0, 0.0, 0.0);
82}
83
84
85
86int Orxonox::gameInit (void) 
87{
88
89}
90
91
92void Orxonox::keyboard(unsigned char key, int x, int y)
93{
94  switch(key) {
95  case 27:
96    exit 0;
97    break;
98  }
99}
100
101
102void Orxonox::display (void) 
103{
104  glClear(GL_COLOR_BUFFER_BIT);
105  glutSwapBuffers();
106} 
107
108
109
110void Orxonox::reshape (int w, int h)
111{
112  glViewport(0, 0, (GLsizei) w, (GLsizei) h);
113  glMatrixMode(GL_PROJECTION);
114  glLoadIdentity();
115  glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0);
116  glMatrixMode(GL_MODELVIEW);
117  glLoadIdentity(); //pb why a second time?
118}
119
120
121
122int main (int argc, char** argv) 
123{ 
124  Orxonox *orx = Orxonox::getInstance();
125  (*orx).globalInit(argc, argv);
126  (*orx).menuInit();
127
128  World* wd = new World;
129  Player* pl = new Player;
130  (*wd).addPlayer(pl);
131  (*wd).addPlayer(pl);
132  (*wd).addPlayer(pl);
133  (*wd).addPlayer(pl);
134
135  NPC* nl = new NPC;
136  (*wd).addNPC(nl);
137  (*wd).addNPC(nl);
138  (*wd).addNPC(nl);
139  (*wd).addNPC(nl);
140  (*wd).addNPC(nl);
141  (*wd).addNPC(nl);
142  (*wd).testThaTest();
143
144  glutMainLoop(); 
145  return 0;
146}
Note: See TracBrowser for help on using the repository browser.