diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-07-11 07:57:52 -0400 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-07-11 13:32:57 -0400 |
| commit | 8abff435e6aaf7df661a598b4a8c799a08623bd0 (patch) | |
| tree | 759f132be5ac9c1d98d6fb03d2d5c07071b334fa /Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp | |
| parent | 3c411c33e8869a9d9953dc5422743faf043f2bc5 (diff) | |
InputConfigDiagBitmaps: Clean up code a bit more
Split out some math into a utility.
Diffstat (limited to 'Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp b/Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp index 0a17bda9c5..581f08a7f8 100644 --- a/Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp +++ b/Source/Core/DolphinWX/InputConfigDiagBitmaps.cpp @@ -29,6 +29,20 @@ 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) { switch (g->control_group->type) @@ -145,22 +159,17 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g) // raw dot dc.SetPen(*wxGREY_PEN); dc.SetBrush(*wxGREY_BRUSH); - // i like the dot better than the cross i think - 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); + DrawCoordinate(dc, xx, yy); // adjusted dot if (x!=32 || y!=32) { dc.SetPen(*wxRED_PEN); dc.SetBrush(*wxRED_BRUSH); - dc.DrawRectangle(x-2, 64-y-2, 4, 4); - // i like the dot better than the cross i think - //dc.DrawRectangle(x-1, 64-y-4, 2, 8); - //dc.DrawRectangle(x-4, 64-y-1, 8, 2); + // XXX: The adjusted values flip the Y axis to be in the format + // the Wii expects. Should this be in WiimoteEmu.cpp instead? + DrawCoordinate(dc, x, 64 - y); } - } break; case GROUP_TYPE_FORCE : |
