From b6b58991e689d9f5a6fa18ff8ea9b2162d1f7d62 Mon Sep 17 00:00:00 2001 From: Ray San Date: Fri, 10 Nov 2017 12:37:53 +0100 Subject: Working on UWP support Support Universal Windows Platform (UWP): - Windows 10 App - Windows Phone - Xbox One --- project/vs2015.UWP/raylib.App.UWP/App.cpp | 174 +++++++++++++++++++++ project/vs2015.UWP/raylib.App.UWP/App.h | 41 +++++ .../raylib.App.UWP/Assets/Logo.scale-100.png | Bin 0 -> 801 bytes .../raylib.App.UWP/Assets/SmallLogo.scale-100.png | Bin 0 -> 329 bytes .../Assets/SplashScreen.scale-100.png | Bin 0 -> 2146 bytes .../raylib.App.UWP/Assets/StoreLogo.scale-100.png | Bin 0 -> 429 bytes .../raylib.App.UWP/Assets/WideLogo.scale-100.png | Bin 0 -> 2150 bytes .../vs2015.UWP/raylib.App.UWP/Package.appxmanifest | 48 ++++++ project/vs2015.UWP/raylib.App.UWP/packages.config | 4 + project/vs2015.UWP/raylib.App.UWP/pch.cpp | 1 + project/vs2015.UWP/raylib.App.UWP/pch.h | 16 ++ .../raylib.App.UWP/raylib.App.UWP.TemporaryKey.pfx | Bin 0 -> 2512 bytes .../raylib.App.UWP/raylib.App.UWP.filters | 42 +++++ .../vs2015.UWP/raylib.App.UWP/raylib.App.UWP.user | 4 + .../raylib.App.UWP/raylib.App.UWP.vcxproj | 140 +++++++++++++++++ project/vs2015.UWP/raylib/raylib.vcxproj | 123 +++++++++++++++ 16 files changed, 593 insertions(+) create mode 100644 project/vs2015.UWP/raylib.App.UWP/App.cpp create mode 100644 project/vs2015.UWP/raylib.App.UWP/App.h create mode 100644 project/vs2015.UWP/raylib.App.UWP/Assets/Logo.scale-100.png create mode 100644 project/vs2015.UWP/raylib.App.UWP/Assets/SmallLogo.scale-100.png create mode 100644 project/vs2015.UWP/raylib.App.UWP/Assets/SplashScreen.scale-100.png create mode 100644 project/vs2015.UWP/raylib.App.UWP/Assets/StoreLogo.scale-100.png create mode 100644 project/vs2015.UWP/raylib.App.UWP/Assets/WideLogo.scale-100.png create mode 100644 project/vs2015.UWP/raylib.App.UWP/Package.appxmanifest create mode 100644 project/vs2015.UWP/raylib.App.UWP/packages.config create mode 100644 project/vs2015.UWP/raylib.App.UWP/pch.cpp create mode 100644 project/vs2015.UWP/raylib.App.UWP/pch.h create mode 100644 project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.TemporaryKey.pfx create mode 100644 project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.filters create mode 100644 project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.user create mode 100644 project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.vcxproj create mode 100644 project/vs2015.UWP/raylib/raylib.vcxproj (limited to 'project') diff --git a/project/vs2015.UWP/raylib.App.UWP/App.cpp b/project/vs2015.UWP/raylib.App.UWP/App.cpp new file mode 100644 index 00000000..7d98d707 --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/App.cpp @@ -0,0 +1,174 @@ + +#include "pch.h" +#include "app.h" + +#include "raylib.h" + +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Input; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::Graphics::Display; +using namespace Microsoft::WRL; +using namespace Platform; + +using namespace raylibUWP; + +// Helper to convert a length in device-independent pixels (DIPs) to a length in physical pixels. +inline float ConvertDipsToPixels(float dips, float dpi) +{ + static const float dipsPerInch = 96.0f; + return floor(dips * dpi / dipsPerInch + 0.5f); // Round to nearest integer. +} + +// Implementation of the IFrameworkViewSource interface, necessary to run our app. +ref class SimpleApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource +{ +public: + virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView() + { + return ref new App(); + } +}; + +// The main function creates an IFrameworkViewSource for our app, and runs the app. +[Platform::MTAThread] +int main(Platform::Array^) +{ + auto simpleApplicationSource = ref new SimpleApplicationSource(); + CoreApplication::Run(simpleApplicationSource); + + return 0; +} + +App::App() : + mWindowClosed(false), + mWindowVisible(true) +{ +} + +// The first method called when the IFrameworkView is being created. +void App::Initialize(CoreApplicationView^ applicationView) +{ + // Register event handlers for app lifecycle. This example includes Activated, so that we + // can make the CoreWindow active and start rendering on the window. + applicationView->Activated += ref new TypedEventHandler(this, &App::OnActivated); + + // Logic for other event handlers could go here. + // Information about the Suspending and Resuming event handlers can be found here: + // http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994930.aspx + + CoreApplication::Resuming += ref new EventHandler(this, &App::OnResuming); +} + +// Called when the CoreWindow object is created (or re-created). +void App::SetWindow(CoreWindow^ window) +{ + window->SizeChanged += ref new TypedEventHandler(this, &App::OnWindowSizeChanged); + window->VisibilityChanged += ref new TypedEventHandler(this, &App::OnVisibilityChanged); + window->Closed += ref new TypedEventHandler(this, &App::OnWindowClosed); + + DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); + currentDisplayInformation->DpiChanged += ref new TypedEventHandler(this, &App::OnDpiChanged); + currentDisplayInformation->OrientationChanged += ref new TypedEventHandler(this, &App::OnOrientationChanged); + + + // The CoreWindow has been created, so EGL can be initialized. + InitWindow(800, 450, (EGLNativeWindowType)window); +} + +// Initializes scene resources +void App::Load(Platform::String^ entryPoint) +{ + // InitWindow() --> rlglInit() +} + +// This method is called after the window becomes active. +void App::Run() +{ + while (!mWindowClosed) + { + if (mWindowVisible) + { + // Update + + // Draw + BeginDrawing(); + + ClearBackground(RAYWHITE); + + DrawRectangle(100, 100, 400, 100, RED); + + DrawLine(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE); + + EndDrawing(); + + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + } + else + { + CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); + } + } + + CloseWindow(); +} + +// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView +// class is torn down while the app is in the foreground. +void App::Uninitialize() +{ + // CloseWindow(); +} + +// Application lifecycle event handler. +void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args) +{ + // Run() won't start until the CoreWindow is activated. + CoreWindow::GetForCurrentThread()->Activate(); +} + +void App::OnResuming(Object^ sender, Object^ args) +{ + // Restore any data or state that was unloaded on suspend. By default, data + // and state are persisted when resuming from suspend. Note that this event + // does not occur if the app was previously terminated. +} + +void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) +{ + // TODO: Update window and render area size + //m_deviceResources->SetLogicalSize(Size(sender->Bounds.Width, sender->Bounds.Height)); + //m_main->UpdateForWindowSizeChange(); +} + +// Window event handlers. +void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) +{ + mWindowVisible = args->Visible; + + // raylib core has the variable windowMinimized to register state, + // it should be modifyed by this event... +} + +void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) +{ + mWindowClosed = true; + + // raylib core has the variable windowShouldClose to register state, + // it should be modifyed by this event... +} + +void App::OnDpiChanged(DisplayInformation^ sender, Object^ args) +{ + //m_deviceResources->SetDpi(sender->LogicalDpi); + //m_main->UpdateForWindowSizeChange(); +} + +void App::OnOrientationChanged(DisplayInformation^ sender, Object^ args) +{ + //m_deviceResources->SetCurrentOrientation(sender->CurrentOrientation); + //m_main->UpdateForWindowSizeChange(); +} diff --git a/project/vs2015.UWP/raylib.App.UWP/App.h b/project/vs2015.UWP/raylib.App.UWP/App.h new file mode 100644 index 00000000..3f27eeb0 --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/App.h @@ -0,0 +1,41 @@ +#pragma once + +#include + +#include "pch.h" + +namespace raylibUWP +{ + ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView + { + public: + App(); + + // 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(); + + protected: + + // Application lifecycle event handlers. + void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args); + void OnResuming(Platform::Object^ sender, Platform::Object^ args); + + // Window event handlers. + 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 OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); + + // DisplayInformation event handlers. + void OnDpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); + + private: + + bool mWindowClosed; + bool mWindowVisible; + }; +} diff --git a/project/vs2015.UWP/raylib.App.UWP/Assets/Logo.scale-100.png b/project/vs2015.UWP/raylib.App.UWP/Assets/Logo.scale-100.png new file mode 100644 index 00000000..e26771cb Binary files /dev/null and b/project/vs2015.UWP/raylib.App.UWP/Assets/Logo.scale-100.png differ diff --git a/project/vs2015.UWP/raylib.App.UWP/Assets/SmallLogo.scale-100.png b/project/vs2015.UWP/raylib.App.UWP/Assets/SmallLogo.scale-100.png new file mode 100644 index 00000000..1eb0d9d5 Binary files /dev/null and b/project/vs2015.UWP/raylib.App.UWP/Assets/SmallLogo.scale-100.png differ diff --git a/project/vs2015.UWP/raylib.App.UWP/Assets/SplashScreen.scale-100.png b/project/vs2015.UWP/raylib.App.UWP/Assets/SplashScreen.scale-100.png new file mode 100644 index 00000000..c951e031 Binary files /dev/null and b/project/vs2015.UWP/raylib.App.UWP/Assets/SplashScreen.scale-100.png differ diff --git a/project/vs2015.UWP/raylib.App.UWP/Assets/StoreLogo.scale-100.png b/project/vs2015.UWP/raylib.App.UWP/Assets/StoreLogo.scale-100.png new file mode 100644 index 00000000..dcb67271 Binary files /dev/null and b/project/vs2015.UWP/raylib.App.UWP/Assets/StoreLogo.scale-100.png differ diff --git a/project/vs2015.UWP/raylib.App.UWP/Assets/WideLogo.scale-100.png b/project/vs2015.UWP/raylib.App.UWP/Assets/WideLogo.scale-100.png new file mode 100644 index 00000000..9dd94b62 Binary files /dev/null and b/project/vs2015.UWP/raylib.App.UWP/Assets/WideLogo.scale-100.png differ diff --git a/project/vs2015.UWP/raylib.App.UWP/Package.appxmanifest b/project/vs2015.UWP/raylib.App.UWP/Package.appxmanifest new file mode 100644 index 00000000..dbd8121a --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/Package.appxmanifest @@ -0,0 +1,48 @@ + + + + + + + + + + UWP_OpenGLES2 + Alumno + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project/vs2015.UWP/raylib.App.UWP/packages.config b/project/vs2015.UWP/raylib.App.UWP/packages.config new file mode 100644 index 00000000..4a5c0b55 --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/project/vs2015.UWP/raylib.App.UWP/pch.cpp b/project/vs2015.UWP/raylib.App.UWP/pch.cpp new file mode 100644 index 00000000..bcb5590b --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/project/vs2015.UWP/raylib.App.UWP/pch.h b/project/vs2015.UWP/raylib.App.UWP/pch.h new file mode 100644 index 00000000..dcbd2378 --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/pch.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +// OpenGL ES includes +#include +#include + +// EGL includes +#include +#include +#include + +// ANGLE include for Windows Store +#include \ No newline at end of file diff --git a/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.TemporaryKey.pfx b/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.TemporaryKey.pfx new file mode 100644 index 00000000..0ada3be0 Binary files /dev/null and b/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.TemporaryKey.pfx differ diff --git a/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.filters b/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.filters new file mode 100644 index 00000000..4e83c979 --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.filters @@ -0,0 +1,42 @@ + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + + + + + + {d16954bb-de54-472b-ac10-ecab10d3fdc8} + + + \ No newline at end of file diff --git a/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.user b/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.user new file mode 100644 index 00000000..abe8dd89 --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.vcxproj b/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.vcxproj new file mode 100644 index 00000000..307c7394 --- /dev/null +++ b/project/vs2015.UWP/raylib.App.UWP/raylib.App.UWP.vcxproj @@ -0,0 +1,140 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {b842558c-c034-4e4b-9457-a286f26e83cc} + raylibUWP + en-US + 14.0 + true + Windows Store + 10.0.14393.0 + 10.0.10586.0 + 10.0 + raylib.App.UWP + + + + Application + true + v140 + + + Application + false + true + v140 + + + + + + + + raylib.App.UWP.TemporaryKey.pfx + + + + mincore.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + + + mincore.lib;raylib.lib;%(AdditionalDependencies) + $(SolutionDir)raylib\Debug;%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + + + mincore.lib;raylib.lib;%(AdditionalDependencies) + C:\Users\Alumno\Downloads\angle\UWP_OpenGLES2\raylib;%(AdditionalLibraryDirectories);$(VCInstallDir)\lib\store\amd64;$(VCInstallDir)\lib\amd64 + + + + + pch.h + $(IntDir)pch.pch + $(SolutionDir)..\..\src;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + _DEBUG;%(PreprocessorDefinitions) + + + + + pch.h + $(IntDir)pch.pch + $(SolutionDir)..\..\src;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + NDEBUG;%(PreprocessorDefinitions) + Default + false + + + /NODEFAULTLIB %(AdditionalOptions) + + + + + + + + + + + + + + + + + Create + + + + + Designer + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/project/vs2015.UWP/raylib/raylib.vcxproj b/project/vs2015.UWP/raylib/raylib.vcxproj new file mode 100644 index 00000000..7e501995 --- /dev/null +++ b/project/vs2015.UWP/raylib/raylib.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {E89D61AC-55DE-4482-AFD4-DF7242EBC859} + Win32Proj + raylib + 8.1 + + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + + + + + + + + + + + + + $(SolutionDir)$(ProjectName)\$(Configuration)\ + + + $(SolutionDir)$(ProjectName)\$(Configuration)\ + $(SolutionDir)$(ProjectName)\$(Configuration)\temp + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_ES2;PLATFORM_UWP + CompileAsC + $(SolutionDir)..\..\release\include;$(SolutionDir)..\..\src\external\include\ANGLE + + + Windows + + + %(AdditionalLibraryDirectories) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_ES2;PLATFORM_UWP + $(SolutionDir)..\..\src\external\include\ANGLE;$(SolutionDir)..\..\release\include + CompileAsC + + + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3