Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on (thanks Daniel Knobe!)
authorSam Lantinga <slouken@libsdl.org>
Sun, 10 Dec 2017 09:10:02 -0800
changeset 1175772855e49c8cc
parent 11756 2f67d059ac64
child 11758 c70cf178aacb
Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on (thanks Daniel Knobe!)
WhatsNew.txt
include/SDL_system.h
src/core/winrt/SDL_winrtapp_common.cpp
     1.1 --- a/WhatsNew.txt	Sun Dec 10 09:09:27 2017 -0800
     1.2 +++ b/WhatsNew.txt	Sun Dec 10 09:10:02 2017 -0800
     1.3 @@ -9,6 +9,16 @@
     1.4  * Added SDL_fmod()
     1.5  * Each of the SDL math functions now has the corresponding float version
     1.6  
     1.7 +Windows:
     1.8 +* Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation
     1.9 +
    1.10 +Windows UWP:
    1.11 +* Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on
    1.12 +
    1.13 +Mac OSX / iOS / tvOS:
    1.14 +* Added a Metal 2D render implementation
    1.15 +* Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation
    1.16 +
    1.17  
    1.18  ---------------------------------------------------------------------------
    1.19  2.0.7:
     2.1 --- a/include/SDL_system.h	Sun Dec 10 09:09:27 2017 -0800
     2.2 +++ b/include/SDL_system.h	Sun Dec 10 09:10:02 2017 -0800
     2.3 @@ -170,6 +170,25 @@
     2.4  
     2.5  
     2.6  /**
     2.7 + *  \brief WinRT Device Family
     2.8 + */
     2.9 +typedef enum
    2.10 +{
    2.11 +    /** \brief Unknown family  */
    2.12 +    SDL_WINRT_DEVICEFAMILY_UNKNOWN,
    2.13 +
    2.14 +    /** \brief Desktop family*/
    2.15 +    SDL_WINRT_DEVICEFAMILY_DESKTOP,
    2.16 +
    2.17 +    /** \brief Mobile family (for example smartphone) */
    2.18 +    SDL_WINRT_DEVICEFAMILY_MOBILE,
    2.19 +
    2.20 +    /** \brief XBox family */
    2.21 +    SDL_WINRT_DEVICEFAMILY_XBOX,
    2.22 +} SDL_WinRT_DeviceFamily;
    2.23 +
    2.24 +
    2.25 +/**
    2.26   *  \brief Retrieves a WinRT defined path on the local file system
    2.27   *
    2.28   *  \note Documentation on most app-specific path types on WinRT
    2.29 @@ -203,6 +222,13 @@
    2.30   */
    2.31  extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
    2.32  
    2.33 +/**
    2.34 + *  \brief Detects the device family of WinRT plattform on runtime
    2.35 + *
    2.36 + *  \return Device family
    2.37 + */
    2.38 +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
    2.39 +
    2.40  #endif /* __WINRT__ */
    2.41  
    2.42  /* Ends C function definitions when using C++ */
     3.1 --- a/src/core/winrt/SDL_winrtapp_common.cpp	Sun Dec 10 09:09:27 2017 -0800
     3.2 +++ b/src/core/winrt/SDL_winrtapp_common.cpp	Sun Dec 10 09:10:02 2017 -0800
     3.3 @@ -40,3 +40,25 @@
     3.4          return SDL_WinRTInitNonXAMLApp(mainFunction);
     3.5      }
     3.6  }
     3.7 +
     3.8 +
     3.9 +extern "C" DECLSPEC SDL_WinRT_DeviceFamily
    3.10 +SDL_WinRTGetDeviceFamily()
    3.11 +{
    3.12 +    Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily;
    3.13 +
    3.14 +    if (deviceFamily->Equals("Windows.Desktop"))
    3.15 +    {
    3.16 +        return SDL_WINRT_DEVICEFAMILY_DESKTOP;
    3.17 +    }
    3.18 +    else if (deviceFamily->Equals("Windows.Mobile"))
    3.19 +    {
    3.20 +        return SDL_WINRT_DEVICEFAMILY_MOBILE;
    3.21 +    }
    3.22 +    else if (deviceFamily->Equals("Windows.Xbox"))
    3.23 +    {
    3.24 +        return SDL_WINRT_DEVICEFAMILY_XBOX;
    3.25 +    }
    3.26 +
    3.27 +    return SDL_WINRT_DEVICEFAMILY_UNKNOWN;
    3.28 +}
    3.29 \ No newline at end of file