Adding new context with world & config_json

This commit is contained in:
2026-01-10 22:40:17 +01:00
parent 24729d11f3
commit 8aee4cdc53
4 changed files with 144 additions and 62 deletions

24
includes/context.hpp Normal file
View File

@@ -0,0 +1,24 @@
/*
* File name: context.hpp
* Author: lejulien
* Date created: 01-01-1970 00:59:59
// Date modified: 10-01-2026 22:24:41
* ------
*/
#pragma once
#include <nlohmann/json.hpp>
#include <memory>
#include <world.hpp>
namespace gol {
typedef struct ctx {
std::shared_ptr<World> world = nullptr;
nlohmann::json config_json;
} ctx;
} // namespace gol

39
includes/control_menu.hpp Normal file
View File

@@ -0,0 +1,39 @@
/*
* File name: control_menu.hpp
* Author: lejulien
* Date created: 10-01-2026 22:00:33
// Date modified: 10-01-2026 22:18:25
* ------
*/
#pragma once
#include <context.hpp>
namespace gol {
class ControlMenu {
public:
ControlMenu(ctx context);
~ControlMenu() = default;
void update();
void display();
private:
ctx context_;
int fps_ctrl_ = false;
int cell_size_ctrl_ = false;
bool play_ctrl_ = true;
bool step_ctrl_ = false;
bool step_back_ctrl_ = false;
bool rand_ctrl_ = false;
bool edit_ctrl_ = false;
bool clear_ctrl_ = false;
bool settings_window_ = false;
bool paterns_ctrl_ = false;
int width_ctrl_ = false;
int height_ctrl_ = false;
bool dark_theme_ctrl_ = false;
bool apply_ctrl_ = false;
};
} // namespace gol