aboutsummaryrefslogtreecommitdiff
path: root/src/app/app.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-02-16 19:31:24 +0100
committerHampusM <hampus@hampusmat.com>2022-02-16 19:31:24 +0100
commit91286f9dbb85fc2805345ba72468d5f145228be8 (patch)
tree9ad87c8d30e282e0c3478150efd901ef3dc17cca /src/app/app.cpp
parent5dae8f8d10d506abc3c75a1f66c1dfe620c84fc1 (diff)
refactor: create app class & simplify app options
Diffstat (limited to 'src/app/app.cpp')
-rw-r--r--src/app/app.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 0942c3e..d860b16 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -8,19 +8,21 @@
#include <memory>
#include <string_view>
-void app_start(const AppOptions &app_options)
+App::App(const AppOptions &options) : _options(options) {}
+
+void App::run()
{
- Matrix<std::string_view> matrix(*app_options.maze_bounds() *
+ Matrix<std::string_view> matrix(*_options.maze_bounds *
Bounds({.width = 2U, .height = 2U}) +
Bounds({.width = 1U, .height = 1U}));
- matrix.fill(app_options.wall());
+ matrix.fill(_options.wall);
- auto start_pos = *app_options.start_coords() * Vector2({.x = 2U, .y = 2U}) +
+ auto start_pos = *_options.start_coords * Vector2({.x = 2U, .y = 2U}) +
Vector2({.x = 1U, .y = 1U});
matrix_to_maze<std::string_view>(&matrix, std::make_shared<Vector2>(start_pos), " ",
- app_options.random_gen());
+ _options.random_gen);
matrix.print();
}