SDL
2.0
SDL_winrtapp_common.cpp
Go to the documentation of this file.
1
/*
2
Simple DirectMedia Layer
3
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
4
5
This software is provided 'as-is', without any express or implied
6
warranty. In no event will the authors be held liable for any damages
7
arising from the use of this software.
8
9
Permission is granted to anyone to use this software for any purpose,
10
including commercial applications, and to alter it and redistribute it
11
freely, subject to the following restrictions:
12
13
1. The origin of this software must not be misrepresented; you must not
14
claim that you wrote the original software. If you use this software
15
in a product, an acknowledgment in the product documentation would be
16
appreciated but is not required.
17
2. Altered source versions must be plainly marked as such, and must not be
18
misrepresented as being the original software.
19
3. This notice may not be removed or altered from any source distribution.
20
*/
21
#include "../../SDL_internal.h"
22
23
#include "
SDL_main.h
"
24
#include "
SDL_system.h
"
25
#include "
SDL_winrtapp_direct3d.h
"
26
#include "
SDL_winrtapp_xaml.h
"
27
28
#include <wrl.h>
29
30
int (*
WINRT_SDLAppEntryPoint
)(int,
char
**) =
NULL
;
31
32
extern
"C"
DECLSPEC
int
33
SDL_WinRTRunApp
(
SDL_main_func
mainFunction,
void
* xamlBackgroundPanel)
34
{
35
if
(xamlBackgroundPanel) {
36
return
SDL_WinRTInitXAMLApp
(mainFunction, xamlBackgroundPanel);
37
}
else
{
38
if
(
FAILED
(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) {
39
return
1;
40
}
41
return
SDL_WinRTInitNonXAMLApp
(mainFunction);
42
}
43
}
44
45
46
extern
"C"
DECLSPEC
SDL_WinRT_DeviceFamily
47
SDL_WinRTGetDeviceFamily
()
48
{
49
#if NTDDI_VERSION >= NTDDI_WIN10
/* !!! FIXME: I have no idea if this is the right test. This is a UWP API, I think. Older windows should...just return "mobile"? I don't know. --ryan. */
50
Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily;
51
52
if
(deviceFamily->Equals(
"Windows.Desktop"
))
53
{
54
return
SDL_WINRT_DEVICEFAMILY_DESKTOP;
55
}
56
else
if
(deviceFamily->Equals(
"Windows.Mobile"
))
57
{
58
return
SDL_WINRT_DEVICEFAMILY_MOBILE;
59
}
60
else
if
(deviceFamily->Equals(
"Windows.Xbox"
))
61
{
62
return
SDL_WINRT_DEVICEFAMILY_XBOX;
63
}
64
#endif
65
66
return
SDL_WINRT_DEVICEFAMILY_UNKNOWN;
67
}
DECLSPEC
#define DECLSPEC
Definition:
SDL_internal.h:48
SDL_winrtapp_direct3d.h
SDL_main.h
NULL
#define NULL
Definition:
begin_code.h:167
SDL_winrtapp_xaml.h
SDL_main_func
int(* SDL_main_func)(int argc, char *argv[])
Definition:
SDL_main.h:120
SDL_WinRTGetDeviceFamily
SDL_WinRT_DeviceFamily SDL_WinRTGetDeviceFamily()
Definition:
SDL_winrtapp_common.cpp:47
SDL_WinRTInitXAMLApp
int SDL_WinRTInitXAMLApp(int(*mainFunction)(int, char **), void *backgroundPanelAsIInspectable)
Definition:
SDL_winrtapp_xaml.cpp:102
WINRT_SDLAppEntryPoint
int(* WINRT_SDLAppEntryPoint)(int, char **)
Definition:
SDL_winrtapp_common.cpp:30
SDL_WinRTRunApp
int SDL_WinRTRunApp(SDL_main_func mainFunction, void *xamlBackgroundPanel)
Definition:
SDL_winrtapp_common.cpp:33
SDL_WinRTInitNonXAMLApp
int SDL_WinRTInitNonXAMLApp(int(*mainFunction)(int, char **))
Definition:
SDL_winrtapp_direct3d.cpp:116
SDL_system.h
FAILED
#define FAILED(x)
Definition:
SDL_directx.h:54
src
core
winrt
SDL_winrtapp_common.cpp
Generated by
1.8.17