Fixed mouse wheel and keyboard support

This commit is contained in:
xawotihs
2014-12-03 23:51:16 +01:00
parent 8f19439fae
commit f5702dbdc5

View File

@@ -114,6 +114,7 @@ protected:
private: private:
WagicCore m_Wagic; WagicCore m_Wagic;
Platform::Agile<CoreWindow> m_window;
bool m_windowClosed; bool m_windowClosed;
bool m_windowVisible; bool m_windowVisible;
}; };
@@ -147,6 +148,7 @@ void WagicApp::Initialize(CoreApplicationView^ applicationView)
void WagicApp::SetWindow(CoreWindow^ window) void WagicApp::SetWindow(CoreWindow^ window)
{ {
m_window = window;
window->SizeChanged += window->SizeChanged +=
ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &WagicApp::OnWindowSizeChanged); ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &WagicApp::OnWindowSizeChanged);
@@ -201,6 +203,7 @@ void WagicApp::Run()
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
} }
} }
CoreApplication::Exit();
} }
void WagicApp::Uninitialize() void WagicApp::Uninitialize()
@@ -251,6 +254,7 @@ void WagicApp::OnKeyDown(CoreWindow^ sender, KeyEventArgs^ args)
WPARAM param = (WPARAM) args->VirtualKey; WPARAM param = (WPARAM) args->VirtualKey;
m_Wagic.onKeyDown(param); m_Wagic.onKeyDown(param);
m_Wagic.onUpdate();
} }
void WagicApp::OnKeyUp(CoreWindow^ sender, KeyEventArgs^ args) void WagicApp::OnKeyUp(CoreWindow^ sender, KeyEventArgs^ args)
@@ -263,9 +267,9 @@ void WagicApp::OnKeyUp(CoreWindow^ sender, KeyEventArgs^ args)
void WagicApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args) void WagicApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
{ {
if(args->CurrentPoint->Properties->IsHorizontalMouseWheel) if(args->CurrentPoint->Properties->IsHorizontalMouseWheel)
m_Wagic.onWheelChanged(0, 3*args->CurrentPoint->Properties->MouseWheelDelta);
else
m_Wagic.onWheelChanged(3*args->CurrentPoint->Properties->MouseWheelDelta, 0); m_Wagic.onWheelChanged(3*args->CurrentPoint->Properties->MouseWheelDelta, 0);
else
m_Wagic.onWheelChanged(0, 3*args->CurrentPoint->Properties->MouseWheelDelta);
} }
void WagicApp::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) void WagicApp::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)