diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/engine.cpp | 6 | ||||
-rw-r--r-- | src/input_actions.cpp | 7 | ||||
-rw-r--r-- | src/strings.hpp | 5 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 6050348..d793c65 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1,10 +1,12 @@ #include "engine.hpp" #include "input_actions.hpp" +#include "strings.hpp" #include "util/function.hpp" #include <cstdlib> +#include <fmt/core.h> #include <utility> CLIGameEngine::CLIGameEngine(IGameFactory game_factory, ISceneFactory scene_factory, @@ -34,6 +36,10 @@ void CLIGameEngine::start() noexcept _cursor_controller->move_to(center_position); + scene->write_status(fmt::format(STATUS_BAR_COORDINATES, + fmt::arg("x", center_position.get_x()), + fmt::arg("y", center_position.get_y()))); + std::atexit(normalize_lambda( [scene, this]() { diff --git a/src/input_actions.cpp b/src/input_actions.cpp index 5df6e5f..7a6976d 100644 --- a/src/input_actions.cpp +++ b/src/input_actions.cpp @@ -1,5 +1,7 @@ #include "input_actions.hpp" +#include "strings.hpp" + #include <fmt/core.h> namespace InputActions @@ -31,8 +33,9 @@ Callback move_cursor(const Vector2 &direction, cursor_controller->move_to(new_position); - scene->write_status( - fmt::format("X: {} Y {}", new_position.get_x(), new_position.get_y())); + scene->write_status(fmt::format(STATUS_BAR_COORDINATES, + fmt::arg("x", new_position.get_x()), + fmt::arg("y", new_position.get_y()))); }; } diff --git a/src/strings.hpp b/src/strings.hpp new file mode 100644 index 0000000..3678c57 --- /dev/null +++ b/src/strings.hpp @@ -0,0 +1,5 @@ +#pragma once + +#include <fmt/core.h> + +constexpr fmt::string_view STATUS_BAR_COORDINATES = "X: {x} Y {y}"; |