SuperSpaceInvaderTurboApoca.../headers/utils.h
2022-01-06 09:58:06 +01:00

46 lines
1.1 KiB
C++

#ifndef GUARD_UTILS_H
#define GUARD_UTILS_H
#include<vector>
#include<mingl/mingl.h>
// hardcoded values
#define PLAYER_HEIGHT 100
#define PROJ_LENGTH_FACTOR 2
// TODO utiliser ca de partout
#define INV_GET_POS(i) confData.invadersSize*(i)+confData.invadersDistance*(i)
using namespace std;
using nsGraphics::RGBAcolor;
enum class WinValue{
NOBODY, // should never be used
PLAYERS,
INVADERS,
};
enum class InvaderType {
TYPEA,
TYPEB,
TYPEC,
NONE,
};
class InvadersColumn : public vector<InvaderType>{
public:
// idk why CLion says this is not implemented, but it is
size_t getOutterInvader() const;
};
typedef vector<InvadersColumn> InvadersGrid;
typedef nsGraphics::Vec2D Position; // TODO replace with Vec2D ?
typedef unsigned playerID; // 0 for player 1, 1 for player 2
// didn't want to use Position because of the semantic with x and y
bool areLinesColliding(unsigned start1, unsigned end1, unsigned start2, unsigned end2);
// change draw position for a specified size (keeps the same center)
void applyTransformation(Position& pos, unsigned sizeFrom, unsigned sizeTo);
#endif