mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-12-02 19:01:48 +00:00
Remove a lot of static_cast<>s involving UI structs.
Also starting to get religion on using unsigned integers only when I want their wrapping/modulus behavior.
This commit is contained in:
@@ -291,10 +291,7 @@ void ILI9341::fill_circle(
|
||||
const uint32_t d2 = x2 + y2;
|
||||
const bool inside = d2 < radius2;
|
||||
const auto color = inside ? foreground : background;
|
||||
draw_pixel({
|
||||
static_cast<ui::Coord>(x + center.x()),
|
||||
static_cast<ui::Coord>(y + center.y())
|
||||
}, color);
|
||||
draw_pixel({ x + center.x(), y + center.y() }, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,9 +523,9 @@ bool ImageButton::on_touch(const TouchEvent event) {
|
||||
|
||||
OptionsField::OptionsField(
|
||||
Point parent_pos,
|
||||
size_t length,
|
||||
int length,
|
||||
options_t options
|
||||
) : Widget { { parent_pos, { static_cast<ui::Dim>(8 * length), 16 } } },
|
||||
) : Widget { { parent_pos, { 8 * length, 16 } } },
|
||||
length_ { length },
|
||||
options { options }
|
||||
{
|
||||
@@ -594,11 +594,11 @@ bool OptionsField::on_touch(const TouchEvent event) {
|
||||
|
||||
NumberField::NumberField(
|
||||
Point parent_pos,
|
||||
size_t length,
|
||||
int length,
|
||||
range_t range,
|
||||
int32_t step,
|
||||
char fill_char
|
||||
) : Widget { { parent_pos, { static_cast<ui::Dim>(8 * length), 16 } } },
|
||||
) : Widget { { parent_pos, { 8 * length, 16 } } },
|
||||
range { range },
|
||||
step { step },
|
||||
length_ { length },
|
||||
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
std::function<void(size_t, value_t)> on_change { };
|
||||
std::function<void(void)> on_show_options { };
|
||||
|
||||
OptionsField(Point parent_pos, size_t length, options_t options);
|
||||
OptionsField(Point parent_pos, int length, options_t options);
|
||||
|
||||
size_t selected_index() const;
|
||||
void set_selected_index(const size_t new_index);
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
|
||||
private:
|
||||
const size_t length_;
|
||||
const int length_;
|
||||
options_t options;
|
||||
size_t selected_index_ { 0 };
|
||||
};
|
||||
@@ -298,7 +298,7 @@ public:
|
||||
|
||||
using range_t = std::pair<int32_t, int32_t>;
|
||||
|
||||
NumberField(Point parent_pos, size_t length, range_t range, int32_t step, char fill_char);
|
||||
NumberField(Point parent_pos, int length, range_t range, int32_t step, char fill_char);
|
||||
|
||||
NumberField(const NumberField&) = delete;
|
||||
NumberField(NumberField&&) = delete;
|
||||
@@ -314,7 +314,7 @@ public:
|
||||
private:
|
||||
const range_t range;
|
||||
const int32_t step;
|
||||
const size_t length_;
|
||||
const int length_;
|
||||
const char fill_char;
|
||||
int32_t value_ { 0 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user