| 93 | } |
| 94 | |
| 95 | bool Stage::initialize(const BufferParams& params) { |
| 96 | const auto camera_obj = std::make_shared<GameObject>(); |
| 97 | |
| 98 | camera_obj->set_stage(*this); |
| 99 | |
| 100 | camera_obj->add_component("camera_component", |
| 101 | std::make_shared<Camera>(camera_obj, canvas_)); |
| 102 | camera_obj->add_component( |
| 103 | "background_component", |
| 104 | std::make_shared<Background>(camera_obj, canvas_)); |
| 105 | |
| 106 | all_game_objects["camera"] = camera_obj; |
| 107 | |
| 108 | const auto buffer_obj = std::make_shared<GameObject>(); |
| 109 | |
| 110 | buffer_obj->set_stage(*this); |
| 111 | |
| 112 | buffer_obj->add_component( |
| 113 | "text_component", std::make_shared<BufferValues>(buffer_obj, canvas_)); |
| 114 | |
| 115 | const auto buffer_component = std::make_shared<Buffer>(buffer_obj, canvas_); |
| 116 | |
| 117 | buffer_component->configure(params); |
| 118 | buffer_obj->add_component("buffer_component", buffer_component); |
| 119 | |
| 120 | all_game_objects["buffer"] = buffer_obj; |
| 121 | |
| 122 | for (const auto& go : all_game_objects | std::views::values) { |
| 123 | if (!go->initialize()) { |
| 124 | return false; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | return std::ranges::all_of(all_game_objects, [](auto& go) { |
| 129 | const auto& [name, game_object] = go; |
| 130 | return game_object->post_initialize(); |
| 131 | }); |
| 132 | } |
| 133 | |
| 134 | bool Stage::buffer_update(const BufferParams& params) { |
| 135 | const auto buffer_it = all_game_objects.find("buffer"); |
nothing calls this directly
no test coverage detected