[Commits] SDL: Added SDL_WinRTGetDeviceFamily() to find out what type of d...

libsdl.org revision control commits-owner at libsdl.org
Sun Dec 10 09:10:02 PST 2017


details:   https://hg.libsdl.org/SDL/rev/72855e49c8cc
changeset: 11757:72855e49c8cc
user:      Sam Lantinga <slouken at libsdl.org>
date:      Sun Dec 10 09:10:02 2017 -0800
description:
Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on (thanks Daniel Knobe!)

diffstat:

 WhatsNew.txt                           |  10 ++++++++++
 include/SDL_system.h                   |  26 ++++++++++++++++++++++++++
 src/core/winrt/SDL_winrtapp_common.cpp |  22 ++++++++++++++++++++++
 3 files changed, 58 insertions(+), 0 deletions(-)

diffs (93 lines):

diff -r 2f67d059ac64 -r 72855e49c8cc WhatsNew.txt
--- a/WhatsNew.txt	Sun Dec 10 09:09:27 2017 -0800
+++ b/WhatsNew.txt	Sun Dec 10 09:10:02 2017 -0800
@@ -9,6 +9,16 @@
 * Added SDL_fmod()
 * Each of the SDL math functions now has the corresponding float version
 
+Windows:
+* Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation
+
+Windows UWP:
+* Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on
+
+Mac OSX / iOS / tvOS:
+* Added a Metal 2D render implementation
+* Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation
+
 
 ---------------------------------------------------------------------------
 2.0.7:
diff -r 2f67d059ac64 -r 72855e49c8cc include/SDL_system.h
--- a/include/SDL_system.h	Sun Dec 10 09:09:27 2017 -0800
+++ b/include/SDL_system.h	Sun Dec 10 09:10:02 2017 -0800
@@ -170,6 +170,25 @@
 
 
 /**
+ *  \brief WinRT Device Family
+ */
+typedef enum
+{
+    /** \brief Unknown family  */
+    SDL_WINRT_DEVICEFAMILY_UNKNOWN,
+
+    /** \brief Desktop family*/
+    SDL_WINRT_DEVICEFAMILY_DESKTOP,
+
+    /** \brief Mobile family (for example smartphone) */
+    SDL_WINRT_DEVICEFAMILY_MOBILE,
+
+    /** \brief XBox family */
+    SDL_WINRT_DEVICEFAMILY_XBOX,
+} SDL_WinRT_DeviceFamily;
+
+
+/**
  *  \brief Retrieves a WinRT defined path on the local file system
  *
  *  \note Documentation on most app-specific path types on WinRT
@@ -203,6 +222,13 @@
  */
 extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
 
+/**
+ *  \brief Detects the device family of WinRT plattform on runtime
+ *
+ *  \return Device family
+ */
+extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
+
 #endif /* __WINRT__ */
 
 /* Ends C function definitions when using C++ */
diff -r 2f67d059ac64 -r 72855e49c8cc src/core/winrt/SDL_winrtapp_common.cpp
--- a/src/core/winrt/SDL_winrtapp_common.cpp	Sun Dec 10 09:09:27 2017 -0800
+++ b/src/core/winrt/SDL_winrtapp_common.cpp	Sun Dec 10 09:10:02 2017 -0800
@@ -40,3 +40,25 @@
         return SDL_WinRTInitNonXAMLApp(mainFunction);
     }
 }
+
+
+extern "C" DECLSPEC SDL_WinRT_DeviceFamily
+SDL_WinRTGetDeviceFamily()
+{
+    Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily;
+
+    if (deviceFamily->Equals("Windows.Desktop"))
+    {
+        return SDL_WINRT_DEVICEFAMILY_DESKTOP;
+    }
+    else if (deviceFamily->Equals("Windows.Mobile"))
+    {
+        return SDL_WINRT_DEVICEFAMILY_MOBILE;
+    }
+    else if (deviceFamily->Equals("Windows.Xbox"))
+    {
+        return SDL_WINRT_DEVICEFAMILY_XBOX;
+    }
+
+    return SDL_WINRT_DEVICEFAMILY_UNKNOWN;
+}
\ No newline at end of file


More information about the commits mailing list