[go: nahoru, domu]

Skip to content

Commit

Permalink
Full support for Wii U Pro controller, can use sticks to scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
CreeperMario committed Jul 17, 2017
1 parent d2a3fe0 commit cb147f6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/gui/DWPadController.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,29 +122,37 @@ class DWPadController : public GuiController
data.buttons_r = remapWiiMoteButtons(kpadData.btns_r);
data.buttons_h = remapWiiMoteButtons(kpadData.btns_h);
data.buttons_d = remapWiiMoteButtons(kpadData.btns_d);

data.lstick.x = kpadData.nunchuck.stick_x;
data.lstick.y = kpadData.nunchuck.stick_y;
}
else
{
if(kpadData.btns_h & WPAD_BUTTON_LEFT)
if(kpadData.classic.btns_h & WPAD_CLASSIC_BUTTON_LEFT)
{
if(data.x > -(width / 2)) data.x -= 10;
}
if(kpadData.btns_h & WPAD_BUTTON_RIGHT)
if(kpadData.classic.btns_h & WPAD_CLASSIC_BUTTON_RIGHT)
{
if(data.x < (width / 2)) data.x += 10;
}
if(kpadData.btns_h & WPAD_BUTTON_UP)
if(kpadData.classic.btns_h & WPAD_CLASSIC_BUTTON_UP)
{
if(data.y < (height / 2)) data.y += 10;
}
if(kpadData.btns_h & WPAD_BUTTON_DOWN)
if(kpadData.classic.btns_h & WPAD_CLASSIC_BUTTON_DOWN)
{
if(data.y > -(height / 2)) data.y -= 10;
}

data.buttons_r = remapClassicButtons(kpadData.classic.btns_r);
data.buttons_h = remapClassicButtons(kpadData.classic.btns_h);
data.buttons_d = remapClassicButtons(kpadData.classic.btns_d);

data.lstick.x = kpadData.classic.lstick_x;
data.lstick.y = kpadData.classic.lstick_y;
data.rstick.x = kpadData.classic.rstick_x;
data.rstick.y = kpadData.classic.rstick_y;
}

return true;
Expand Down
8 changes: 8 additions & 0 deletions src/gui/WPadController.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,20 @@ class WPadController : public GuiController
data.buttons_r = remapWiiMoteButtons(kpadData.btns_r);
data.buttons_h = remapWiiMoteButtons(kpadData.btns_h);
data.buttons_d = remapWiiMoteButtons(kpadData.btns_d);

data.lstick.x = kpadData.nunchuck.stick_x;
data.lstick.y = kpadData.nunchuck.stick_y;
}
else
{
data.buttons_r = remapClassicButtons(kpadData.classic.btns_r);
data.buttons_h = remapClassicButtons(kpadData.classic.btns_h);
data.buttons_d = remapClassicButtons(kpadData.classic.btns_d);

data.lstick.x = kpadData.classic.lstick_x;
data.lstick.y = kpadData.classic.lstick_y;
data.rstick.x = kpadData.classic.rstick_x;
data.rstick.y = kpadData.classic.rstick_y;
}

data.validPointer = (kpadData.pos_valid == 1 || kpadData.pos_valid == 2) && (kpadData.pos_x >= -1.0f && kpadData.pos_x <= 1.0f) && (kpadData.pos_y >= -1.0f && kpadData.pos_y <= 1.0f);
Expand Down

0 comments on commit cb147f6

Please sign in to comment.