Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions WiiTUIO/Input/WiiProvider/Keymap/WiiKeyMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,24 +287,28 @@ public void updateAccelerometer(AccelState accelState)
public void updateNunchuk(NunchukState nunchuk)
{
KeymapOutConfig outConfig;
double joyX = (nunchuk.RawJoystick.X - 127f) / 128f * 0.5;
double joyY = (nunchuk.RawJoystick.Y - 128f) / 127f * 0.5;

//Console.WriteLine(nunchuk.RawJoystick.X +"," + nunchuk.RawJoystick.Y + "|" + joyX + "," + joyY);

if (this.config.TryGetValue("Nunchuk.StickRight", out outConfig))
{
if (nunchuk.Joystick.X > 0)
if (joyX > 0)
{
updateStickHandlers(outConfig, nunchuk.Joystick.X * 2);
updateStickHandlers(outConfig, joyX * 2);
}
else if (nunchuk.Joystick.X == 0)
else if (joyX == 0)
{
updateStickHandlers(outConfig, 0);
}

if (nunchuk.Joystick.X * 2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickRight"])
if (joyX * 2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickRight"])
{
PressedButtons["Nunchuk.StickRight"] = true;
this.executeButtonDown("Nunchuk.StickRight");
}
else if (nunchuk.Joystick.X * 2 < outConfig.Threshold && PressedButtons["Nunchuk.StickRight"])
else if (joyX * 2 < outConfig.Threshold && PressedButtons["Nunchuk.StickRight"])
{
PressedButtons["Nunchuk.StickRight"] = false;
this.executeButtonUp("Nunchuk.StickRight");
Expand All @@ -313,43 +317,43 @@ public void updateNunchuk(NunchukState nunchuk)

if (this.config.TryGetValue("Nunchuk.StickLeft", out outConfig))
{
if (nunchuk.Joystick.X < 0)
if (joyX < 0)
{
updateStickHandlers(outConfig, nunchuk.Joystick.X * -2);
updateStickHandlers(outConfig, joyX * -2);
}
else if (nunchuk.Joystick.X == 0)
else if (joyX == 0)
{
updateStickHandlers(outConfig, 0);
}

if (nunchuk.Joystick.X * -2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickLeft"])
if (joyX * -2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickLeft"])
{
PressedButtons["Nunchuk.StickLeft"] = true;
this.executeButtonDown("Nunchuk.StickLeft");
}
else if (nunchuk.Joystick.X * -2 < outConfig.Threshold && PressedButtons["Nunchuk.StickLeft"])
else if (joyX * -2 < outConfig.Threshold && PressedButtons["Nunchuk.StickLeft"])
{
PressedButtons["Nunchuk.StickLeft"] = false;
this.executeButtonUp("Nunchuk.StickLeft");
}
}
if (this.config.TryGetValue("Nunchuk.StickUp", out outConfig))
{
if (nunchuk.Joystick.Y > 0)
if (joyY > 0)
{
updateStickHandlers(outConfig, nunchuk.Joystick.Y * 2);
updateStickHandlers(outConfig, joyY * 2);
}
else if (nunchuk.Joystick.Y == 0)
else if (joyY == 0)
{
updateStickHandlers(outConfig, 0);
}

if (nunchuk.Joystick.Y * 2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickUp"])
if (joyY * 2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickUp"])
{
PressedButtons["Nunchuk.StickUp"] = true;
this.executeButtonDown("Nunchuk.StickUp");
}
else if (nunchuk.Joystick.Y * 2 < outConfig.Threshold && PressedButtons["Nunchuk.StickUp"])
else if (joyY * 2 < outConfig.Threshold && PressedButtons["Nunchuk.StickUp"])
{
PressedButtons["Nunchuk.StickUp"] = false;
this.executeButtonUp("Nunchuk.StickUp");
Expand All @@ -358,21 +362,21 @@ public void updateNunchuk(NunchukState nunchuk)
}
if (this.config.TryGetValue("Nunchuk.StickDown", out outConfig))
{
if (nunchuk.Joystick.Y < 0)
if (joyY < 0)
{
updateStickHandlers(outConfig, nunchuk.Joystick.Y * -2);
updateStickHandlers(outConfig, joyY * -2);
}
else if (nunchuk.Joystick.Y == 0)
else if (joyY == 0)
{
updateStickHandlers(outConfig, 0);
}

if (nunchuk.Joystick.Y * -2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickDown"])
if (joyY * -2 > outConfig.Threshold && !PressedButtons["Nunchuk.StickDown"])
{
PressedButtons["Nunchuk.StickDown"] = true;
this.executeButtonDown("Nunchuk.StickDown");
}
else if (nunchuk.Joystick.Y * -2 < outConfig.Threshold && PressedButtons["Nunchuk.StickDown"])
else if (joyY * -2 < outConfig.Threshold && PressedButtons["Nunchuk.StickDown"])
{
PressedButtons["Nunchuk.StickDown"] = false;
this.executeButtonUp("Nunchuk.StickDown");
Expand Down
2 changes: 1 addition & 1 deletion WiiTUIO/WiiTUIO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
<PostBuildEvent>copy "$(ProjectDir)VMultiDll_$(PlatformName).dll" "$(TargetDir)VMultiDll.dll" /Y
xcopy "$(TargetDir)..\$(ConfigurationName)" "C:\Program Files\Touchmote" /H /Y
cd "C:\Program Files\Touchmote"
"C:\Program Files (x86)\Windows Kits\8.1\bin\$(PlatformName)\signtool.exe" sign /v /a /s ROOT /n Touchmote /t http://timestamp.verisign.com/scripts/timstamp.dll "C:\Program Files\Touchmote\Touchmote.exe"</PostBuildEvent>
"C:\Program Files (x86)\Windows Kits\8.1\bin\$(PlatformName)\signtool.exe" sign /v /a /s ROOT /n Touchmote /t http://timestamp.sectigo.com "C:\Program Files\Touchmote\Touchmote.exe"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down