diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0db5873 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.configureOnOpen": true +} \ No newline at end of file diff --git a/src/game/game.cpp b/src/game/game.cpp index d3638d3..614b3c8 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -2,4 +2,21 @@ #include "game_map.hpp" Game::Game(size_t playersNum, std::pair sz) : - playersNum(playersNum), gameMap(sz) {} \ No newline at end of file + playersNum(playersNum), gameMap(sz) {} + +void Game::begin() { + // init map + // create basic units +} + +void Game::step() { + // gameMap.step(); + for (size_t i = 0; i < units.size(); ++i) { + units[i].step(); + } + // all game step +} + +void Game::end() { + // end all +} \ No newline at end of file diff --git a/src/game/game.hpp b/src/game/game.hpp index e2cd153..941a53d 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -16,4 +16,7 @@ private: public: // may be more than one map sizes ?? Game(size_t playersNum, std::pair sz); + void begin(); + void step(); + void end(); }; \ No newline at end of file diff --git a/src/game/game_map.cpp b/src/game/game_map.cpp index 47a68a0..25d291d 100644 --- a/src/game/game_map.cpp +++ b/src/game/game_map.cpp @@ -45,4 +45,8 @@ namespace map { } return way; } + + void generate() { + + } } \ No newline at end of file diff --git a/src/game/game_map.hpp b/src/game/game_map.hpp index 2c9bbf7..4d2365d 100644 --- a/src/game/game_map.hpp +++ b/src/game/game_map.hpp @@ -26,5 +26,6 @@ namespace map { std::pair start, std::pair end); + void generate(); }; } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 22791c9..efda5b0 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,14 +1,19 @@ #include #include +#include "game/game.hpp" #include "out_api/init.hpp" #include "out_api/menu_draw.hpp" #include "out_api/game_draw.hpp" int main() { + Game game(2, {100, 100}); + game.begin(); init::begin(); while (!init::stop()) { game_draw::drawAll(); + game.step(); init::step(); } - init::end(); + init::end(); + game.end(); } diff --git a/src/out_api/init.cpp b/src/out_api/init.cpp index c9e452c..746a683 100644 --- a/src/out_api/init.cpp +++ b/src/out_api/init.cpp @@ -6,10 +6,13 @@ #include "input.hpp" namespace init { + WINDOW* stdscr; + void begin() { - initscr(); + stdscr = initscr(); noecho(); curs_set(false); + nodelay(stdscr, true); draw::begin(); input::begin(); } diff --git a/src/out_api/input.cpp b/src/out_api/input.cpp index ad88df2..57c85ce 100644 --- a/src/out_api/input.cpp +++ b/src/out_api/input.cpp @@ -14,7 +14,7 @@ namespace input { } void step() { - + lastInput = getch(); } void end() { diff --git a/src/out_api/input.hpp b/src/out_api/input.hpp index e3a753a..25b592f 100644 --- a/src/out_api/input.hpp +++ b/src/out_api/input.hpp @@ -1,8 +1,10 @@ #include +#include #pragma once namespace input { + char lastInput = ERR; void begin(); diff --git a/src/out_api/input_controller.hpp b/src/out_api/input_controller.hpp index e69de29..7d4fba9 100644 --- a/src/out_api/input_controller.hpp +++ b/src/out_api/input_controller.hpp @@ -0,0 +1,12 @@ +#include + +#pragma once + +// add keyboard to keys rebinding for each InputController + +class InputController { +private: + +public: + InputController() +}; \ No newline at end of file