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<future>
16#include "mingl/mingl.h"
17
18// hardcoded values
19#define PLAYER_HEIGHT 100
20#define PROJ_LENGTH_FACTOR 2
21
22#define INV_GET_SINGLE_POS(i) confData.invadersSize*(i)+confData.invadersDistance*(i)
23
24// Syntax : DEBUG(cout << "hey" << endl)
25// The debug flag defintion has been set here, but normally we would add it to the MakeFile
26//#define DEBUG_FLAG
27
28#ifdef DEBUG_FLAG
29#define DEBUG_MSG(X) cerr << "DEBUG: " << X << endl;
30#define DEBUG_INSTR(X) X;
31#else
32#define DEBUG_MSG(X)
33#define DEBUG_INSTR(X)
34#endif
35
36
37using namespace std;
38using nsGraphics::RGBAcolor;
39
43enum class WinValue{
44 NOBODY, // should never be used
45 PLAYERS,
47 GOD,
48};
49
50
51typedef nsGraphics::Vec2D Position;
52typedef unsigned playerID;
53typedef future<void> Task;
54#define PLAYER1 0
55#define PLAYER2 1
56
57
66bool areLinesColliding(unsigned start1, unsigned end1, unsigned start2, unsigned end2);
67
68// change draw position for a specified size (keeps the same center)
69
76void applyTransformation(Position& pos, unsigned sizeFrom, unsigned sizeTo);
77
78#endif
unsigned playerID
Definition: utils.h:52
future< void > Task
Definition: utils.h:53
bool areLinesColliding(unsigned start1, unsigned end1, unsigned start2, unsigned end2)
tells if 2 lines are colliding in a 1 dimensional space. Didn't want to use Position because of the s...
Definition: utils.cpp:3
void applyTransformation(Position &pos, unsigned sizeFrom, unsigned sizeTo)
change the position object to reflect the top-right position of a "sizeTo"-sized entity,...
Definition: utils.cpp:8
nsGraphics::Vec2D Position
Definition: utils.h:51
WinValue
list of win values
Definition: utils.h:43