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 "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_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
 

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 dimentionnal space More...
 
void applyTransformation (Position &pos, unsigned sizeFrom, unsigned sizeTo)
 change the size of a Position object 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 35 of file utils.h.

◆ DEBUG_MSG

#define DEBUG_MSG (   X)

Definition at line 34 of file utils.h.

◆ INV_GET_POS

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

Definition at line 24 of file utils.h.

◆ PLAYER1

#define PLAYER1   0

Definition at line 55 of file utils.h.

◆ PLAYER2

#define PLAYER2   1

Definition at line 56 of file utils.h.

◆ PLAYER_HEIGHT

#define PLAYER_HEIGHT   100

Definition at line 18 of file utils.h.

◆ PROJ_LENGTH_FACTOR

#define PROJ_LENGTH_FACTOR   2

Definition at line 19 of file utils.h.

Typedef Documentation

◆ playerID

typedef unsigned playerID

Definition at line 54 of file utils.h.

◆ Position

typedef nsGraphics::Vec2D Position

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 45 of file utils.h.

Function Documentation

◆ applyTransformation()

void applyTransformation ( Position pos,
unsigned  sizeFrom,
unsigned  sizeTo 
)

change the size of a Position object

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 dimentionnal space

Parameters
[in]start1: position of the first point of the first line
[in]end1posision of the last point of the first line
[in]start2: position of the first point of the seconde line
[in]end2posision of the last point of the second line
Returns
true if they are olliding, false elsewise

Definition at line 3 of file utils.cpp.