Skip to content

Commit 7a24c82

Browse files
committed
Code quality
1 parent a06bff5 commit 7a24c82

16 files changed

+23
-23
lines changed

src/editor/button_widget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ ButtonWidget::draw(DrawingContext& context)
4343
}
4444

4545
if (m_grab) {
46-
context.color().draw_filled_rect(m_rect, Color(g_config->editorgrabcolor), 4.0f,
46+
context.color().draw_filled_rect(m_rect, g_config->editorgrabcolor, 4.0f,
4747
LAYER_GUI-5);
4848
} else if (m_hover) {
49-
context.color().draw_filled_rect(m_rect, Color(g_config->editorhovercolor), 4.0f,
49+
context.color().draw_filled_rect(m_rect, g_config->editorhovercolor, 4.0f,
5050
LAYER_GUI-5);
5151
}
5252
}

src/editor/layers_widget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ EditorLayersWidget::draw(DrawingContext& context)
6565

6666
context.color().draw_filled_rect(Rectf(Vector(0, static_cast<float>(m_Ypos)),
6767
Vector(static_cast<float>(m_Width), static_cast<float>(SCREEN_HEIGHT))),
68-
Color(g_config->editorcolor),
68+
g_config->editorcolor,
6969
0.0f,
7070
LAYER_GUI-10);
7171

@@ -98,7 +98,7 @@ EditorLayersWidget::draw(DrawingContext& context)
9898

9999
if (draw_rect)
100100
{
101-
context.color().draw_filled_rect(target_rect, Color(g_config->editorhovercolor), 0.0f,
101+
context.color().draw_filled_rect(target_rect, g_config->editorhovercolor, 0.0f,
102102
LAYER_GUI-5);
103103
}
104104

src/editor/tip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Tip::draw(DrawingContext& context, const Vector& pos)
6868
auto position = pos;
6969
position.y += 35;
7070
context.color().draw_text(Resources::normal_font, m_header, position,
71-
ALIGN_LEFT, LAYER_GUI-11, Color(g_config->labeltextcolor));
71+
ALIGN_LEFT, LAYER_GUI-11, g_config->labeltextcolor);
7272

7373
for (const auto& str : m_strings) {
7474
position.y += 22;

src/editor/toolbox_widget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ EditorToolboxWidget::draw(DrawingContext& context)
7373
context.color().draw_filled_rect(Rectf(Vector(static_cast<float>(m_Xpos), 0),
7474
Vector(static_cast<float>(context.get_width()),
7575
static_cast<float>(context.get_height()))),
76-
Color(g_config->editorcolor),
76+
g_config->editorcolor,
7777
0.0f, LAYER_GUI-10);
7878
if (m_dragging) {
7979
context.color().draw_filled_rect(selection_draw_rect(), Color(0.2f, 0.4f, 1.0f, 0.6f),
@@ -83,7 +83,7 @@ EditorToolboxWidget::draw(DrawingContext& context)
8383
if (m_hovered_item != HoveredItem::NONE)
8484
{
8585
context.color().draw_filled_rect(get_item_rect(m_hovered_item),
86-
Color(g_config->editorhovercolor),
86+
g_config->editorhovercolor,
8787
0.0f, LAYER_GUI - 5);
8888
}
8989

src/gui/dialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Dialog::draw(DrawingContext& context)
220220
// draw HL line
221221
context.color().draw_filled_rect(Rectf(Vector(bg_rect.get_left(), bg_rect.get_bottom() - 35),
222222
Sizef(bg_rect.get_width(), 4)),
223-
Color(g_config->hlcolor), LAYER_GUI);
223+
g_config->hlcolor, LAYER_GUI);
224224
context.color().draw_filled_rect(Rectf(Vector(bg_rect.get_left(), bg_rect.get_bottom() - 35),
225225
Sizef(bg_rect.get_width(), 2)),
226226
Color(1.0f, 1.0f, 1.0f, 1.0f), LAYER_GUI);
@@ -252,7 +252,7 @@ Dialog::draw(DrawingContext& context)
252252
context.color().draw_text(Resources::normal_font, m_buttons[i].text,
253253
Vector(pos.x, pos.y - static_cast<float>(int(Resources::normal_font->get_height() / 2))),
254254
ALIGN_CENTER, LAYER_GUI,
255-
i == m_selected_button ? Color(g_config->activetextcolor) : ColorScheme::Menu::default_color);
255+
i == m_selected_button ? g_config->activetextcolor : ColorScheme::Menu::default_color);
256256
}
257257
}
258258

src/gui/item_back.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ItemBack::draw(DrawingContext& context, const Vector& pos, int menu_width, bool
3636
context.color().draw_text(Resources::normal_font, get_text(),
3737
Vector( pos.x + static_cast<float>(menu_width) / 2.0f,
3838
pos.y - static_cast<float>(int(Resources::normal_font->get_height()/2))),
39-
ALIGN_CENTER, LAYER_GUI, active ? Color(g_config->activetextcolor) : get_color());
39+
ALIGN_CENTER, LAYER_GUI, active ? g_config->activetextcolor : get_color());
4040
context.color().draw_surface(Resources::back,
4141
Vector(pos.x + static_cast<float>(menu_width) / 2.0f + text_width / 2.0f + 16.0f,
4242
pos.y - 8.0f),

src/gui/item_controlfield.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ItemControlField::draw(DrawingContext& context, const Vector& pos, int menu_widt
3838
context.color().draw_text(Resources::normal_font, get_text(),
3939
Vector(pos.x + 16.0f,
4040
pos.y - static_cast<float>(int(Resources::normal_font->get_height()/2))),
41-
ALIGN_LEFT, LAYER_GUI, active ? Color(g_config->activetextcolor) : get_color());
41+
ALIGN_LEFT, LAYER_GUI, active ? g_config->activetextcolor : get_color());
4242
}
4343

4444
int

src/gui/item_floatfield.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ItemFloatField::draw(DrawingContext& context, const Vector& pos, int menu_width,
5757
context.color().draw_text(Resources::normal_font, get_text(),
5858
Vector(pos.x + 16.0f,
5959
pos.y - Resources::normal_font->get_height() / 2.0f),
60-
ALIGN_LEFT, LAYER_GUI, active ? Color(g_config->activetextcolor) : get_color());
60+
ALIGN_LEFT, LAYER_GUI, active ? g_config->activetextcolor : get_color());
6161
}
6262

6363
int

src/gui/item_intfield.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ItemIntField::draw(DrawingContext& context, const Vector& pos, int menu_width, b
4444
context.color().draw_text(Resources::normal_font, get_text(),
4545
Vector(pos.x + 16.0f,
4646
pos.y - Resources::normal_font->get_height() / 2.0f),
47-
ALIGN_LEFT, LAYER_GUI, active ? Color(g_config->activetextcolor) : get_color());
47+
ALIGN_LEFT, LAYER_GUI, active ? g_config->activetextcolor : get_color());
4848
}
4949

5050
int

src/gui/item_label.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ItemLabel::draw(DrawingContext& context, const Vector& pos, int menu_width, bool
3737

3838
Color
3939
ItemLabel::get_color() const {
40-
return Color(g_config->labeltextcolor);
40+
return g_config->labeltextcolor;
4141
}
4242

4343
int

0 commit comments

Comments
 (0)