2012-10-27 20:12:31 -04:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "SDLmain_WinRT_common.h"
|
2012-10-28 23:01:31 -04:00
|
|
|
|
#include "SDL_winrtvideo.h"
|
2012-10-28 18:45:33 -04:00
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
using namespace Windows::UI::Core;
|
2012-10-27 20:12:31 -04:00
|
|
|
|
|
|
|
|
|
ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
|
|
|
|
|
{
|
|
|
|
|
public:
|
2013-01-08 23:11:22 -05:00
|
|
|
|
SDL_WinRTApp();
|
|
|
|
|
|
|
|
|
|
// IFrameworkView Methods.
|
|
|
|
|
virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
|
|
|
|
|
virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
|
|
|
|
|
virtual void Load(Platform::String^ entryPoint);
|
|
|
|
|
virtual void Run();
|
|
|
|
|
virtual void Uninitialize();
|
2012-10-27 20:12:31 -04:00
|
|
|
|
|
2012-10-28 18:45:33 -04:00
|
|
|
|
internal:
|
|
|
|
|
// SDL-specific methods
|
|
|
|
|
SDL_DisplayMode GetMainDisplayMode();
|
2012-10-28 20:04:26 -04:00
|
|
|
|
void PumpEvents();
|
2012-10-29 23:32:13 -04:00
|
|
|
|
const SDL_WindowData * GetSDLWindowData() const;
|
2012-10-28 23:20:18 -04:00
|
|
|
|
bool HasSDLWindowData() const;
|
2012-12-28 13:24:36 -05:00
|
|
|
|
void SetRelativeMouseMode(bool enable);
|
2012-10-29 23:32:13 -04:00
|
|
|
|
void SetSDLWindowData(const SDL_WindowData * windowData);
|
2013-02-17 23:23:59 -05:00
|
|
|
|
void SetSDLVideoDevice(const SDL_VideoDevice * videoDevice);
|
2012-11-25 23:27:12 -05:00
|
|
|
|
Windows::Foundation::Point TransformCursor(Windows::Foundation::Point rawPosition);
|
2012-10-28 18:45:33 -04:00
|
|
|
|
|
2012-10-27 20:12:31 -04:00
|
|
|
|
protected:
|
2013-01-08 23:11:22 -05:00
|
|
|
|
// Event Handlers.
|
|
|
|
|
void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
|
|
|
|
|
void OnLogicalDpiChanged(Platform::Object^ sender);
|
|
|
|
|
void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
|
|
|
|
|
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
|
|
|
|
|
void OnResuming(Platform::Object^ sender, Platform::Object^ args);
|
|
|
|
|
void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
|
|
|
|
|
void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
|
|
|
|
|
void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
|
|
|
|
void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
2013-02-10 10:39:24 -05:00
|
|
|
|
void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
2013-01-08 23:11:22 -05:00
|
|
|
|
void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
2012-12-28 13:24:36 -05:00
|
|
|
|
void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args);
|
2012-11-04 09:02:58 -05:00
|
|
|
|
void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
|
|
|
|
|
void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
|
2012-10-27 20:12:31 -04:00
|
|
|
|
|
2013-02-02 19:32:44 -05:00
|
|
|
|
private:
|
2013-01-08 23:11:22 -05:00
|
|
|
|
bool m_windowClosed;
|
|
|
|
|
bool m_windowVisible;
|
2012-10-28 23:01:31 -04:00
|
|
|
|
const SDL_WindowData* m_sdlWindowData;
|
2013-02-17 23:23:59 -05:00
|
|
|
|
const SDL_VideoDevice* m_sdlVideoDevice;
|
2012-12-28 13:24:36 -05:00
|
|
|
|
bool m_useRelativeMouseMode;
|
2012-10-27 20:12:31 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
|
|
|
|
|
{
|
|
|
|
|
public:
|
2013-01-08 23:11:22 -05:00
|
|
|
|
virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
|
2012-10-27 20:12:31 -04:00
|
|
|
|
};
|