-
Notifications
You must be signed in to change notification settings - Fork 2
/
bh.h
161 lines (140 loc) · 4.03 KB
/
bh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* --------------------------------------------------------------------
EXTREME TUXRACER
Copyright (C) 1999-2001 Jasmin F. Patry (Tuxracer)
Copyright (C) 2010 Extreme Tuxracer Team
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
of the License, 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.
---------------------------------------------------------------------*/
#ifndef BH_H
#define BH_H
// --------------------------------------------------------------------
// compiler flags
// --------------------------------------------------------------------
#define HAVE_SDL
#define HAVE_SDL_MIXER
#define HAVE_SDL_IMAGE
#define HAVE_SDL_JOYSTICK
#define TIME_WITH_SYS_TIME
#define HAVE_GETCWD
#define HAVE_GETTIMEOFDAY
#define HAVE_GL_GLEXT_H
#define HAVE_GL_GLX_H
//#define HAVE_GL_GLES1
#define HAVE_SYS_TIME_H
#define USE_STENCIL_BUFFER
// --------------------------------------------------------------------
// includes
// --------------------------------------------------------------------
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <stdarg.h>
#include <float.h>
#include <sys/stat.h>
#include <map>
#include <list>
#include <string>
#include <iostream>
#if defined ( OS_LINUX )
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <dirent.h>
#include <sys/time.h>
#define SEP "/"
#elif defined ( OS_WIN32_MINGW )
#define SEP "/"
#include <dirent.h>
#elif defined ( OS_WIN32_MSC )
#include <io.h>
#include <direct.h>
#include <windows.h>
#pragma warning (disable:4244)
#pragma warning (disable:4305)
#pragma warning (disable:4761)
#define SEP "\\"
#elif defined ( OS_WIN32_NATIVE )
#include <io.h>
#include <direct.h>
#include <windows.h>
#define SEP "\\"
#define snprintf _snprintf
#define mkdir(x,y) _mkdir(x)
#elif defined ( OS_MAC )
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <dirent.h>
#include <sys/time.h>
#define SEP "/"
#endif
#if defined ( OS_MAC )
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#elif defined ( OS_WIN32_MINGW )
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
#elif defined ( HAVE_GL_GLES1 )
#include <EGL/egl.h>
#include <GLES/gl.h>
#include "SDL2/SDL_syswm.h"
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#if defined ( OS_MAC )
#include "SDL2/SDL.h"
#include "SDL2/SDL_joystick.h"
#include "SDL2_image/SDL_image.h"
#include "SDL2_mixer/SDL_mixer.h"
#else
#include "SDL2/SDL.h"
#include "SDL2/SDL_joystick.h"
#include "SDL2/SDL_image.h"
#include "SDL2/SDL_mixer.h"
#endif
// --------------------------------------------------------------------
// defines
// --------------------------------------------------------------------
#define PROG_NAME "ETR"
#define PACKAGE "etr"
#define VERSION "0.6"
#define WINDOW_TITLE "Extreme Tux Racer " VERSION
#define PROG_DIR "/usr/local/games/etr-bh"
// --------------------------------------------------------------------
// GLES -> GL conversion
// --------------------------------------------------------------------
#if defined ( HAVE_GL_GLES1 )
#define GL_CLAMP GL_CLAMP_TO_EDGE
#define glOrtho glOrthof
#define glFrustum glFrustumf
inline void gluPerspective( double fovy, double aspect, double zNear, double zFar )
{
GLfloat ymax = zNear * tan( fovy * M_PI / 360.0 );
GLfloat ymin = -ymax;
GLfloat xmin = ymin * aspect;
GLfloat xmax = ymax * aspect;
glFrustumf( xmin, xmax, ymin, ymax, zNear, zFar );
}
#endif
using namespace std;
#include "etr_types.h"
#include "mathlib.h"
#include "common.h"
#include "game_config.h"
#include "winsys.h"
#include "physics.h"
extern TGameData g_game;
#endif