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 | |
---|
42 | using namespace std; |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | Orxonox::Orxonox () {} |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | Orxonox::~Orxonox () {} |
---|
51 | |
---|
52 | |
---|
53 | /* this is a singleton class to prevent dublicates */ |
---|
54 | Orxonox* Orxonox::singleton_ref = 0; |
---|
55 | Orxonox* Orxonox::getInstance (void) |
---|
56 | { |
---|
57 | if (singleton_ref == NULL) |
---|
58 | singleton_ref = new Orxonox(); |
---|
59 | return singleton_ref; |
---|
60 | } |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | int 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 | } |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | int Orxonox::menuInit (void) |
---|
79 | { |
---|
80 | glClearColor(0.0, 0.0, 0.0, 0.0); |
---|
81 | } |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | int Orxonox::gameInit (void) |
---|
86 | { |
---|
87 | |
---|
88 | } |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | void Orxonox::display (void) |
---|
93 | { |
---|
94 | glClear(GL_COLOR_BUFFER_BIT); |
---|
95 | glutSwapBuffers(); |
---|
96 | } |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | void Orxonox::reshape (int w, int h) |
---|
101 | { |
---|
102 | glViewport(0, 0, (GLsizei) w, (GLsizei) h); |
---|
103 | glMatrixMode(GL_PROJECTION); |
---|
104 | glLoadIdentity(); |
---|
105 | glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); |
---|
106 | glMatrixMode(GL_MODELVIEW); |
---|
107 | glLoadIdentity(); //pb why a second time? |
---|
108 | } |
---|
109 | |
---|
110 | |
---|
111 | |
---|
112 | int main (int argc, char** argv) |
---|
113 | { |
---|
114 | Orxonox *orx = Orxonox::getInstance(); |
---|
115 | (*orx).globalInit(argc, argv); |
---|
116 | (*orx).menuInit(); |
---|
117 | glutMainLoop(); |
---|
118 | return 0; |
---|
119 | } |
---|