Skip to content

Commit 1e0a0c3

Browse files
committed
Small code simplification in ItemToggle
1 parent b6dc8d7 commit 1e0a0c3

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/gui/item_toggle.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,10 @@ ItemToggle::draw(DrawingContext& context, const Vector& pos, int menu_width, boo
5151
pos.y - (Resources::normal_font->get_height() / 2)),
5252
m_center_text ? ALIGN_CENTER : ALIGN_LEFT, LAYER_GUI, active ? g_config->activetextcolor : get_color());
5353

54-
if (m_get_func()) {
55-
context.color().draw_surface(Resources::checkbox_checked,
56-
Vector(pos.x + static_cast<float>(menu_width) - 16.0f - static_cast<float>(Resources::checkbox->get_width()),
57-
pos.y - 8.0f),
58-
LAYER_GUI);
59-
} else {
60-
context.color().draw_surface(Resources::checkbox,
61-
Vector(pos.x + static_cast<float>(menu_width) - 16.0f - static_cast<float>(Resources::checkbox->get_width()),
62-
pos.y - 8.0f),
63-
LAYER_GUI);
64-
}
54+
context.color().draw_surface(m_get_func() ? Resources::checkbox_checked : Resources::checkbox,
55+
Vector(pos.x + static_cast<float>(menu_width) - 16.0f - static_cast<float>(Resources::checkbox->get_width()),
56+
pos.y - 8.0f),
57+
LAYER_GUI);
6558
}
6659

6760
int

0 commit comments

Comments
 (0)