InputConfigDiagBitmaps: Start a cleanup by splitting code out
This doesn't have any functional changes, it just removes part of the mess by killing indentation.
This commit is contained in:
parent
68a4979f35
commit
3c411c33e8
|
@ -29,36 +29,8 @@
|
||||||
|
|
||||||
class wxTimerEvent;
|
class wxTimerEvent;
|
||||||
|
|
||||||
void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
|
||||||
{
|
{
|
||||||
wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
|
|
||||||
|
|
||||||
g_controller_interface.UpdateInput();
|
|
||||||
|
|
||||||
// don't want game thread updating input when we are using it here
|
|
||||||
std::unique_lock<std::recursive_mutex> lk(g_controller_interface.update_lock, std::try_to_lock);
|
|
||||||
if (!lk.owns_lock())
|
|
||||||
return;
|
|
||||||
|
|
||||||
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage(m_pad_notebook->GetSelection());
|
|
||||||
|
|
||||||
for (ControlGroupBox* g : current_page->control_groups)
|
|
||||||
{
|
|
||||||
// if this control group has a bitmap
|
|
||||||
if (g->static_bitmap)
|
|
||||||
{
|
|
||||||
wxMemoryDC dc;
|
|
||||||
wxBitmap bitmap(g->static_bitmap->GetBitmap());
|
|
||||||
dc.SelectObject(bitmap);
|
|
||||||
dc.Clear();
|
|
||||||
|
|
||||||
dc.SetFont(small_font);
|
|
||||||
dc.SetTextForeground(0xC0C0C0);
|
|
||||||
|
|
||||||
// label for sticks and stuff
|
|
||||||
if (64 == bitmap.GetHeight())
|
|
||||||
dc.DrawText(StrToWxStr(g->control_group->name).Upper(), 4, 2);
|
|
||||||
|
|
||||||
switch (g->control_group->type)
|
switch (g->control_group->type)
|
||||||
{
|
{
|
||||||
case GROUP_TYPE_TILT :
|
case GROUP_TYPE_TILT :
|
||||||
|
@ -385,9 +357,42 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
||||||
dc.DrawRectangle(32 - deadzone * 32, 0, deadzone * 64, 14);
|
dc.DrawRectangle(32 - deadzone * 32, 0, deadzone * 64, 14);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxFont small_font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
|
||||||
|
|
||||||
|
g_controller_interface.UpdateInput();
|
||||||
|
|
||||||
|
// don't want game thread updating input when we are using it here
|
||||||
|
std::unique_lock<std::recursive_mutex> lk(g_controller_interface.update_lock, std::try_to_lock);
|
||||||
|
if (!lk.owns_lock())
|
||||||
|
return;
|
||||||
|
|
||||||
|
GamepadPage* const current_page = (GamepadPage*)m_pad_notebook->GetPage(m_pad_notebook->GetSelection());
|
||||||
|
|
||||||
|
for (ControlGroupBox* g : current_page->control_groups)
|
||||||
|
{
|
||||||
|
// if this control group has a bitmap
|
||||||
|
if (g->static_bitmap)
|
||||||
|
{
|
||||||
|
wxMemoryDC dc;
|
||||||
|
wxBitmap bitmap(g->static_bitmap->GetBitmap());
|
||||||
|
dc.SelectObject(bitmap);
|
||||||
|
dc.Clear();
|
||||||
|
|
||||||
|
dc.SetFont(small_font);
|
||||||
|
dc.SetTextForeground(0xC0C0C0);
|
||||||
|
|
||||||
|
// label for sticks and stuff
|
||||||
|
if (64 == bitmap.GetHeight())
|
||||||
|
dc.DrawText(StrToWxStr(g->control_group->name).Upper(), 4, 2);
|
||||||
|
|
||||||
|
DrawControlGroupBox(dc, g);
|
||||||
|
|
||||||
// box outline
|
// box outline
|
||||||
// Windows XP color
|
// Windows XP color
|
||||||
|
|
Loading…
Reference in New Issue