diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/components/statusline.cpp | 26 | ||||
-rw-r--r-- | src/game/components/statusline.hpp | 16 | ||||
-rw-r--r-- | src/game/game.cpp | 8 | ||||
-rw-r--r-- | src/game/game.hpp | 4 | ||||
-rw-r--r-- | src/game/generation_tracker.cpp | 4 | ||||
-rw-r--r-- | src/game/generation_tracker.hpp | 6 | ||||
-rw-r--r-- | src/game/status_manager.hpp | 2 |
7 files changed, 33 insertions, 33 deletions
diff --git a/src/game/components/statusline.cpp b/src/game/components/statusline.cpp index 3903792..c2fe7ea 100644 --- a/src/game/components/statusline.cpp +++ b/src/game/components/statusline.cpp @@ -30,12 +30,12 @@ void StatusLine::set_need_render(bool need_render) noexcept _need_render = need_render; } -auto StatusLine::get_foreground_color() const noexcept -> uint32_t +auto StatusLine::get_foreground_color() const noexcept -> std::uint32_t { - return static_cast<uint32_t>(fmt::color::white); + return static_cast<std::uint32_t>(fmt::color::white); } -auto StatusLine::get_background_color() const noexcept -> uint32_t +auto StatusLine::get_background_color() const noexcept -> std::uint32_t { return STATUSLINE_COLOR; } @@ -43,7 +43,7 @@ auto StatusLine::get_background_color() const noexcept -> uint32_t void StatusLine::set_section_status( StatusLineSection section, const std::string_view &status, - int32_t start) noexcept + std::int32_t start) noexcept { if (status.length() == 0U) { @@ -56,11 +56,11 @@ void StatusLine::set_section_status( auto pos = Vector2({.x = section_start + start, .y = 0}); - const auto column_cnt = static_cast<int32_t>(_component_matrix->get_column_cnt()); + const auto column_cnt = static_cast<std::int32_t>(_component_matrix->get_column_cnt()); const auto section_length = _section_lengths[section]; - const auto status_len = static_cast<int32_t>(status.length()); + const auto status_len = static_cast<std::int32_t>(status.length()); const auto section_style = _section_styles.contains(section) ? _section_styles.at(section) : Style(); @@ -104,7 +104,7 @@ void StatusLine::set_section_status( _matrix_write_string( pos, - status.substr(status_offset_start, static_cast<uint32_t>(final_status_length))); + status.substr(status_offset_start, static_cast<std::uint32_t>(final_status_length))); pos = pos.to_direction(Vector2::right(), final_status_length); @@ -120,7 +120,7 @@ void StatusLine::set_section_status( set_need_render(true); } -void StatusLine::set_section_length(StatusLineSection section, int32_t length) noexcept +void StatusLine::set_section_length(StatusLineSection section, std::int32_t length) noexcept { _section_lengths[section] = length; } @@ -144,17 +144,17 @@ void StatusLine::_matrix_write_string( } } -auto StatusLine::_get_section_start_x(StatusLineSection section) const noexcept -> int32_t +auto StatusLine::_get_section_start_x(StatusLineSection section) const noexcept -> std::int32_t { - int32_t section_start = 0; + std::int32_t section_start = 0; - auto section_index = static_cast<int32_t>(section); + auto section_index = static_cast<std::int32_t>(section); while (section_index > 0) { const auto prev_section = static_cast<StatusLineSection>(section_index - 1); - section_start += static_cast<int32_t>(_section_lengths.at(prev_section)); + section_start += static_cast<std::int32_t>(_section_lengths.at(prev_section)); section_index--; } @@ -162,7 +162,7 @@ auto StatusLine::_get_section_start_x(StatusLineSection section) const noexcept return section_start; } -void StatusLine::_clear_section(StatusLineSection section, int32_t start) noexcept +void StatusLine::_clear_section(StatusLineSection section, std::int32_t start) noexcept { auto section_start = _get_section_start_x(section); diff --git a/src/game/components/statusline.hpp b/src/game/components/statusline.hpp index e009174..4451fde 100644 --- a/src/game/components/statusline.hpp +++ b/src/game/components/statusline.hpp @@ -10,7 +10,7 @@ #include <string_view> #include <unordered_map> -constexpr uint32_t STATUSLINE_COLOR = 0x1A1A1AU; +constexpr std::uint32_t STATUSLINE_COLOR = 0x1A1A1AU; class StatusLine : public IStatusLine { @@ -23,23 +23,23 @@ public: void set_need_render(bool need_render) noexcept override; - auto get_foreground_color() const noexcept -> uint32_t override; + auto get_foreground_color() const noexcept -> std::uint32_t override; - auto get_background_color() const noexcept -> uint32_t override; + auto get_background_color() const noexcept -> std::uint32_t override; void set_section_status( StatusLineSection section, const std::string_view &status, - int32_t start) noexcept override; + std::int32_t start) noexcept override; - void set_section_length(StatusLineSection section, int32_t length) noexcept override; + void set_section_length(StatusLineSection section, std::int32_t length) noexcept override; void set_section_style(StatusLineSection section, const Style &style) noexcept override; private: std::shared_ptr<ComponentMatrix> _component_matrix; - std::unordered_map<StatusLineSection, int32_t> _section_lengths; + std::unordered_map<StatusLineSection, std::int32_t> _section_lengths; std::unordered_map<StatusLineSection, Style> _section_styles; bool _need_render; @@ -47,7 +47,7 @@ private: _matrix_write_string(const Vector2 &position, const std::string_view &str) noexcept; [[nodiscard]] auto _get_section_start_x(StatusLineSection section) const noexcept - -> int32_t; + -> std::int32_t; - void _clear_section(StatusLineSection section, int32_t start) noexcept; + void _clear_section(StatusLineSection section, std::int32_t start) noexcept; }; diff --git a/src/game/game.cpp b/src/game/game.cpp index 2c00b4b..921f21d 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -82,7 +82,7 @@ void Game::on_start() statusline->set_section_style( StatusLineSection::A, - {.bg_color = static_cast<uint32_t>(fmt::color::green), + {.bg_color = static_cast<std::uint32_t>(fmt::color::green), .bold = true, .padding_left = 1U, .padding_right = 1U}); @@ -443,7 +443,7 @@ void Game::_on_command_mode_update() noexcept { const auto position = _cursor_controller->where(); - const auto input_pos_x = static_cast<uint32_t>(position.get_x()) - 1U; + const auto input_pos_x = static_cast<std::uint32_t>(position.get_x()) - 1U; if (input_pos_x == 0U) { @@ -480,7 +480,7 @@ void Game::_on_command_mode_update() noexcept break; case keycodes::RIGHT_ARROW: - if (static_cast<uint32_t>(_cursor_controller->where().get_x()) - 1U < + if (static_cast<std::uint32_t>(_cursor_controller->where().get_x()) - 1U < _command_mode_input.size()) { _cursor_controller->move(Vector2::right(), 1U, true); @@ -495,7 +495,7 @@ void Game::_on_command_mode_update() noexcept default: const auto position = _cursor_controller->where(); - const auto input_pos_x = static_cast<uint32_t>(position.get_x()) - 1U; + const auto input_pos_x = static_cast<std::uint32_t>(position.get_x()) - 1U; if (input_pos_x < _command_mode_input.length()) { diff --git a/src/game/game.hpp b/src/game/game.hpp index ed5a00f..da1ba11 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -86,7 +86,7 @@ private: CursorStyle _normal_mode_cursor_style; CursorStyle _command_mode_cursor_style; - int32_t _minimum_cursor_pos_y; + std::int32_t _minimum_cursor_pos_y; std::optional<Vector2> _last_pos_before_command_mode; @@ -96,7 +96,7 @@ private: std::chrono::system_clock::time_point _last_gen_update_time; - int64_t _generations_per_second = DEFAULT_GENERATIONS_PER_SECOND; + std::int64_t _generations_per_second = DEFAULT_GENERATIONS_PER_SECOND; std::list<Vector2> _living_cell_positions; diff --git a/src/game/generation_tracker.cpp b/src/game/generation_tracker.cpp index 15b4ce4..1a90d6b 100644 --- a/src/game/generation_tracker.cpp +++ b/src/game/generation_tracker.cpp @@ -2,12 +2,12 @@ GenerationTracker::GenerationTracker(bool is_paused) noexcept : _is_paused(is_paused) {} -auto GenerationTracker::get_current_generation() const noexcept -> uint32_t +auto GenerationTracker::get_current_generation() const noexcept -> std::uint32_t { return _current_generation; } -void GenerationTracker::set_current_generation(uint32_t current_generation) noexcept +void GenerationTracker::set_current_generation(std::uint32_t current_generation) noexcept { _current_generation = current_generation; } diff --git a/src/game/generation_tracker.hpp b/src/game/generation_tracker.hpp index 1a83d71..7c67280 100644 --- a/src/game/generation_tracker.hpp +++ b/src/game/generation_tracker.hpp @@ -9,16 +9,16 @@ class GenerationTracker : public IGenerationTracker public: explicit GenerationTracker(bool is_paused) noexcept; - [[nodiscard]] auto get_current_generation() const noexcept -> uint32_t override; + [[nodiscard]] auto get_current_generation() const noexcept -> std::uint32_t override; - void set_current_generation(uint32_t current_generation) noexcept override; + void set_current_generation(std::uint32_t current_generation) noexcept override; [[nodiscard]] auto get_is_paused() const noexcept -> bool override; void set_is_paused(bool is_paused) noexcept override; private: - uint32_t _current_generation = 0U; + std::uint32_t _current_generation = 0U; bool _is_paused; }; diff --git a/src/game/status_manager.hpp b/src/game/status_manager.hpp index 8224003..c101289 100644 --- a/src/game/status_manager.hpp +++ b/src/game/status_manager.hpp @@ -26,5 +26,5 @@ public: private: std::shared_ptr<IStatusLine> _statusline; - std::unordered_map<StatusLineSection, int32_t> _section_title_lengths; + std::unordered_map<StatusLineSection, std::int32_t> _section_title_lengths; }; |