diff options
| author | Reece Mackie <[email protected]> | 2020-04-30 18:48:39 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-04-30 19:48:39 +0200 |
| commit | 4b0386081037172222d91f0ccca93e5810fed84b (patch) | |
| tree | 3a554752c00af2255a4caecb553e19cd4b37cb7f /projects/VS2017.UWP/raylib.App.UWP/App.h | |
| parent | 2f454aa4b051d000daab0dd71417a716af095e91 (diff) | |
| download | raylib-4b0386081037172222d91f0ccca93e5810fed84b.tar.gz raylib-4b0386081037172222d91f0ccca93e5810fed84b.zip | |
UWP rework (#1231)
* First draft of UWP rework.
* Read desc
- Moved UWP specific functions to uwp_events.h
- Removed BaseApp.
- Implemented example UWP lifecycle.
* Added GIF recording and screenshot support.
* Character inputs and filesystem stuff
* Fix game closing on Xbox when B is pressed.
* Fix the gamepad binding hack
* Add as many keys as I believe are possible.
* Implemented mouse locking of a sort.
* Remove rogue todo, the rest are for a game dev using this example.
* Implemented touch how I "think" it should work. I cant test this.
* Review.
Diffstat (limited to 'projects/VS2017.UWP/raylib.App.UWP/App.h')
| -rw-r--r-- | projects/VS2017.UWP/raylib.App.UWP/App.h | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/projects/VS2017.UWP/raylib.App.UWP/App.h b/projects/VS2017.UWP/raylib.App.UWP/App.h index 7b96d16e..6cbeadac 100644 --- a/projects/VS2017.UWP/raylib.App.UWP/App.h +++ b/projects/VS2017.UWP/raylib.App.UWP/App.h @@ -4,22 +4,49 @@ #include "pch.h" -// Define what header we use for BaseApp.h -#define PCH "pch.h" - -// Enable hold hack -#define HOLDHACK - -#include "BaseApp.h" - namespace raylibUWP { - ref class App sealed : public BaseApp + ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView { - public: - - App(); + public: + App(); + + // IFrameworkView methods. + void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView) override; + void SetWindow(Windows::UI::Core::CoreWindow^ window) override; + void Load(Platform::String^ entryPoint) override; + void Run() override; + void Uninitialize() override; + private: + bool mWindowVisible = true; + bool mSuspended = false; + + void GameLoop(); + void PreProcessInputs(); + void PostProcessInputs(); + + // Helpers + int GetRaylibKey(Windows::System::VirtualKey kVey); + + // Events + 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 OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ 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); + void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); + void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); + void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); + void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args); + void OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args); + }; - void Update() override; + ref class AppSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource + { + public: + Windows::ApplicationModel::Core::IFrameworkView^ CreateView() override; }; } |
