SUPER Space invader : Turbo edition DX - VS GOD
1.0.0
A simple space invader ripoff
utils.h
Go to the documentation of this file.
1
11
#ifndef GUARD_UTILS_H
12
#define GUARD_UTILS_H
13
14
#include<vector>
15
#include "mingl/mingl.h"
16
17
// hardcoded values
18
#define PLAYER_HEIGHT 100
19
#define PROJ_LENGTH_FACTOR 2
20
21
/* Copy constructuor and assignement are disabled in most of
22
* our classes so we're sure we can't accidentally copy players
23
* (We need to explicitly specify the default constructor)*/
24
#define INV_GET_POS(i) confData.invadersSize*(i)+confData.invadersDistance*(i)
25
26
// Syntax : DEBUG(cout << "hey" << endl)
27
// The debug flag defintion has been set here, but normally we would add it to the MakeFile
28
//#define DEBUG_FLAG
29
30
#ifdef DEBUG_FLAG
31
#define DEBUG_MSG(X) cerr << "DEBUG: "
<< X << endl;
32
#define DEBUG_INSTR(X) X;
33
#else
34
#define DEBUG_MSG(X)
35
#define DEBUG_INSTR(X)
36
#endif
37
38
39
using namespace
std;
40
using
nsGraphics::RGBAcolor;
41
45
enum class
WinValue
{
46
NOBODY
,
// should never be used
47
PLAYERS
,
48
INVADERS
,
49
GOD
,
50
};
51
52
53
typedef
nsGraphics::Vec2D
Position
;
54
typedef
unsigned
playerID
;
55
#define PLAYER1 0
56
#define PLAYER2 1
57
58
// didn't want to use Position because of the semantic with x and y
59
68
bool
areLinesColliding
(
unsigned
start1,
unsigned
end1,
unsigned
start2,
unsigned
end2);
69
70
// change draw position for a specified size (keeps the same center)
71
78
void
applyTransformation
(
Position
& pos,
unsigned
sizeFrom,
unsigned
sizeTo);
79
80
#endif
playerID
unsigned playerID
Definition:
utils.h:54
areLinesColliding
bool areLinesColliding(unsigned start1, unsigned end1, unsigned start2, unsigned end2)
tells if 2 lines are colliding in a 1 dimentionnal space
Definition:
utils.cpp:3
applyTransformation
void applyTransformation(Position &pos, unsigned sizeFrom, unsigned sizeTo)
change the size of a Position object
Definition:
utils.cpp:8
Position
nsGraphics::Vec2D Position
Definition:
utils.h:53
WinValue
WinValue
list of win values
Definition:
utils.h:45
WinValue::GOD
@ GOD
WinValue::INVADERS
@ INVADERS
WinValue::NOBODY
@ NOBODY
WinValue::PLAYERS
@ PLAYERS
headers
utils.h
Generated by
1.9.3