just a save commit bc I know I'm going to mess everything

This commit is contained in:
Thomas 2021-12-26 15:34:32 +01:00
parent 69ba7221d6
commit 14fef65b95
No known key found for this signature in database
GPG Key ID: E538821A6CDFDAD7
14 changed files with 149 additions and 87 deletions

3
README
View File

@ -5,3 +5,6 @@ Nommage en anglais
Pas de fonctions de +100 lignes Pas de fonctions de +100 lignes
écran : constante 1280x720 écran : constante 1280x720
Reminder : les missiles sont tirés par les envahisseurs, et les torpilles par le joueur

View File

@ -13,6 +13,12 @@ public:
unsigned alien_size; unsigned alien_size;
unsigned distance; unsigned distance;
unsigned missile_width;
unsigned missile_length; // auto defined from width
unsigned torpedo_width;
unsigned torpedo_length; // auto defined from width
unsigned player_width;
bool loadConfig(); bool loadConfig();
}; };

View File

@ -1,32 +1,36 @@
#ifndef GUARD_GAME #ifndef GUARD_GAME_H
#define GUARD_GAME #define GUARD_GAME_H
#include <vector> #include <vector>
#include "mingl/mingl.h" #include "mingl/mingl.h"
#include "drawEngine.h" #include "pixelManager.h"
#include "config.h" #include "config.h"
#include "utils.h" #include "utils.h"
#include "pos.h" #include "position.h"
using namespace std; using namespace std;
class Game { class Game {
private: private:
DrawEngine drawer; PixelManager pm;
Config conf; Config conf;
unsigned baseX; unsigned baseX;
unsigned baseY; unsigned baseY;
aliensGrid grid; aliensGrid grid;
vector<pos> missiles; vector<missile> missiles;
vector<pos> torpedos; vector<torpedo> torpedos;
pos player; unsigned playerX;
void managePlayer(); void managePlayer();
bool manageInvaders(); bool manageInvaders();
void display(); void display();
// collision thingies
unsigned manageAllCollisions(); unsigned manageAllCollisions();
void remCollidingProjectiles(); void remCollidingProjectiles();
void moveMissiles(); void moveMissiles();
void moveTorpedos(); void moveTorpedos();
bool checkMissilesAndPlayer();
bool checkTorpedosAndInvaders();
public: public:
// in case someone wants to mess with the code, here's a minimal API, costs nothing to us // in case someone wants to mess with the code, here's a minimal API, costs nothing to us
Game(); Game();

View File

@ -7,16 +7,18 @@
#include "mingl/shape/rectangle.h" #include "mingl/shape/rectangle.h"
#include "mingl/shape/circle.h" #include "mingl/shape/circle.h"
class DrawEngine{ class PixelManager{
public: public:
MinGL window; MinGL window;
DrawEngine(); PixelManager();
void dessinerInvader1(const nsGraphics::Vec2D& baseVector); void dessinerInvader1(const nsGraphics::Vec2D& baseVector);
void dessinerInvader2(const nsGraphics::Vec2D& baseVector); void dessinerInvader2(const nsGraphics::Vec2D& baseVector);
void dessinerInvader3(const nsGraphics::Vec2D& baseVector); void dessinerInvader3(const nsGraphics::Vec2D& baseVector);
unsigned showInitialMenu(); unsigned showInitialMenu();
unsigned showDeathMenu(); unsigned showDeathMenu();
unsigned getScreenHeight();
unsigned getScreenWidth();
}; };

View File

@ -1,11 +0,0 @@
#ifndef SPACE_POS_H
#define SPACE_POS_H
#include<mingl/mingl.h>
class pos : public nsGraphics::Vec2D {
public:
bool isColliding(pos& p, unsigned rx, unsigned ry);
};
#endif //SPACE_POS_H

11
headers/position.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef SPACE_POSITION_H
#define SPACE_POSITION_H
#include<mingl/mingl.h>
class position : public nsGraphics::Vec2D {
public:
bool isColliding(position& p, unsigned rx, unsigned ry);
};
#endif //SPACE_POSITION_H

View File

@ -1,18 +1,27 @@
#ifndef SPACE_STRUCTS #ifndef SPACE_STRUCTS_H
#define SPACE_STRUCTS #define SPACE_STRUCTS_H
#include<vector> #include<vector>
#include<mingl/mingl.h> #include<mingl/mingl.h>
#include "position.h"
// hardcoded values
#define PLAYER_WINS 1 #define PLAYER_WINS 1
#define INVADERS_WINS 2 #define INVADERS_WINS 2
#define PLAYER_HEIGHT 100
#define PLAYER_HEIGHT 100
#define PROJ_LENGTH_FACTOR 2
using namespace std; using namespace std;
#define PLAYER_HEIGHT 100
typedef unsigned Alien; typedef unsigned Alien;
typedef vector<Alien> aliensLine; typedef vector<Alien> aliensLine;
typedef vector<aliensLine> aliensGrid; typedef vector<aliensLine> aliensGrid;
typedef position missile;
typedef position torpedo;
// didn't want to use position because of the semantic with x and y
bool lineCollideCheck(unsigned start1, unsigned end1, unsigned start2, unsigned end2);
#endif #endif

View File

@ -37,7 +37,7 @@ public:
/** /**
* @brief Constructeur de recopie pour la classe Vec2D * @brief Constructeur de recopie pour la classe Vec2D
* @param[in] pos : Vec2D a copier * @param[in] pos : Vec2D a copier
* @fn Vec2D(const Vec2D& pos); * @fn Vec2D(const Vec2D& position);
*/ */
Vec2D(const Vec2D& pos); Vec2D(const Vec2D& pos);
@ -56,21 +56,21 @@ public:
/** /**
* @brief Opérateur d'addition * @brief Opérateur d'addition
* @param[in] pos : Vecteur a additionner * @param[in] pos : Vecteur a additionner
* @fn Vec2D operator+(const Vec2D& pos) const; * @fn Vec2D operator+(const Vec2D& position) const;
*/ */
Vec2D operator+(const Vec2D& pos) const; Vec2D operator+(const Vec2D& pos) const;
/** /**
* @brief Opérateur de soustraction * @brief Opérateur de soustraction
* @param[in] pos : Vecteur a soustraire * @param[in] pos : Vecteur a soustraire
* @fn Vec2D operator-(const Vec2D& pos) const; * @fn Vec2D operator-(const Vec2D& position) const;
*/ */
Vec2D operator-(const Vec2D& pos) const; Vec2D operator-(const Vec2D& pos) const;
/** /**
* @brief Opérateur de multiplication * @brief Opérateur de multiplication
* @param[in] pos : Vecteur a multiplier * @param[in] pos : Vecteur a multiplier
* @fn Vec2D operator*(const Vec2D& pos) const; * @fn Vec2D operator*(const Vec2D& position) const;
*/ */
Vec2D operator*(const Vec2D& pos) const; Vec2D operator*(const Vec2D& pos) const;
@ -84,7 +84,7 @@ public:
/** /**
* @brief Opérateur de division * @brief Opérateur de division
* @param[in] pos : Vecteur a diviser * @param[in] pos : Vecteur a diviser
* @fn Vec2D operator/(const Vec2D& pos) const; * @fn Vec2D operator/(const Vec2D& position) const;
*/ */
Vec2D operator/(const Vec2D& pos) const; Vec2D operator/(const Vec2D& pos) const;
@ -98,21 +98,21 @@ public:
/** /**
* @brief Opérateur modulo * @brief Opérateur modulo
* @param[in] pos : Vecteur avec lequel faire un modulo * @param[in] pos : Vecteur avec lequel faire un modulo
* @fn Vec2D operator%(const Vec2D& pos) const; * @fn Vec2D operator%(const Vec2D& position) const;
*/ */
Vec2D operator%(const Vec2D& pos) const; Vec2D operator%(const Vec2D& pos) const;
/** /**
* @brief Opérateur d'égalité * @brief Opérateur d'égalité
* @param[in] pos : Vecteur avec lequel vérifier l'égalité * @param[in] pos : Vecteur avec lequel vérifier l'égalité
* @fn bool operator==(const Vec2D& pos) const; * @fn bool operator==(const Vec2D& position) const;
*/ */
bool operator==(const Vec2D& pos) const; bool operator==(const Vec2D& pos) const;
/** /**
* @brief Opérateur d'inégalité * @brief Opérateur d'inégalité
* @param[in] pos : Vecteur avec lequel vérifier l'inégalité * @param[in] pos : Vecteur avec lequel vérifier l'inégalité
* @fn bool operator!=(const Vec2D& pos) const; * @fn bool operator!=(const Vec2D& position) const;
*/ */
bool operator!=(const Vec2D& pos) const; bool operator!=(const Vec2D& pos) const;
@ -120,7 +120,7 @@ public:
* @brief Opérateur de stricte infériorité * @brief Opérateur de stricte infériorité
* (Vérifie la stricte infériorité de la magnitude des deux vecteurs) * (Vérifie la stricte infériorité de la magnitude des deux vecteurs)
* @param[in] pos : Vecteur avec lequel vérifier la stricte infériorité * @param[in] pos : Vecteur avec lequel vérifier la stricte infériorité
* @fn bool operator<(const Vec2D& pos) const; * @fn bool operator<(const Vec2D& position) const;
*/ */
bool operator<(const Vec2D& pos) const; bool operator<(const Vec2D& pos) const;
@ -128,7 +128,7 @@ public:
* @brief Opérateur de stricte supériorité * @brief Opérateur de stricte supériorité
* (Vérifie la stricte supériorité de la magnitude des deux vecteurs) * (Vérifie la stricte supériorité de la magnitude des deux vecteurs)
* @param[in] pos : Vecteur avec lequel vérifier la stricte supériorité * @param[in] pos : Vecteur avec lequel vérifier la stricte supériorité
* @fn bool operator>(const Vec2D& pos) const; * @fn bool operator>(const Vec2D& position) const;
*/ */
bool operator>(const Vec2D& pos) const; bool operator>(const Vec2D& pos) const;
@ -136,7 +136,7 @@ public:
* @brief Opérateur d'infériorité * @brief Opérateur d'infériorité
* (Vérifie l'infériorité de la magnitude des deux vecteurs) * (Vérifie l'infériorité de la magnitude des deux vecteurs)
* @param[in] pos : Vecteur avec lequel vérifier l'infériorité * @param[in] pos : Vecteur avec lequel vérifier l'infériorité
* @fn bool operator<=(const Vec2D& pos) const; * @fn bool operator<=(const Vec2D& position) const;
*/ */
bool operator<=(const Vec2D& pos) const; bool operator<=(const Vec2D& pos) const;
@ -144,49 +144,49 @@ public:
* @brief Opérateur de supériorité * @brief Opérateur de supériorité
* (Vérifie la supériorité de la magnitude des deux vecteurs) * (Vérifie la supériorité de la magnitude des deux vecteurs)
* @param[in] pos : Vecteur avec lequel vérifier la supériorité * @param[in] pos : Vecteur avec lequel vérifier la supériorité
* @fn bool operator>=(const Vec2D& pos) const; * @fn bool operator>=(const Vec2D& position) const;
*/ */
bool operator>=(const Vec2D& pos) const; bool operator>=(const Vec2D& pos) const;
/** /**
* @brief Opérateur d'assignement * @brief Opérateur d'assignement
* @param[in] pos : Vecteur source * @param[in] pos : Vecteur source
* @fn Vec2D& operator=(const Vec2D& pos); * @fn Vec2D& operator=(const Vec2D& position);
*/ */
Vec2D& operator=(const Vec2D& pos); Vec2D& operator=(const Vec2D& pos);
/** /**
* @brief Opérateur d'addition avec assignement * @brief Opérateur d'addition avec assignement
* @param[in] pos : Vecteur avec lequel additionner le vecteur actuel * @param[in] pos : Vecteur avec lequel additionner le vecteur actuel
* @fn Vec2D& operator+=(const Vec2D& pos); * @fn Vec2D& operator+=(const Vec2D& position);
*/ */
Vec2D& operator+=(const Vec2D& pos); Vec2D& operator+=(const Vec2D& pos);
/** /**
* @brief Opérateur de soustraction avec assignement * @brief Opérateur de soustraction avec assignement
* @param[in] pos : Vecteur avec lequel soustraire le vecteur actuel * @param[in] pos : Vecteur avec lequel soustraire le vecteur actuel
* @fn Vec2D& operator-=(const Vec2D& pos); * @fn Vec2D& operator-=(const Vec2D& position);
*/ */
Vec2D& operator-=(const Vec2D& pos); Vec2D& operator-=(const Vec2D& pos);
/** /**
* @brief Opérateur de multiplication avec assignement * @brief Opérateur de multiplication avec assignement
* @param[in] pos : Vecteur avec lequel multiplier le vecteur actuel * @param[in] pos : Vecteur avec lequel multiplier le vecteur actuel
* @fn Vec2D& operator*=(const Vec2D& pos); * @fn Vec2D& operator*=(const Vec2D& position);
*/ */
Vec2D& operator*=(const Vec2D& pos); Vec2D& operator*=(const Vec2D& pos);
/** /**
* @brief Opérateur de division avec assignement * @brief Opérateur de division avec assignement
* @param[in] pos : Vecteur avec lequel diviser le vecteur actuel * @param[in] pos : Vecteur avec lequel diviser le vecteur actuel
* @fn Vec2D& operator/=(const Vec2D& pos); * @fn Vec2D& operator/=(const Vec2D& position);
*/ */
Vec2D& operator/=(const Vec2D& pos); Vec2D& operator/=(const Vec2D& pos);
/** /**
* @brief Opérateur modulo avec assignement * @brief Opérateur modulo avec assignement
* @param[in] pos : Vecteur avec lequel faire un modulo sur le vecteur actuel * @param[in] pos : Vecteur avec lequel faire un modulo sur le vecteur actuel
* @fn Vec2D& operator%=(const Vec2D& pos); * @fn Vec2D& operator%=(const Vec2D& position);
*/ */
Vec2D& operator%=(const Vec2D& pos); Vec2D& operator%=(const Vec2D& pos);

View File

@ -17,7 +17,7 @@ void Game::managedGames() {
} }
void Game::initialMenuHandler(){ void Game::initialMenuHandler(){
switch(drawer.showInitialMenu()){ switch(pm.showInitialMenu()){
case 0:{ // play case 0:{ // play
return; return;
} }
@ -26,7 +26,7 @@ void Game::initialMenuHandler(){
} }
void Game::deathMenuHandler(){ void Game::deathMenuHandler(){
switch(drawer.showDeathMenu()){ switch(pm.showDeathMenu()){
case 0:{ // play case 0:{ // play
return; return;
} }
@ -41,8 +41,7 @@ void Game::deathMenuHandler(){
unsigned Game::playGame(){ // returns when game is finished unsigned Game::playGame(){ // returns when game is finished
// INIT // INIT
grid = conf.grid; // will copy the vector grid = conf.grid; // will copy the vector
player.setX() playerX = 0;
player.setY()
// GAMELOOP // GAMELOOP
while(true){ while(true){
@ -60,7 +59,7 @@ unsigned Game::playGame(){ // returns when game is finished
void Game::display() { void Game::display() {
for (unsigned i = 0; i < this->grid.size(); ++i){ for (unsigned i = 0; i < this->grid.size(); ++i){
for (unsigned j = 0; j < this->grid[0].size(); ++j){ for (unsigned j = 0; j < this->grid[0].size(); ++j){
drawer.dessinerInvader1(nsGraphics::Vec2D( pm.dessinerInvader1(nsGraphics::Vec2D(
baseX+j*conf.alien_size+j*conf.distance, baseX+j*conf.alien_size+j*conf.distance,
baseY+i*conf.alien_size+i*conf.distance baseY+i*conf.alien_size+i*conf.distance
)); ));

View File

@ -1,4 +1,8 @@
#include "game.h" #include "game.h"
#define MISSILE_SPEED 5
#define TORPEDO_SPEED MISSILE_SPEED
/** Makes the player play once /** Makes the player play once
*/ */
void Game::managePlayer(){ void Game::managePlayer(){
@ -14,63 +18,87 @@ bool Game::manageInvaders(){
} }
/** makes projectile smove, and manage collisions between everything /** makes projectiles move, and manage collisions between everything
* *
* @return 1 if the invaders are all dead, 2 if the player is dead, else 0 * @return 1 if the invaders are all dead, 2 if the player is dead, else 0
*/ */
void Game::remCollidingProjectiles(){ void Game::remCollidingProjectiles(){
auto i = missiles.begin(); auto miss = missiles.begin();
auto j = torpedos.begin(); auto tor = torpedos.begin();
while(i!=missiles.end()){ while(miss != missiles.end()){
bool flag = true; bool wasColling = false;
while(j!=torpedos.end()){ while(tor != torpedos.end()){
if(*i==*j){
missiles.erase(i); // missiles can't be right under torpedos, so that must means they are colliding in Y
torpedos.erase(j); if(miss->getY()+conf.missile_length<tor->getY()){
flag = false;
}
if(lineCollideCheck( // now check if they collide in X
miss->getX(), miss->getX()+conf.missile_width,
tor->getX(), tor->getX()+conf.torpedo_width)){
missiles.erase(miss);
torpedos.erase(tor);
wasColling = true;
break; break;
} }
++j; ++tor;
} }
if(flag)++i; /* if it was colling, it was removed and his position is now replaced by the next.
* Else, go to the next
*/
if(!wasColling)++miss;
} }
} }
void Game::moveMissiles() { void Game::moveMissiles() {
auto i = missiles.begin(); auto miss = missiles.begin();
while (i != missiles.end()) { while (miss != missiles.end()) {
if (i->getY() == 0)missiles.erase(i); if (miss->getY() >= pm.getScreenHeight())missiles.erase(miss);
else if (PLAYER_HEIGHT(me, *i))return INVADERS_WINS;
else { else {
++(i->line); miss->setY(miss->getY()+MISSILE_SPEED);
++i; ++miss;
} }
} }
} }
void Game::moveTorpedos() { void Game::moveTorpedos() {
auto i = torpedos.begin(); auto tor = torpedos.begin();
while (i != torpedos.end()) { while (tor != torpedos.end()) {
i->setY(i->getY()-1); if (tor->getY() <= 0)torpedos.erase(tor); // TODO maybe wait for it to be 100% offscreen
if (i->getY() == NB_LIGNES)torpedo.erase(i); else{
else if (contains(game.invader, *i))return PLAYER_WINS; tor->setY(tor->getY() - TORPEDO_SPEED);
else ++i; ++tor;
}
} }
} }
bool Game::checkMissilesAndPlayer() {
for(missile& miss : missiles){
if(miss.getY()<=PLAYER_HEIGHT){ // colliding on Y
if(lineCollideCheck( // now check collision on X
miss.getX(), miss.getX()+conf.missile_width,
playerX, playerX+conf.player_width)){
return true;
}
}
}
return false;
}
bool Game::checkTorpedosAndInvaders() {
return false;
}
unsigned Game::manageAllCollisions() { unsigned Game::manageAllCollisions() {
moveMissiles(); moveMissiles();
if(checkMissilesAndPlayer())return INVADERS_WINS;
remCollidingProjectiles(); remCollidingProjectiles();
moveTorpedos(); moveTorpedos();
remCollidingProjectiles(); remCollidingProjectiles();
if(checkMissilesAndPlayer())return INVADERS_WINS;
if(checkTorpedosAndInvaders())return PLAYER_WINS;
return 0; return 0;
} }

View File

@ -5,5 +5,6 @@ using namespace std;
int main(){ int main(){
Game g; Game g;
g.managedGames(); g.managedGames();
return 0; return 0;
} }

View File

@ -1,13 +1,13 @@
#include "drawEngine.h" #include "pixelManager.h"
#define WININIT window("space invader du turfu ma gueule", nsGraphics::Vec2D(1280, 720), nsGraphics::Vec2D(128, 128), nsGraphics::KBlack) #define WININIT window("space invader du turfu ma gueule", nsGraphics::Vec2D(1280, 720), nsGraphics::Vec2D(128, 128), nsGraphics::KBlack)
DrawEngine::DrawEngine() : WININIT { PixelManager::PixelManager() : WININIT {
window.initGlut(); window.initGlut();
window.initGraphic(); window.initGraphic();
} }
void DrawEngine::dessinerInvader1(const nsGraphics::Vec2D& baseVector){ void PixelManager::dessinerInvader1(const nsGraphics::Vec2D& baseVector){
window << nsShape::Circle(nsGraphics::Vec2D(50, 50)+baseVector, 50, nsGraphics::KGray); window << nsShape::Circle(nsGraphics::Vec2D(50, 50)+baseVector, 50, nsGraphics::KGray);
window << nsShape::Circle(nsGraphics::Vec2D(60, 50)+baseVector, 50, nsGraphics::KGray); window << nsShape::Circle(nsGraphics::Vec2D(60, 50)+baseVector, 50, nsGraphics::KGray);
window << nsShape::Triangle(nsGraphics::Vec2D(35, 50)+baseVector, nsGraphics::Vec2D(15, 25)+baseVector, nsGraphics::Vec2D(15, 75)+baseVector, nsGraphics::KBlack); window << nsShape::Triangle(nsGraphics::Vec2D(35, 50)+baseVector, nsGraphics::Vec2D(15, 25)+baseVector, nsGraphics::Vec2D(15, 75)+baseVector, nsGraphics::KBlack);
@ -18,7 +18,7 @@ void DrawEngine::dessinerInvader1(const nsGraphics::Vec2D& baseVector){
} }
void DrawEngine::dessinerInvader2(const nsGraphics::Vec2D& baseVector){ void PixelManager::dessinerInvader2(const nsGraphics::Vec2D& baseVector){
window << nsShape::Circle(nsGraphics::Vec2D(50, 50)+baseVector, 50, nsGraphics::KRed); window << nsShape::Circle(nsGraphics::Vec2D(50, 50)+baseVector, 50, nsGraphics::KRed);
window << nsShape::Circle(nsGraphics::Vec2D(60, 50)+baseVector, 50, nsGraphics::KRed); window << nsShape::Circle(nsGraphics::Vec2D(60, 50)+baseVector, 50, nsGraphics::KRed);
window << nsShape::Rectangle(nsGraphics::Vec2D(25, 30)+baseVector, nsGraphics::Vec2D(45, 40)+baseVector, nsGraphics::KBlack); window << nsShape::Rectangle(nsGraphics::Vec2D(25, 30)+baseVector, nsGraphics::Vec2D(45, 40)+baseVector, nsGraphics::KBlack);
@ -26,7 +26,7 @@ void DrawEngine::dessinerInvader2(const nsGraphics::Vec2D& baseVector){
window << nsShape::Rectangle(nsGraphics::Vec2D(35, 65)+baseVector, nsGraphics::Vec2D(75, 72)+baseVector, nsGraphics::KBlack); window << nsShape::Rectangle(nsGraphics::Vec2D(35, 65)+baseVector, nsGraphics::Vec2D(75, 72)+baseVector, nsGraphics::KBlack);
} }
void DrawEngine::dessinerInvader3(const nsGraphics::Vec2D& baseVector){ void PixelManager::dessinerInvader3(const nsGraphics::Vec2D& baseVector){
window << nsShape::Circle(nsGraphics::Vec2D(60, 50)+baseVector, 50, nsGraphics::KGreen); window << nsShape::Circle(nsGraphics::Vec2D(60, 50)+baseVector, 50, nsGraphics::KGreen);
window << nsShape::Circle(nsGraphics::Vec2D(50, 50)+baseVector, 50, nsGraphics::KGreen); window << nsShape::Circle(nsGraphics::Vec2D(50, 50)+baseVector, 50, nsGraphics::KGreen);
window << nsShape::Circle(nsGraphics::Vec2D(35, 35)+baseVector, 10, nsGraphics::KBlack); window << nsShape::Circle(nsGraphics::Vec2D(35, 35)+baseVector, 10, nsGraphics::KBlack);
@ -35,10 +35,14 @@ void DrawEngine::dessinerInvader3(const nsGraphics::Vec2D& baseVector){
} }
unsigned DrawEngine::showInitialMenu(){ unsigned PixelManager::showInitialMenu(){
return 0; return 0;
} }
unsigned DrawEngine::showDeathMenu() { unsigned PixelManager::showDeathMenu() {
return 0;
}
unsigned PixelManager::getScreenHeight() {
return 0; return 0;
} }

View File

@ -1,6 +1,6 @@
#include "pos.h" #include "position.h"
#include <mingl/mingl.h> #include <mingl/mingl.h>
bool pos::isColliding(pos& p, unsigned rx, unsigned ry) { bool position::isColliding(position& p, unsigned rx, unsigned ry) {
return nsGraphics::Vec2D::isColliding(p, p+nsGraphics::Vec2D(rx, ry)); return nsGraphics::Vec2D::isColliding(p, p+nsGraphics::Vec2D(rx, ry));
} }

6
src/utils.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "utils.h"
bool lineCollideCheck(unsigned start1, unsigned end1, unsigned start2, unsigned end2){
return start1 < end2 != start2 < end1;
// if true, are colliding. I like truth tables
}