InputConfigDiagBitmaps: Clean up code a bit more

Split out some math into a utility.
This commit is contained in:
Jasper St. Pierre
2014-07-11 07:57:52 -04:00
parent 3c411c33e8
commit 8abff435e6

View File

@ -29,6 +29,20 @@
class wxTimerEvent; class wxTimerEvent;
static void DrawCenteredRectangle(wxDC &dc, int x, int y, int w, int h)
{
x -= w / 2;
y -= h / 2;
dc.DrawRectangle(x, y, w, h);
}
#define COORD_VIS_SIZE 4
static void DrawCoordinate(wxDC &dc, int x, int y)
{
DrawCenteredRectangle(dc, x, y, COORD_VIS_SIZE, COORD_VIS_SIZE);
}
static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g) static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
{ {
switch (g->control_group->type) switch (g->control_group->type)
@ -145,22 +159,17 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
// raw dot // raw dot
dc.SetPen(*wxGREY_PEN); dc.SetPen(*wxGREY_PEN);
dc.SetBrush(*wxGREY_BRUSH); dc.SetBrush(*wxGREY_BRUSH);
// i like the dot better than the cross i think DrawCoordinate(dc, xx, yy);
dc.DrawRectangle(xx - 2, yy - 2, 4, 4);
//dc.DrawRectangle(xx-1, 64-yy-4, 2, 8);
//dc.DrawRectangle(xx-4, 64-yy-1, 8, 2);
// adjusted dot // adjusted dot
if (x!=32 || y!=32) if (x!=32 || y!=32)
{ {
dc.SetPen(*wxRED_PEN); dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxRED_BRUSH); dc.SetBrush(*wxRED_BRUSH);
dc.DrawRectangle(x-2, 64-y-2, 4, 4); // XXX: The adjusted values flip the Y axis to be in the format
// i like the dot better than the cross i think // the Wii expects. Should this be in WiimoteEmu.cpp instead?
//dc.DrawRectangle(x-1, 64-y-4, 2, 8); DrawCoordinate(dc, x, 64 - y);
//dc.DrawRectangle(x-4, 64-y-1, 8, 2);
} }
} }
break; break;
case GROUP_TYPE_FORCE : case GROUP_TYPE_FORCE :