Started on a larger test

This commit is contained in:
valtermiari 2023-03-10 09:32:22 +01:00
parent cdc802476d
commit 420b504016
2 changed files with 62 additions and 0 deletions

25
src/GC/tests/game.cpp Normal file
View file

@ -0,0 +1,25 @@
#include <vector>
#include "player.hpp"
#define X_LENGTH 1000;
#define Y_LENGTH 500;
class Game {
private:
std::vector<Player> players;
Point dimensions;
public:
Game() {
dimensions = {X_LENGTH, Y_LENGTH};
}
void add_player(Player& p) {
players.push_back(p);
}
};

37
src/GC/tests/player.hpp Normal file
View file

@ -0,0 +1,37 @@
#include <string>
using std::string;
class Player {
private:
string name;
Point position;
Point size;
Point direction;
public:
Player(string n, Point pos, Point s, Point dir) {
name = n;
position = pos;
size = s;
direction = dir;
}
void move() {
position.x += direction.x;
position.y += direction.y;
}
void set_speed(int dx, int dy) {
direction.x = dx;
direction.y = dy;
}
};
struct Point {
int x, y;
};