aboutsummaryrefslogtreecommitdiff
path: root/src/game/components
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-06-27 22:08:43 +0200
committerHampusM <hampus@hampusmat.com>2022-06-27 22:08:43 +0200
commit6b0e2a25cf1e98d3f11d4e6c0305dd327048bbb8 (patch)
treea62c23f4e66949fe109e07dec95ad3a3e5229a7c /src/game/components
parent9d0fe1b42c9f6a5c09bab444966d347a71a4b905 (diff)
refactor: use int types from std namespace
Diffstat (limited to 'src/game/components')
-rw-r--r--src/game/components/statusline.cpp26
-rw-r--r--src/game/components/statusline.hpp16
2 files changed, 21 insertions, 21 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;
};