You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

574 lines
24 KiB

UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
UWP Support Overhaul (#819) * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
5 years ago
  1. #include "pch.h"
  2. #include "app.h"
  3. #include <Windows.h>
  4. #include <raylib.h>
  5. #include <uwp_events.h>
  6. #include <gestures.h>
  7. #include <chrono>
  8. #include <thread>
  9. using namespace Windows::ApplicationModel::Core;
  10. using namespace Windows::ApplicationModel::Activation;
  11. using namespace Windows::UI::Core;
  12. using namespace Windows::UI::Input;
  13. using namespace Windows::Devices::Input;
  14. using namespace Windows::Foundation;
  15. using namespace Windows::Foundation::Collections;
  16. using namespace Windows::Gaming::Input;
  17. using namespace Windows::Graphics::Display;
  18. using namespace Microsoft::WRL;
  19. using namespace Platform;
  20. using namespace raylibUWP;
  21. // Stand-ins for "core.c" variables
  22. #define MAX_GAMEPADS 4 // Max number of gamepads supported
  23. #define MAX_GAMEPAD_BUTTONS 32 // Max bumber of buttons supported (per gamepad)
  24. #define MAX_GAMEPAD_AXIS 8 // Max number of axis supported (per gamepad)
  25. // Gamepad bindings struct
  26. struct GamepadBinding
  27. {
  28. Gamepad^ Gamepad = nullptr;
  29. bool Ready = false;
  30. };
  31. // Global variables
  32. static int posX = 100;
  33. static int posY = 100;
  34. static int gTime = 0;
  35. static bool mouseLocked = false;
  36. static GamepadBinding gGamepadBindings[MAX_GAMEPADS];
  37. // The main function creates an IFrameworkViewSource for our app, and runs the app
  38. [Platform::MTAThread]
  39. int main(Platform::Array<Platform::String^>^)
  40. {
  41. auto appSource = ref new AppSource();
  42. CoreApplication::Run(appSource);
  43. return 0;
  44. }
  45. // App implementation
  46. App::App()
  47. {
  48. // Currently, UWP ignores flags... You must implement flag functionality yourself
  49. SetConfigFlags(0);
  50. }
  51. void App::Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView)
  52. {
  53. // Register event handlers for app lifecycle. This example includes Activated, so that we
  54. // can make the CoreWindow active and start rendering on the window.
  55. applicationView->Activated += ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &App::OnActivated);
  56. // Logic for other event handlers could go here.
  57. // Information about the Suspending and Resuming event handlers can be found here:
  58. // http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994930.aspx
  59. CoreApplication::Suspending += ref new Windows::Foundation::EventHandler<Windows::ApplicationModel::SuspendingEventArgs^>(this, &App::OnSuspending);
  60. CoreApplication::Resuming += ref new EventHandler<Platform::Object^>(this, &App::OnResuming);
  61. // Store the app data directory
  62. auto dataPath = Windows::Storage::ApplicationData::Current->LocalFolder->Path;
  63. std::wstring dataPathW(dataPath->Begin());
  64. static std::string dataPathA(dataPathW.begin(), dataPathW.end());
  65. UWPSetDataPath(dataPathA.c_str());
  66. }
  67. void App::SetWindow(Windows::UI::Core::CoreWindow^ window)
  68. {
  69. // Hook window events
  70. window->SizeChanged += ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &App::OnWindowSizeChanged);
  71. window->VisibilityChanged += ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &App::OnVisibilityChanged);
  72. // Hook mouse pointer events
  73. window->PointerPressed += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerPressed);
  74. window->PointerReleased += ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow^, Windows::UI::Core::PointerEventArgs^>(this, &App::OnPointerReleased);
  75. window->PointerWheelChanged += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerWheelChanged);
  76. window->PointerMoved += ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow^, Windows::UI::Core::PointerEventArgs^>(this, &App::OnPointerMoved);
  77. // Hook keyboard events.
  78. window->KeyDown += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &App::OnKeyDown);
  79. window->KeyUp += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &App::OnKeyUp);
  80. window->CharacterReceived += ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow^, Windows::UI::Core::CharacterReceivedEventArgs^>(this, &raylibUWP::App::OnCharacterReceived);
  81. // The CoreWindow has been created, we can pass this to raylib for EGL context creation when it's time
  82. UWPSetCoreWindowPtr((void*)window);
  83. // Register backrequested event to stop window from being closed (Most noticable on XBox when B is pressed)
  84. auto navigation = SystemNavigationManager::GetForCurrentView();
  85. navigation->BackRequested += ref new Windows::Foundation::EventHandler<Windows::UI::Core::BackRequestedEventArgs^>(this, &raylibUWP::App::OnBackRequested);
  86. }
  87. void App::Load(Platform::String ^entryPoint) {} // Ignored for this example
  88. void App::Run()
  89. {
  90. // Set up our UWP implementation
  91. UWPSetQueryTimeFunc([]() {
  92. static auto timeStart = std::chrono::high_resolution_clock::now();
  93. std::chrono::duration<double> time_span = std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::high_resolution_clock::now() - timeStart);
  94. return time_span.count(); });
  95. UWPSetSleepFunc([](double seconds) { std::this_thread::sleep_for(std::chrono::duration<double>(seconds)); });
  96. UWPSetDisplaySizeFunc([](int* width, int* height) {
  97. // Get display dimensions
  98. DisplayInformation^ dInfo = DisplayInformation::GetForCurrentView();
  99. *width = dInfo->ScreenWidthInRawPixels;
  100. *height = dInfo->ScreenHeightInRawPixels; });
  101. UWPSetMouseHideFunc([]() { CoreWindow::GetForCurrentThread()->PointerCursor = nullptr; });
  102. UWPSetMouseShowFunc([]() { CoreWindow::GetForCurrentThread()->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); });
  103. UWPSetMouseLockFunc([]() {
  104. CoreWindow::GetForCurrentThread()->PointerCursor = nullptr;
  105. mouseLocked = true; });
  106. UWPSetMouseUnlockFunc([]() {
  107. CoreWindow::GetForCurrentThread()->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);
  108. mouseLocked = false; });
  109. UWPSetMouseSetPosFunc([](int x, int y) {
  110. CoreWindow^ window = CoreWindow::GetForCurrentThread();
  111. Point mousePosScreen = Point(x + window->Bounds.X, y + window->Bounds.Y);
  112. window->PointerPosition = mousePosScreen; });
  113. // Set custom output handle
  114. SetTraceLogCallback([](int logType, const char* text, va_list args)
  115. {
  116. std::string format = text;
  117. switch (logType)
  118. {
  119. case LOG_TRACE: format = std::string("TRACE: ") + format; break;
  120. case LOG_DEBUG: format = std::string("DEBUG: ") + format; break;
  121. case LOG_INFO: format = std::string("INFO: ") + format; break;
  122. case LOG_WARNING: format = std::string("WARNING: ") + format; break;
  123. case LOG_ERROR: format = std::string("ERROR: ") + format; break;
  124. case LOG_FATAL: format = std::string("FATAL: ") + format; break;
  125. default: break;
  126. }
  127. char buf[1024]; // TODO: Is this large enough?
  128. vsnprintf(buf, sizeof(buf), format.c_str(), args);
  129. std::string output = std::string(buf) + std::string("\n");
  130. OutputDebugStringA(output.c_str());
  131. });
  132. // Create window
  133. InitWindow(800, 450, "raylib UWP - Basic example");
  134. // Run game loop
  135. while (!WindowShouldClose() && !mSuspended)
  136. {
  137. if (mWindowVisible)
  138. {
  139. PreProcessInputs();
  140. GameLoop();
  141. PostProcessInputs();
  142. CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
  143. }
  144. else
  145. {
  146. CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
  147. }
  148. }
  149. CloseWindow();
  150. }
  151. void App::Uninitialize()
  152. {
  153. // Do any UWP cleanup here.
  154. }
  155. // This method is called every frame
  156. void App::GameLoop()
  157. {
  158. // Update
  159. //----------------------------------------------------------------------------------
  160. posX += GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X) * 5;
  161. posY += GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y) * -5;
  162. auto mPos = GetMousePosition();
  163. if (IsKeyPressed(KEY_A))
  164. {
  165. posX -= 50;
  166. EnableCursor();
  167. }
  168. if (IsKeyPressed(KEY_D))
  169. {
  170. posX += 50;
  171. DisableCursor();
  172. }
  173. static float pos = 0;
  174. pos -= GetMouseWheelMove();
  175. //----------------------------------------------------------------------------------
  176. // Draw
  177. //----------------------------------------------------------------------------------
  178. BeginDrawing();
  179. ClearBackground(RED);
  180. DrawRectangle(posX, posY, 400, 100, WHITE);
  181. DrawLine(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE);
  182. DrawCircle(mPos.x, mPos.y, 40, BLUE);
  183. if (IsKeyDown(KEY_S)) DrawCircle(100, 100, 100, BLUE);
  184. if (IsKeyDown(KEY_LEFT_ALT)) DrawRectangle(250, 250, 20, 20, BLACK);
  185. if (IsKeyDown(KEY_BACKSPACE)) DrawRectangle(280, 250, 20, 20, BLACK);
  186. if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) DrawRectangle(280, 250, 20, 20, BLACK);
  187. DrawRectangle(280, (int)pos + 50, 20, 20, BLACK);
  188. DrawRectangle(250, 280 + (gTime++ % 60), 10, 10, PURPLE);
  189. EndDrawing();
  190. //----------------------------------------------------------------------------------
  191. }
  192. void App::PreProcessInputs()
  193. {
  194. // Here, we will see if we have bound gamepads. If we do we check they are still present. If they aren't present we free the binding.
  195. // if anyone does not have a binding but there is a gamepad available, we will bind it to the first player who is missing a controller.
  196. for (auto i = 0; i < MAX_GAMEPADS; i++)
  197. {
  198. // Ensure that the gamepad bindings are still in tact
  199. if (gGamepadBindings[i].Gamepad != nullptr)
  200. {
  201. // Check the gamepad is present
  202. auto found = false;
  203. for (auto j = 0; j < Gamepad::Gamepads->Size; j++)
  204. {
  205. if (gGamepadBindings[i].Gamepad == Gamepad::Gamepads->GetAt(j))
  206. {
  207. found = true;
  208. break;
  209. }
  210. }
  211. if (!found)
  212. {
  213. gGamepadBindings[i].Gamepad = nullptr;
  214. gGamepadBindings[i].Ready = false;
  215. }
  216. else gGamepadBindings[i].Ready = true;
  217. }
  218. // Now we check to find any unbound gamepads we can use
  219. if (gGamepadBindings[i].Gamepad == nullptr)
  220. {
  221. // Loop over all the attached gamepads
  222. Gamepad^ freeGamepad = nullptr;
  223. for (auto j = 0; j < Gamepad::Gamepads->Size; j++)
  224. {
  225. freeGamepad = Gamepad::Gamepads->GetAt(j);
  226. // Loop over existing bindings
  227. for (auto k = 0; k < MAX_GAMEPADS; k++)
  228. {
  229. if (gGamepadBindings[k].Gamepad == freeGamepad)
  230. freeGamepad = nullptr;
  231. }
  232. // If we passed all 4, this is a free gamepad
  233. if (freeGamepad != nullptr) break;
  234. }
  235. if (freeGamepad != nullptr)
  236. {
  237. gGamepadBindings[i].Gamepad = freeGamepad;
  238. gGamepadBindings[i].Ready = true;
  239. }
  240. else gGamepadBindings[i].Ready = false;
  241. }
  242. }
  243. // Send the active gamepads to raylib
  244. for (int i = 0; i < MAX_GAMEPADS; i++)
  245. {
  246. UWPActivateGamepadEvent(i, gGamepadBindings[i].Ready);
  247. }
  248. // Get current gamepad state
  249. for (int i = 0; i < MAX_GAMEPADS; i++)
  250. {
  251. if (gGamepadBindings[i].Ready)
  252. {
  253. // Get current gamepad state
  254. auto gamepad = gGamepadBindings[i].Gamepad;
  255. auto reading = gamepad->GetCurrentReading();
  256. // Register all button presses
  257. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_FACE_DOWN, ((reading.Buttons & GamepadButtons::A) == GamepadButtons::A));
  258. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, ((reading.Buttons & GamepadButtons::B) == GamepadButtons::B));
  259. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_FACE_LEFT, ((reading.Buttons & GamepadButtons::X) == GamepadButtons::X));
  260. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_FACE_UP, ((reading.Buttons & GamepadButtons::Y) == GamepadButtons::Y));
  261. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_TRIGGER_1, ((reading.Buttons & GamepadButtons::LeftShoulder) == GamepadButtons::LeftShoulder));
  262. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_TRIGGER_1, ((reading.Buttons & GamepadButtons::RightShoulder) == GamepadButtons::RightShoulder));
  263. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_MIDDLE_LEFT, ((reading.Buttons & GamepadButtons::View) == GamepadButtons::View)); // Changed for XB1 Controller
  264. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_MIDDLE_RIGHT, ((reading.Buttons & GamepadButtons::Menu) == GamepadButtons::Menu)); // Changed for XB1 Controller
  265. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_FACE_UP, ((reading.Buttons & GamepadButtons::DPadUp) == GamepadButtons::DPadUp));
  266. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_FACE_RIGHT, ((reading.Buttons & GamepadButtons::DPadRight) == GamepadButtons::DPadRight));
  267. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_FACE_DOWN, ((reading.Buttons & GamepadButtons::DPadDown) == GamepadButtons::DPadDown));
  268. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_FACE_LEFT, ((reading.Buttons & GamepadButtons::DPadLeft) == GamepadButtons::DPadLeft));
  269. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_MIDDLE, false); // Home button not supported by UWP
  270. // Register buttons for 2nd triggers (because UWP doesn't count these as buttons but rather axis)
  271. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_TRIGGER_2, (bool)(reading.LeftTrigger > 0.1));
  272. UWPRegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_TRIGGER_2, (bool)(reading.RightTrigger > 0.1));
  273. // Get current axis state
  274. UWPRegisterGamepadAxis(i, GAMEPAD_AXIS_LEFT_X, (float)reading.LeftThumbstickX);
  275. UWPRegisterGamepadAxis(i, GAMEPAD_AXIS_LEFT_Y, (float)reading.LeftThumbstickY);
  276. UWPRegisterGamepadAxis(i, GAMEPAD_AXIS_RIGHT_X, (float)reading.RightThumbstickX);
  277. UWPRegisterGamepadAxis(i, GAMEPAD_AXIS_RIGHT_Y, (float)reading.RightThumbstickY);
  278. UWPRegisterGamepadAxis(i, GAMEPAD_AXIS_LEFT_TRIGGER, (float)reading.LeftTrigger);
  279. UWPRegisterGamepadAxis(i, GAMEPAD_AXIS_RIGHT_TRIGGER, (float)reading.RightTrigger);
  280. }
  281. }
  282. }
  283. void App::PostProcessInputs()
  284. {
  285. /*
  286. * So here's the deal. UWP doesn't officially have mouse locking, so we're doing it ourselves here.
  287. * If anyone has any better ideas on how to implement this feel free!
  288. * This is done after the game loop so getting mouse delta etc. still works.
  289. */
  290. if (mouseLocked)
  291. {
  292. auto w = GetScreenWidth();
  293. auto h = GetScreenHeight();
  294. SetMousePosition(w / 2, h / 2);
  295. }
  296. }
  297. // Events
  298. void App::OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args)
  299. {
  300. // Run() won't start until the CoreWindow is activated.
  301. CoreWindow::GetForCurrentThread()->Activate();
  302. }
  303. void App::OnResuming(Platform::Object^ sender, Platform::Object^ args)
  304. {
  305. // TODO: In your game, you will need to load your state here
  306. mSuspended = false;
  307. }
  308. void App::OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args)
  309. {
  310. // TODO: In your game, you will need to save your state here
  311. mSuspended = true;
  312. }
  313. void App::OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args)
  314. {
  315. UWPResizeEvent(args->Size.Width, args->Size.Height);
  316. args->Handled = true;
  317. }
  318. void App::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args)
  319. {
  320. mWindowVisible = args->Visible;
  321. args->Handled = true;
  322. }
  323. // Input event handlers
  324. void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args)
  325. {
  326. auto props = args->CurrentPoint->Properties;
  327. auto device = args->CurrentPoint->PointerDevice;
  328. if (device->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse)
  329. {
  330. if (props->IsLeftButtonPressed) UWPMouseButtonEvent(MOUSE_LEFT_BUTTON, true);
  331. if (props->IsMiddleButtonPressed) UWPMouseButtonEvent(MOUSE_MIDDLE_BUTTON, true);
  332. if (props->IsRightButtonPressed) UWPMouseButtonEvent(MOUSE_RIGHT_BUTTON, true);
  333. }
  334. else if (device->PointerDeviceType == PointerDeviceType::Touch)
  335. {
  336. auto pos = args->CurrentPoint->Position;
  337. UWPGestureTouch(args->CurrentPoint->PointerId, pos.X, pos.Y, true);
  338. }
  339. args->Handled = true;
  340. }
  341. void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args)
  342. {
  343. auto props = args->CurrentPoint->Properties;
  344. auto device = args->CurrentPoint->PointerDevice;
  345. if (device->PointerDeviceType == PointerDeviceType::Mouse)
  346. {
  347. if (!props->IsLeftButtonPressed) UWPMouseButtonEvent(MOUSE_LEFT_BUTTON, false);
  348. if (!props->IsMiddleButtonPressed) UWPMouseButtonEvent(MOUSE_MIDDLE_BUTTON, false);
  349. if (!props->IsRightButtonPressed) UWPMouseButtonEvent(MOUSE_RIGHT_BUTTON, false);
  350. }
  351. else if (device->PointerDeviceType == PointerDeviceType::Touch)
  352. {
  353. auto pos = args->CurrentPoint->Position;
  354. UWPGestureTouch(args->CurrentPoint->PointerId, pos.X, pos.Y, false);
  355. }
  356. args->Handled = true;
  357. }
  358. void App::OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args)
  359. {
  360. UWPMouseWheelEvent(args->CurrentPoint->Properties->MouseWheelDelta);
  361. args->Handled = true;
  362. }
  363. void App::OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args)
  364. {
  365. auto pos = args->CurrentPoint->Position;
  366. if (args->CurrentPoint->PointerDevice->PointerDeviceType == PointerDeviceType::Mouse)
  367. {
  368. UWPMousePosEvent((double)pos.X, (double)pos.Y);
  369. args->Handled = true;
  370. }
  371. else if (args->CurrentPoint->PointerDevice->PointerDeviceType == PointerDeviceType::Touch)
  372. {
  373. UWPGestureMove(args->CurrentPoint->PointerId, pos.X, pos.Y);
  374. }
  375. }
  376. int App::GetRaylibKey(Windows::System::VirtualKey kVey)
  377. {
  378. using VK = Windows::System::VirtualKey;
  379. int actualKey = -1;
  380. switch (kVey)
  381. {
  382. case VK::Back: actualKey = KEY_BACKSPACE; break;
  383. case VK::Space: actualKey = KEY_SPACE; break;
  384. case VK::Escape: actualKey = KEY_ESCAPE; break;
  385. case VK::Enter: actualKey = KEY_ENTER; break;
  386. case VK::Delete: actualKey = KEY_DELETE; break;
  387. case VK::Right: actualKey = KEY_RIGHT; break;
  388. case VK::Left: actualKey = KEY_LEFT; break;
  389. case VK::Down: actualKey = KEY_DOWN; break;
  390. case VK::Up: actualKey = KEY_UP; break;
  391. case VK::F1: actualKey = KEY_F1; break;
  392. case VK::F2: actualKey = KEY_F2; break;
  393. case VK::F3: actualKey = KEY_F3; break;
  394. case VK::F4: actualKey = KEY_F4; break;
  395. case VK::F5: actualKey = KEY_F5; break;
  396. case VK::F6: actualKey = KEY_F6; break;
  397. case VK::F7: actualKey = KEY_F7; break;
  398. case VK::F8: actualKey = KEY_F8; break;
  399. case VK::F9: actualKey = KEY_F9; break;
  400. case VK::F10: actualKey = KEY_F10; break;
  401. case VK::F11: actualKey = KEY_F11; break;
  402. case VK::F12: actualKey = KEY_F12; break;
  403. case VK::LeftShift: actualKey = KEY_LEFT_SHIFT; break;
  404. case VK::LeftControl: actualKey = KEY_LEFT_CONTROL; break;
  405. case VK::LeftMenu: actualKey = KEY_LEFT_ALT; break;
  406. case VK::RightShift: actualKey = KEY_RIGHT_SHIFT; break;
  407. case VK::RightControl: actualKey = KEY_RIGHT_CONTROL; break;
  408. case VK::RightMenu: actualKey = KEY_RIGHT_ALT; break;
  409. case VK::Number0: actualKey = KEY_ZERO; break;
  410. case VK::Number1: actualKey = KEY_ONE; break;
  411. case VK::Number2: actualKey = KEY_TWO; break;
  412. case VK::Number3: actualKey = KEY_THREE; break;
  413. case VK::Number4: actualKey = KEY_FOUR; break;
  414. case VK::Number5: actualKey = KEY_FIVE; break;
  415. case VK::Number6: actualKey = KEY_SIX; break;
  416. case VK::Number7: actualKey = KEY_SEVEN; break;
  417. case VK::Number8: actualKey = KEY_EIGHT; break;
  418. case VK::Number9: actualKey = KEY_NINE; break;
  419. case VK::NumberPad0: actualKey = KEY_KP_0; break;
  420. case VK::NumberPad1: actualKey = KEY_KP_1; break;
  421. case VK::NumberPad2: actualKey = KEY_KP_2; break;
  422. case VK::NumberPad3: actualKey = KEY_KP_3; break;
  423. case VK::NumberPad4: actualKey = KEY_KP_4; break;
  424. case VK::NumberPad5: actualKey = KEY_KP_5; break;
  425. case VK::NumberPad6: actualKey = KEY_KP_6; break;
  426. case VK::NumberPad7: actualKey = KEY_KP_7; break;
  427. case VK::NumberPad8: actualKey = KEY_KP_8; break;
  428. case VK::NumberPad9: actualKey = KEY_KP_9; break;
  429. case VK::Decimal: actualKey = KEY_KP_DECIMAL; break;
  430. case VK::Divide: actualKey = KEY_KP_DIVIDE; break;
  431. case VK::Multiply: actualKey = KEY_KP_MULTIPLY; break;
  432. case VK::Subtract: actualKey = KEY_KP_SUBTRACT; break;
  433. case VK::Add: actualKey = KEY_KP_ADD; break;
  434. // UWP Doesn't have a specific keypad enter or equal...
  435. case VK::A: actualKey = KEY_A; break;
  436. case VK::B: actualKey = KEY_B; break;
  437. case VK::C: actualKey = KEY_C; break;
  438. case VK::D: actualKey = KEY_D; break;
  439. case VK::E: actualKey = KEY_E; break;
  440. case VK::F: actualKey = KEY_F; break;
  441. case VK::G: actualKey = KEY_G; break;
  442. case VK::H: actualKey = KEY_H; break;
  443. case VK::I: actualKey = KEY_I; break;
  444. case VK::J: actualKey = KEY_J; break;
  445. case VK::K: actualKey = KEY_K; break;
  446. case VK::L: actualKey = KEY_L; break;
  447. case VK::M: actualKey = KEY_M; break;
  448. case VK::N: actualKey = KEY_N; break;
  449. case VK::O: actualKey = KEY_O; break;
  450. case VK::P: actualKey = KEY_P; break;
  451. case VK::Q: actualKey = KEY_Q; break;
  452. case VK::R: actualKey = KEY_R; break;
  453. case VK::S: actualKey = KEY_S; break;
  454. case VK::T: actualKey = KEY_T; break;
  455. case VK::U: actualKey = KEY_U; break;
  456. case VK::V: actualKey = KEY_V; break;
  457. case VK::W: actualKey = KEY_W; break;
  458. case VK::X: actualKey = KEY_X; break;
  459. case VK::Y: actualKey = KEY_Y; break;
  460. case VK::Z: actualKey = KEY_Z; break;
  461. // I don't think we can have any more
  462. }
  463. return actualKey;
  464. }
  465. void App::OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args)
  466. {
  467. auto k = GetRaylibKey(args->VirtualKey);
  468. auto controlState = (sender->GetKeyState(Windows::System::VirtualKey::Control) & Windows::UI::Core::CoreVirtualKeyStates::Down) == Windows::UI::Core::CoreVirtualKeyStates::Down;
  469. if (k != -1) UWPKeyDownEvent(k, true, controlState);
  470. args->Handled = true;
  471. }
  472. void App::OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args)
  473. {
  474. auto k = GetRaylibKey(args->VirtualKey);
  475. if (k != -1) UWPKeyDownEvent(k, false, false);
  476. args->Handled = true;
  477. }
  478. void App::OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args)
  479. {
  480. UWPKeyCharEvent(args->KeyCode);
  481. }
  482. void App::OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args)
  483. {
  484. // This simply stops the program from closing.
  485. args->Handled = true;
  486. }
  487. // AppSource implementation
  488. Windows::ApplicationModel::Core::IFrameworkView ^AppSource::CreateView()
  489. {
  490. return ref new App();
  491. }