Window related changes (#308)

* Use integer math for touch screen

* Sleep polling thread

* Rework host input

* Add fullscreen with F11 or Alt+Enter

* Address feedback
This commit is contained in:
ReinUsesLisp 2018-07-29 01:35:36 -03:00 committed by gdkchan
parent 51605fafc0
commit 7a308d9e73
4 changed files with 376 additions and 206 deletions

View file

@ -1,3 +1,6 @@
using OpenTK.Input;
using Ryujinx.HLE.Input;
namespace Ryujinx.UI.Input
{
public struct JoyConKeyboardLeft
@ -32,9 +35,68 @@ namespace Ryujinx.UI.Input
public int ButtonZR;
}
public struct JoyConKeyboard
public class JoyConKeyboard
{
public JoyConKeyboardLeft Left;
public JoyConKeyboardLeft Left;
public JoyConKeyboardRight Right;
public JoyConKeyboard(
JoyConKeyboardLeft Left,
JoyConKeyboardRight Right)
{
this.Left = Left;
this.Right = Right;
}
public HidControllerButtons GetButtons(KeyboardState Keyboard)
{
HidControllerButtons Buttons = 0;
if (Keyboard[(Key)Left.StickButton]) Buttons |= HidControllerButtons.KEY_LSTICK;
if (Keyboard[(Key)Left.DPadUp]) Buttons |= HidControllerButtons.KEY_DUP;
if (Keyboard[(Key)Left.DPadDown]) Buttons |= HidControllerButtons.KEY_DDOWN;
if (Keyboard[(Key)Left.DPadLeft]) Buttons |= HidControllerButtons.KEY_DLEFT;
if (Keyboard[(Key)Left.DPadRight]) Buttons |= HidControllerButtons.KEY_DRIGHT;
if (Keyboard[(Key)Left.ButtonMinus]) Buttons |= HidControllerButtons.KEY_MINUS;
if (Keyboard[(Key)Left.ButtonL]) Buttons |= HidControllerButtons.KEY_L;
if (Keyboard[(Key)Left.ButtonZL]) Buttons |= HidControllerButtons.KEY_ZL;
if (Keyboard[(Key)Right.StickButton]) Buttons |= HidControllerButtons.KEY_RSTICK;
if (Keyboard[(Key)Right.ButtonA]) Buttons |= HidControllerButtons.KEY_A;
if (Keyboard[(Key)Right.ButtonB]) Buttons |= HidControllerButtons.KEY_B;
if (Keyboard[(Key)Right.ButtonX]) Buttons |= HidControllerButtons.KEY_X;
if (Keyboard[(Key)Right.ButtonY]) Buttons |= HidControllerButtons.KEY_Y;
if (Keyboard[(Key)Right.ButtonPlus]) Buttons |= HidControllerButtons.KEY_PLUS;
if (Keyboard[(Key)Right.ButtonR]) Buttons |= HidControllerButtons.KEY_R;
if (Keyboard[(Key)Right.ButtonZR]) Buttons |= HidControllerButtons.KEY_ZR;
return Buttons;
}
public (short, short) GetLeftStick(KeyboardState Keyboard)
{
short DX = 0;
short DY = 0;
if (Keyboard[(Key)Left.StickUp]) DY = short.MaxValue;
if (Keyboard[(Key)Left.StickDown]) DY = -short.MaxValue;
if (Keyboard[(Key)Left.StickLeft]) DX = -short.MaxValue;
if (Keyboard[(Key)Left.StickRight]) DX = short.MaxValue;
return (DX, DY);
}
public (short, short) GetRightStick(KeyboardState Keyboard)
{
short DX = 0;
short DY = 0;
if (Keyboard[(Key)Right.StickUp]) DY = short.MaxValue;
if (Keyboard[(Key)Right.StickDown]) DY = -short.MaxValue;
if (Keyboard[(Key)Right.StickLeft]) DX = -short.MaxValue;
if (Keyboard[(Key)Right.StickRight]) DX = short.MaxValue;
return (DX, DY);
}
}
}