utilies for the game
More...
#include <vector>
#include <future>
#include "mingl/mingl.h"
Go to the source code of this file.
|
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 semantic with x and y More...
|
|
void | applyTransformation (Position &pos, unsigned sizeFrom, unsigned sizeTo) |
| change the position object to reflect the top-right position of a "sizeTo"-sized entity, from a "sizeFrom"-sized entity, keeping the same center More...
|
|
utilies for the game
- Author
- RUBINI Thomas
- Date
- January 2022
- Version
- 1.0
Definition in file utils.h.
◆ DEBUG_INSTR
◆ DEBUG_MSG
◆ INV_GET_SINGLE_POS
#define INV_GET_SINGLE_POS |
( |
|
i | ) |
confData.invadersSize*(i)+confData.invadersDistance*(i) |
◆ PLAYER1
◆ PLAYER2
◆ PLAYER_HEIGHT
#define PLAYER_HEIGHT 100 |
◆ PROJ_LENGTH_FACTOR
#define PROJ_LENGTH_FACTOR 2 |
◆ playerID
◆ Position
◆ Task
typedef future<void> Task |
◆ WinValue
list of win values
Enumerator |
---|
NOBODY | |
PLAYERS | |
INVADERS | |
GOD | |
Definition at line 43 of file utils.h.
◆ applyTransformation()
void applyTransformation |
( |
Position & |
pos, |
|
|
unsigned |
sizeFrom, |
|
|
unsigned |
sizeTo |
|
) |
| |
change the position object to reflect the top-right position of a "sizeTo"-sized entity, from a "sizeFrom"-sized entity, keeping the same center
- Parameters
-
[in,out] | pos | : Position object |
[in] | sizeFrom | current size of the objet |
[in] | sizeTo | : new size of the object |
Definition at line 8 of file utils.cpp.
◆ areLinesColliding()
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 semantic with x and y
- Parameters
-
[in] | start1 | : position of the first point of the first line |
[in] | end1 | position of the last point of the first line |
[in] | start2 | : position of the first point of the seconde line |
[in] | end2 | position of the last point of the second line |
- Returns
- true if they are colliding, false otherwise
Definition at line 3 of file utils.cpp.