Fix using Keyboard and Mouse in C# scripting
This commit is contained in:
@@ -260,7 +260,7 @@ namespace
|
||||
String AppPackageName, DeviceManufacturer, DeviceModel, DeviceBuildNumber;
|
||||
String SystemVersion, SystemLanguage, CacheDir, ExecutablePath;
|
||||
byte MacAddress[6];
|
||||
AndroidKeyboard KeyboardImpl;
|
||||
AndroidKeyboard* KeyboardImpl;
|
||||
AndroidDeviceGamepad* GamepadImpl;
|
||||
AndroidTouchScreen* TouchScreenImpl;
|
||||
ScreenOrientationType Orientation;
|
||||
@@ -496,9 +496,9 @@ namespace
|
||||
if (eventType.KeyboardKey != KeyboardKeys::None)
|
||||
{
|
||||
if (isDown)
|
||||
KeyboardImpl.OnKeyDown(eventType.KeyboardKey);
|
||||
KeyboardImpl->OnKeyDown(eventType.KeyboardKey);
|
||||
else
|
||||
KeyboardImpl.OnKeyUp(eventType.KeyboardKey);
|
||||
KeyboardImpl->OnKeyUp(eventType.KeyboardKey);
|
||||
}
|
||||
|
||||
// Gamepad
|
||||
@@ -850,7 +850,7 @@ bool AndroidPlatform::Init()
|
||||
}
|
||||
|
||||
// Setup native platform input devices
|
||||
Input::Keyboard = &KeyboardImpl;
|
||||
Input::Keyboard = KeyboardImpl = New<AndroidKeyboard>();
|
||||
Input::Gamepads.Add(GamepadImpl = New<AndroidDeviceGamepad>());
|
||||
Input::OnGamepadsChanged();
|
||||
Input::CustomDevices.Add(TouchScreenImpl = New<AndroidTouchScreen>());
|
||||
|
||||
@@ -1195,8 +1195,8 @@ struct Property
|
||||
|
||||
namespace Impl
|
||||
{
|
||||
LinuxKeyboard Keyboard;
|
||||
LinuxMouse Mouse;
|
||||
LinuxKeyboard* Keyboard;
|
||||
LinuxMouse* Mouse;
|
||||
StringAnsi ClipboardText;
|
||||
|
||||
void ClipboardGetText(String& result, X11::Atom source, X11::Atom atom, X11::Window window)
|
||||
@@ -2193,8 +2193,8 @@ bool LinuxPlatform::Init()
|
||||
}
|
||||
}
|
||||
|
||||
Input::Mouse = &Impl::Mouse;
|
||||
Input::Keyboard = &Impl::Keyboard;
|
||||
Input::Mouse = Impl::Mouse = New<LinuxMouse>();
|
||||
Input::Keyboard = Impl::Keyboard = New<LinuxKeyboard>();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ UWPPlatformImpl* CUWPPlatform = nullptr;
|
||||
|
||||
namespace Impl
|
||||
{
|
||||
extern UWPWindow::UWPKeyboard Keyboard;
|
||||
extern UWPWindow::UWPMouse Mouse;
|
||||
extern UWPWindow::UWPKeyboard* Keyboard;
|
||||
extern UWPWindow::UWPMouse* Mouse;
|
||||
extern UWPWindow* Window;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ bool UWPPlatform::Init()
|
||||
UserName = String::Empty;
|
||||
|
||||
SystemDpi = CUWPPlatform->GetDpi();
|
||||
Input::Mouse = &Impl::Mouse;
|
||||
Input::Keyboard = &Impl::Keyboard;
|
||||
Input::Mouse = Impl::Mouse = New<UWPWindow::UWPMouse>();
|
||||
Input::Keyboard = Impl::Keyboard = New<UWPWindow::UWPKeyboard>();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Impl
|
||||
{
|
||||
UWPWindow::UWPKeyboard Keyboard;
|
||||
UWPWindow::UWPMouse Mouse;
|
||||
UWPWindow::UWPKeyboard* Keyboard = nullptr;
|
||||
UWPWindow::UWPMouse* Mouse = nullptr;
|
||||
UWPWindow* Window = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,14 +105,14 @@ namespace WindowsInputImpl
|
||||
{
|
||||
float XInputLastUpdateTime = 0;
|
||||
bool XInputGamepads[XUSER_MAX_COUNT] = { false };
|
||||
WindowsMouse Mouse;
|
||||
WindowsKeyboard Keyboard;
|
||||
WindowsMouse* Mouse = nullptr;
|
||||
WindowsKeyboard* Keyboard = nullptr;
|
||||
}
|
||||
|
||||
void WindowsInput::Init()
|
||||
{
|
||||
Input::Mouse = &WindowsInputImpl::Mouse;
|
||||
Input::Keyboard = &WindowsInputImpl::Keyboard;
|
||||
Input::Mouse = WindowsInputImpl::Mouse = New<WindowsMouse>();
|
||||
Input::Keyboard = WindowsInputImpl::Keyboard = New<WindowsKeyboard>();
|
||||
}
|
||||
|
||||
void WindowsInput::Update()
|
||||
@@ -142,9 +142,9 @@ void WindowsInput::Update()
|
||||
|
||||
bool WindowsInput::WndProc(Window* window, Windows::UINT msg, Windows::WPARAM wParam, Windows::LPARAM lParam)
|
||||
{
|
||||
if (WindowsInputImpl::Mouse.WndProc(window, msg, wParam, lParam))
|
||||
if (WindowsInputImpl::Mouse->WndProc(window, msg, wParam, lParam))
|
||||
return true;
|
||||
if (WindowsInputImpl::Keyboard.WndProc(window, msg, wParam, lParam))
|
||||
if (WindowsInputImpl::Keyboard->WndProc(window, msg, wParam, lParam))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user