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
39using namespace std;
40using nsGraphics::RGBAcolor;
41
45enum class WinValue{
46 NOBODY, // should never be used
47 PLAYERS,
49 GOD,
50};
51
52
53typedef nsGraphics::Vec2D Position;
54typedef 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
68bool areLinesColliding(unsigned start1, unsigned end1, unsigned start2, unsigned end2);
69
70// change draw position for a specified size (keeps the same center)
71
78void applyTransformation(Position& pos, unsigned sizeFrom, unsigned sizeTo);
79
80#endif
unsigned playerID
Definition: utils.h:54
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
void applyTransformation(Position &pos, unsigned sizeFrom, unsigned sizeTo)
change the size of a Position object
Definition: utils.cpp:8
nsGraphics::Vec2D Position
Definition: utils.h:53
WinValue
list of win values
Definition: utils.h:45