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
|
#ifndef COMMON_H
#define COMMON_H
/*
* Include basic C/C++ facilities
*/
#include <iostream>
#include <cstdlib>
#include <vector>
#include <math.h>
/*
* Include GLEW and the SDL 2 headers
*/
#define GLEW_STATIC
#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
#include <string>
#include <fstream>
#ifdef __WIN32__
typedef unsigned int uint;
#undef near
#endif
/*
* Include file headers
*/
#include <Texture.h>
/*
* This flag lets the compiler know that we are using shaders
*/
#define SHADERSere
/*
* Create a basic 2-point structure for coordinate saving
*/
typedef struct {
float x;
float y;
} vec2;
/*
* Define the game's name (displayed in the window title),
* the desired window dimensions,
* and whether or not we want the window to be fullscreen.
*/
#define GAME_NAME "Independent Study v.0.3 alpha"
#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720
//#define FULLSCREEN
/*
* Define the length of a single HLINE.
*
* The game has a great amount of elements that need to be drawn or detected, and having each
* of them use specific hard-coded numbers would be painful to debug. As a solution, this
* definition was made. Every item being drawn to the screen and most object detection/physic
* handling is done based off of this number. Increasing it will give the game a zoomed-in
* feel, while decreasing it will do the opposite.
*
*/
#define HLINE 3 // 3 as in 3 pixels
/*
* Define 'our' random number generation library. Eventually these macros will be replaced
* with actual functions.
*
*/
#define initRand(s) srand(s)
#define getRand() rand()
/*
* At the bottom of this header is the prototype for DEBUG_prints, which writes a formatted
* string to the console containing the callee's file and line number. This macro simplifies
* it to a simple printf call.
*
* DEBUG must be defined for this macro to function.
*
*/
#define DEBUG_printf( message, ...) DEBUG_prints(__FILE__, __LINE__, message, __VA_ARGS__ )
/*
* References the variable in main.cpp, used for smoother drawing.
*/
extern unsigned int deltaTime;
/*
* References the variable in main.cpp, used for drawing with the player
*/
extern vec2 offset;
/*
* Loads an image from the given file path and attempts to make a texture out of it. The
* resulting GLuint is returned (used to recall the texture in glBindTexture).
*
*/
//GLuint loadTexture(const char *fileName);
/*
* Prints a formatted debug message to the console, along with the callee's file and line
* number.
*
*/
void DEBUG_prints(const char* file, int line, const char *s,...);
void safeSetColor(int r,int g,int b);
void safeSetColorA(int r,int g,int b,int a);
#endif // COMMON_H
|