11#include < array>
2+ #include < cstddef>
3+ #include < ftxui/dom/elements.hpp>
4+ #include < cstdint>
5+ #include < ftxui/dom/node.hpp>
6+ #include < ftxui/screen/screen.hpp>
7+ #include < chrono>
8+ #include < atomic>
9+ #include < fmt/format.h>
10+ #include < fmt/base.h>
11+ #include < cstdlib>
12+ #include < exception>
213#include < functional>
3- #include < iostream>
414#include < optional>
515
616#include < random>
717
818#include < CLI/CLI.hpp>
9- #include < ftxui/component/captured_mouse.hpp> // for ftxui
1019#include < ftxui/component/component.hpp> // for Slider
1120#include < ftxui/component/screen_interactive.hpp> // for ScreenInteractive
1221#include < spdlog/spdlog.h>
1726// configuration step. It creates a namespace called `myproject`. You can modify
1827// the source template at `configured_files/config.hpp.in`.
1928#include < internal_use_only/config.hpp>
29+ #include < string>
30+ #include < vector>
31+ #include < utility>
32+ #include < thread>
2033
2134template <std::size_t Width, std::size_t Height> struct GameBoard
2235{
@@ -89,7 +102,7 @@ template<std::size_t Width, std::size_t Height> struct GameBoard
89102 }
90103};
91104
92-
105+ namespace {
93106void consequence_game ()
94107{
95108 auto screen = ftxui::ScreenInteractive::TerminalOutput ();
@@ -162,6 +175,7 @@ void consequence_game()
162175
163176 screen.Loop (renderer);
164177}
178+ }
165179
166180struct Color
167181{
@@ -177,13 +191,12 @@ struct Bitmap : ftxui::Node
177191 : width_(width), height_(height)
178192 {}
179193
180- Color &at (std::size_t cur_x, std::size_t cur_y) { return pixels.at (width_ * cur_y + cur_x); }
194+ Color &at (std::size_t cur_x, std::size_t cur_y) { return pixels.at (( width_ * cur_y) + cur_x); }
181195
182196 void ComputeRequirement () override
183197 {
184- requirement_ = ftxui::Requirement{
185- .min_x = static_cast <int >(width_), .min_y = static_cast <int >(height_ / 2 ), .selected_box { 0 , 0 , 0 , 0 }
186- };
198+ requirement_.min_x = static_cast <int >(width_);
199+ requirement_.min_y = static_cast <int >(height_ / 2 );
187200 }
188201
189202 void Render (ftxui::Screen &screen) override
@@ -193,7 +206,7 @@ struct Bitmap : ftxui::Node
193206 auto &pixel = screen.PixelAt (box_.x_min + static_cast <int >(cur_x), box_.y_min + static_cast <int >(cur_y));
194207 pixel.character = " ▄" ;
195208 const auto &top_color = at (cur_x, cur_y * 2 );
196- const auto &bottom_color = at (cur_x, cur_y * 2 + 1 );
209+ const auto &bottom_color = at (cur_x, ( cur_y * 2 ) + 1 );
197210 pixel.background_color = ftxui::Color{ top_color.R .get (), top_color.G .get (), top_color.B .get () };
198211 pixel.foreground_color = ftxui::Color{ bottom_color.R .get (), bottom_color.G .get (), bottom_color.B .get () };
199212 }
@@ -213,6 +226,7 @@ struct Bitmap : ftxui::Node
213226 std::vector<Color> pixels = std::vector<Color>(width_ * height_, Color{});
214227};
215228
229+ namespace {
216230void game_iteration_canvas ()
217231{
218232 // this should probably have a `bitmap` helper function that does what cur_you expect
@@ -257,6 +271,8 @@ void game_iteration_canvas()
257271 case 2 :
258272 small_bm_pixel.B += 11 ;// NOLINT Magic Number
259273 break ;
274+ default : // literally impossible
275+ std::unreachable ();
260276 }
261277
262278
@@ -308,6 +324,7 @@ void game_iteration_canvas()
308324 refresh_ui_continue = false ;
309325 refresh_ui.join ();
310326}
327+ }
311328
312329// NOLINTNEXTLINE(bugprone-exception-escape)
313330int main (int argc, const char **argv)
0 commit comments