From 420b5040161652cad6e557558e3612c9d8cac1af Mon Sep 17 00:00:00 2001 From: valtermiari Date: Fri, 10 Mar 2023 09:32:22 +0100 Subject: [PATCH] Started on a larger test --- src/GC/tests/game.cpp | 25 +++++++++++++++++++++++++ src/GC/tests/player.hpp | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/GC/tests/game.cpp create mode 100644 src/GC/tests/player.hpp diff --git a/src/GC/tests/game.cpp b/src/GC/tests/game.cpp new file mode 100644 index 0000000..4bf2d02 --- /dev/null +++ b/src/GC/tests/game.cpp @@ -0,0 +1,25 @@ +#include + +#include "player.hpp" + +#define X_LENGTH 1000; +#define Y_LENGTH 500; + +class Game { + +private: + + std::vector players; + Point dimensions; + +public: + + Game() { + dimensions = {X_LENGTH, Y_LENGTH}; + } + + void add_player(Player& p) { + players.push_back(p); + } + +}; \ No newline at end of file diff --git a/src/GC/tests/player.hpp b/src/GC/tests/player.hpp new file mode 100644 index 0000000..97d2a0d --- /dev/null +++ b/src/GC/tests/player.hpp @@ -0,0 +1,37 @@ +#include + +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; +}; \ No newline at end of file