SUPER Space invader : Turbo edition DX - VS GOD 1.0.0
A simple space invader ripoff
utils.h File Reference

utilies for the game More...

#include <vector>
#include <future>
#include "mingl/mingl.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PLAYER_HEIGHT   100
 
#define PROJ_LENGTH_FACTOR   2
 
#define INV_GET_SINGLE_POS(i)   confData.invadersSize*(i)+confData.invadersDistance*(i)
 
#define DEBUG_MSG(X)
 
#define DEBUG_INSTR(X)
 
#define PLAYER1   0
 
#define PLAYER2   1
 

Typedefs

typedef nsGraphics::Vec2D Position
 
typedef unsigned playerID
 
typedef future< void > Task
 

Enumerations

enum class  WinValue { NOBODY , PLAYERS , INVADERS , GOD }
 list of win values More...
 

Functions

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...
 

Detailed Description

utilies for the game

Author
RUBINI Thomas
Date
January 2022
Version
1.0

Definition in file utils.h.

Macro Definition Documentation

◆ DEBUG_INSTR

#define DEBUG_INSTR (   X)

Definition at line 33 of file utils.h.

◆ DEBUG_MSG

#define DEBUG_MSG (   X)

Definition at line 32 of file utils.h.

◆ INV_GET_SINGLE_POS

#define INV_GET_SINGLE_POS (   i)    confData.invadersSize*(i)+confData.invadersDistance*(i)

Definition at line 22 of file utils.h.

◆ PLAYER1

#define PLAYER1   0

Definition at line 54 of file utils.h.

◆ PLAYER2

#define PLAYER2   1

Definition at line 55 of file utils.h.

◆ PLAYER_HEIGHT

#define PLAYER_HEIGHT   100

Definition at line 19 of file utils.h.

◆ PROJ_LENGTH_FACTOR

#define PROJ_LENGTH_FACTOR   2

Definition at line 20 of file utils.h.

Typedef Documentation

◆ playerID

typedef unsigned playerID

Definition at line 52 of file utils.h.

◆ Position

typedef nsGraphics::Vec2D Position

Definition at line 51 of file utils.h.

◆ Task

typedef future<void> Task

Definition at line 53 of file utils.h.

Enumeration Type Documentation

◆ WinValue

enum class WinValue
strong

list of win values

Enumerator
NOBODY 
PLAYERS 
INVADERS 
GOD 

Definition at line 43 of file utils.h.

Function Documentation

◆ 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]sizeFromcurrent 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]end1position of the last point of the first line
[in]start2: position of the first point of the seconde line
[in]end2position of the last point of the second line
Returns
true if they are colliding, false otherwise

Definition at line 3 of file utils.cpp.