#pragma once #include #include #include #include #include #include "CommandParser.h" #include "game.h" #include "json.hpp" #include "player.h" #include "room.h" static int curX, curY; extern std::vector> rooms; #define MAP_HEIGHT 5 #define MAP_WIDTH 5 namespace fs = std::filesystem; class Game { private: Player player; int progress; CommandParser parser; nlohmann::json json; fs::path filePath = "Resources/Rooms.json"; std::ifstream stream; bool isActive; inline static Game *game_; // Likely need to make sure Player is ADDED to room // We want player and objects to exist IN room Room currentRoom; public: Game(); Game(Game& rhs); Game& operator=(Game& rhs); inline bool GetIsActive() const { return isActive; } bool Init(); void Run(); bool Save(); void ChangeRoom(Room r); Room GetCurrentRoom() { return currentRoom; } inline bool operator!() const { if (isActive) { return false; } return true; } void SetIsActive(const bool active) { isActive = active; } static Game &Instance() { if (game_ == nullptr) { game_ = new Game(); game_->Init(); } return *game_; } inline friend void swap(Game &lhs, Game &rhs) { using std::swap; swap(lhs.isActive, rhs.isActive); swap(lhs.progress, rhs.progress); swap(lhs.player, rhs.player); swap(lhs.parser, rhs.parser); } ~Game(); }; // Commands static int Quit(const std::string &n); static int Move(const std::string &c); static int Look(const std::string &c);