From 91286f9dbb85fc2805345ba72468d5f145228be8 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 16 Feb 2022 19:31:24 +0100 Subject: refactor: create app class & simplify app options --- src/app/app.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/app/app.cpp') 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 #include -void app_start(const AppOptions &app_options) +App::App(const AppOptions &options) : _options(options) {} + +void App::run() { - Matrix matrix(*app_options.maze_bounds() * + Matrix 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(&matrix, std::make_shared(start_pos), " ", - app_options.random_gen()); + _options.random_gen); matrix.print(); } -- cgit v1.2.3-18-g5258