b fix warnings generated from previous commit

This commit is contained in:
2024-08-18 22:05:09 +02:00
parent ade502e221
commit 2616ffbf21
4 changed files with 8 additions and 9 deletions
+5 -5
View File
@@ -13,7 +13,7 @@ Color::Color(std::string hex) {
if (hex.length() == 6) { if (hex.length() == 6) {
hex = "FF" + hex; hex = "FF" + hex;
} }
p_color = std::stoul(hex, nullptr, 16); p_color = (uint32_t)std::stoul(hex, nullptr, 16);
} }
Color::Color(Colors color) { Color::Color(Colors color) {
@@ -180,7 +180,7 @@ Color::Color(Colors color) {
case Colors::Medium_Orchid: case Colors::Medium_Orchid:
Color(0x93, 0x70, 0xDB); Color(0x93, 0x70, 0xDB);
break; break;
case Colors::Medium_Sea_Green: case Colors::Medium_Seagreen:
Color(0x42, 0x6F, 0x42); Color(0x42, 0x6F, 0x42);
break; break;
case Colors::Medium_Slate_Blue: case Colors::Medium_Slate_Blue:
@@ -326,15 +326,15 @@ uint32_t Color::color() const {
} }
uint8_t Color::red() const { uint8_t Color::red() const {
return (p_color >> 24) & 0xFF; return (uint8_t)((p_color >> 24) & 0xFF);
} }
uint8_t Color::green() const { uint8_t Color::green() const {
return (p_color >> 16) & 0xFF; return (uint8_t)((p_color >> 16) & 0xFF);
} }
uint8_t Color::blue() const { uint8_t Color::blue() const {
return (p_color >> 8) & 0xFF; return (uint8_t)((p_color >> 8) & 0xFF);
} }
uint8_t Color::alpha() const { uint8_t Color::alpha() const {
-1
View File
@@ -60,7 +60,6 @@ class Color {
Medium_Forest_Green, Medium_Forest_Green,
Medium_Goldenrod, Medium_Goldenrod,
Medium_Orchid, Medium_Orchid,
Medium_Sea_Green,
Medium_Seagreen, Medium_Seagreen,
Medium_Slate_Blue, Medium_Slate_Blue,
Medium_Spring_Green, Medium_Spring_Green,
+1 -1
View File
@@ -5,7 +5,7 @@ UI_combobox::UI_combobox()
{ {
} }
UI_combobox::UI_combobox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, int selected, UI_combobox_on_change on_change) UI_combobox::UI_combobox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, size_t selected, UI_combobox_on_change on_change)
: UI_x_boxes(id, UI_COMBOBOX_TYPE, text, fg_color, bg_color, options), p_selected(selected), p_on_change(on_change) : UI_x_boxes(id, UI_COMBOBOX_TYPE, text, fg_color, bg_color, options), p_selected(selected), p_on_change(on_change)
{ {
} }
+2 -2
View File
@@ -4,13 +4,13 @@
#include "UI_x_boxes.hpp" #include "UI_x_boxes.hpp"
#define UI_COMBOBOX_TYPE std::string("UIcombobox") #define UI_COMBOBOX_TYPE std::string("UIcombobox")
typedef void (*UI_combobox_on_change) (std::string id, int selected); typedef void (*UI_combobox_on_change) (std::string id, size_t selected);
class UI_combobox : public UI_x_boxes class UI_combobox : public UI_x_boxes
{ {
public: public:
UI_combobox(); UI_combobox();
UI_combobox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, int selected, UI_combobox_on_change on_change = nullptr); UI_combobox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, size_t selected, UI_combobox_on_change on_change = nullptr);
UI_combobox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, UI_combobox_on_change on_change = nullptr); UI_combobox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, UI_combobox_on_change on_change = nullptr);
UI_combobox(const json& j); UI_combobox(const json& j);