SUPER Space invader : Turbo edition DX - VS GOD 1.0.0
A simple space invader ripoff
utils.cpp
Go to the documentation of this file.
1#include "utils.h"
2
3bool areLinesColliding(unsigned start1, unsigned end1, unsigned start2, unsigned end2){
4 return start1 < end2 == start2 < end1;
5 // if it returns true, lines are colliding. I like truth tables
6}
7
8void applyTransformation(Position& pos, unsigned sizeFrom, unsigned sizeTo){
9 pos += Position(sizeFrom/2, sizeFrom/2);
10 pos -= Position(sizeTo/2, sizeTo/2);
11}
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
utilies for the game
nsGraphics::Vec2D Position
Definition: utils.h:51