From a4e79ba5102c76a5b24304c1deb03fb8da0d14df Mon Sep 17 00:00:00 2001 From: Reece Mackie <20544390+Rover656@users.noreply.github.com> Date: Tue, 23 Apr 2019 18:24:30 +0100 Subject: [PATCH] Working build --- projects/VS2017.UWP/raylib.UWP.sln | 57 +++++ .../VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj | 231 ++++++++++++++++++ .../raylib.UWP/raylib.UWP.vcxproj.filters | 29 +++ src/core.c | 5 +- src/external/ANGLE/EGL/eglplatform.h | 5 + src/rlgl.h | 6 + 6 files changed, 331 insertions(+), 2 deletions(-) create mode 100644 projects/VS2017.UWP/raylib.UWP.sln create mode 100644 projects/VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj create mode 100644 projects/VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj.filters diff --git a/projects/VS2017.UWP/raylib.UWP.sln b/projects/VS2017.UWP/raylib.UWP.sln new file mode 100644 index 000000000..fb528655f --- /dev/null +++ b/projects/VS2017.UWP/raylib.UWP.sln @@ -0,0 +1,57 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.438 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raylib.App.UWP", "raylib.App.UWP\raylib.App.UWP.vcxproj", "{B842558C-C034-4E4B-9457-A286F26E83CC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raylib.UWP", "raylib.UWP\raylib.UWP.vcxproj", "{EA91E088-7C71-4F32-B761-E054305CD519}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|ARM.ActiveCfg = Debug|ARM + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|ARM.Build.0 = Debug|ARM + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|ARM.Deploy.0 = Debug|ARM + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|x64.ActiveCfg = Debug|x64 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|x64.Build.0 = Debug|x64 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|x64.Deploy.0 = Debug|x64 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|x86.ActiveCfg = Debug|Win32 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|x86.Build.0 = Debug|Win32 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Debug|x86.Deploy.0 = Debug|Win32 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|ARM.ActiveCfg = Release|ARM + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|ARM.Build.0 = Release|ARM + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|ARM.Deploy.0 = Release|ARM + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|x64.ActiveCfg = Release|x64 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|x64.Build.0 = Release|x64 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|x64.Deploy.0 = Release|x64 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|x86.ActiveCfg = Release|Win32 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|x86.Build.0 = Release|Win32 + {B842558C-C034-4E4B-9457-A286F26E83CC}.Release|x86.Deploy.0 = Release|Win32 + {EA91E088-7C71-4F32-B761-E054305CD519}.Debug|ARM.ActiveCfg = Debug|ARM + {EA91E088-7C71-4F32-B761-E054305CD519}.Debug|ARM.Build.0 = Debug|ARM + {EA91E088-7C71-4F32-B761-E054305CD519}.Debug|x64.ActiveCfg = Debug|x64 + {EA91E088-7C71-4F32-B761-E054305CD519}.Debug|x64.Build.0 = Debug|x64 + {EA91E088-7C71-4F32-B761-E054305CD519}.Debug|x86.ActiveCfg = Debug|Win32 + {EA91E088-7C71-4F32-B761-E054305CD519}.Debug|x86.Build.0 = Debug|Win32 + {EA91E088-7C71-4F32-B761-E054305CD519}.Release|ARM.ActiveCfg = Release|ARM + {EA91E088-7C71-4F32-B761-E054305CD519}.Release|ARM.Build.0 = Release|ARM + {EA91E088-7C71-4F32-B761-E054305CD519}.Release|x64.ActiveCfg = Release|x64 + {EA91E088-7C71-4F32-B761-E054305CD519}.Release|x64.Build.0 = Release|x64 + {EA91E088-7C71-4F32-B761-E054305CD519}.Release|x86.ActiveCfg = Release|Win32 + {EA91E088-7C71-4F32-B761-E054305CD519}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E32C7998-071A-419B-8869-E957374307CA} + EndGlobalSection +EndGlobal diff --git a/projects/VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj b/projects/VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj new file mode 100644 index 000000000..f05f829c9 --- /dev/null +++ b/projects/VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj @@ -0,0 +1,231 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {ea91e088-7c71-4f32-b761-e054305cd519} + StaticLibrary + raylib_UWP + en-US + 14.0 + true + Windows Store + 10.0.17763.0 + 10.0.15063.0 + 10.0 + + + + StaticLibrary + true + v141 + + + StaticLibrary + true + v141 + + + StaticLibrary + true + v141 + + + StaticLibrary + false + true + v141 + + + StaticLibrary + false + true + v141 + + + StaticLibrary + false + true + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + false + + + false + + + + NotUsing + false + true + _CRT_SECURE_NO_WARNINGS;GRAPHICS_API_OPENGL_ES2;PLATFORM_UWP;_UNICODE;UNICODE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\release\include;$(SolutionDir)..\..\src\external\ANGLE;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + + + Console + false + false + + + + + NotUsing + false + true + _CRT_SECURE_NO_WARNINGS;GRAPHICS_API_OPENGL_ES2;PLATFORM_UWP;_UNICODE;UNICODE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\release\include;$(SolutionDir)..\..\src\external\ANGLE;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + + + Console + false + false + + + + + NotUsing + false + true + _CRT_SECURE_NO_WARNINGS;GRAPHICS_API_OPENGL_ES2;PLATFORM_UWP;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + $(SolutionDir)..\..\release\include;$(SolutionDir)..\..\src\external\ANGLE;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + + + Console + false + false + + + + + NotUsing + false + true + _CRT_SECURE_NO_WARNINGS;GRAPHICS_API_OPENGL_ES2;PLATFORM_UWP;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + $(SolutionDir)..\..\release\include;$(SolutionDir)..\..\src\external\ANGLE;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + + + Console + false + false + + + + + NotUsing + false + true + _CRT_SECURE_NO_WARNINGS;GRAPHICS_API_OPENGL_ES2;PLATFORM_UWP;_UNICODE;UNICODE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\release\include;$(SolutionDir)..\..\src\external\ANGLE;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + + + Console + false + false + + + + + NotUsing + false + true + _CRT_SECURE_NO_WARNINGS;GRAPHICS_API_OPENGL_ES2;PLATFORM_UWP;_UNICODE;UNICODE;%(PreprocessorDefinitions) + $(SolutionDir)..\..\release\include;$(SolutionDir)..\..\src\external\ANGLE;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + + + Console + false + false + + + + + + \ No newline at end of file diff --git a/projects/VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj.filters b/projects/VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj.filters new file mode 100644 index 000000000..cbad7c9b5 --- /dev/null +++ b/projects/VS2017.UWP/raylib.UWP/raylib.UWP.vcxproj.filters @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/core.c b/src/core.c index 5ec3b76a2..fdbeda7dc 100644 --- a/src/core.c +++ b/src/core.c @@ -134,7 +134,7 @@ #include // Required for: tolower() [Used in IsFileExtension()] #include // Required for stat() [Used in GetLastWriteTime()] -#if defined(PLATFORM_DESKTOP) && defined(_WIN32) && (defined(_MSC_VER) || defined(__TINYC__)) +#if (defined(PLATFORM_DESKTOP) || defined(PLATFORM_UWP)) && defined(_WIN32) && (defined(_MSC_VER) || defined(__TINYC__)) #include "external/dirent.h" // Required for: DIR, opendir(), closedir() [Used in GetDirectoryFiles()] #else #include // Required for: DIR, opendir(), closedir() [Used in GetDirectoryFiles()] @@ -889,7 +889,8 @@ int GetScreenHeight(void) // Get native window handle void *GetWindowHandle(void) { -#if defined(_WIN32) + //TODO: See if we can do UWP? +#ifdef PLATFORM_DESKTOP // NOTE: Returned handle is: void *HWND (windows.h) return glfwGetWin32Window(window); #elif defined(__linux__) diff --git a/src/external/ANGLE/EGL/eglplatform.h b/src/external/ANGLE/EGL/eglplatform.h index eb3ea70cc..7e542ff7f 100644 --- a/src/external/ANGLE/EGL/eglplatform.h +++ b/src/external/ANGLE/EGL/eglplatform.h @@ -74,11 +74,16 @@ //#include // raylib edit!!! +#ifndef PLATFORM_UWP typedef void *PVOID; // PVOID is a pointer to any type. This type is declared in WinNT.h typedef PVOID HANDLE; // HANDLE is handle to an object. This type is declared in WinNT.h typedef HANDLE HWND; // HWND is a handle to a window. This type is declared in WinDef.h typedef HANDLE HDC; // HDC is a handle to a device context (DC). This type is declared in WinDef.h typedef HANDLE HBITMAP; // HBITMAP is a handle to a bitmap. This type is declared in WinDef.h +#else +//UWP Fix +#include "Windows.h" +#endif // HDC, HBITMAP and HWND are actually pointers to void. You can cast a long to a HWND like this: HWND h = (HWND)my_long_var; // but very careful of what information is stored in my_long_var. You have to make sure that you have a pointer in there. diff --git a/src/rlgl.h b/src/rlgl.h index 71a1dc4b6..64039dc65 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -998,6 +998,12 @@ void rlMultMatrixf(float *matf) *currentMatrix = MatrixMultiply(*currentMatrix, mat); } +//Fix variable name issues +#ifdef PLATFORM_UWP +#undef near +#undef far +#endif + // Multiply the current matrix by a perspective matrix generated by parameters void rlFrustum(double left, double right, double bottom, double top, double near, double far) {