All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
App.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 
7 enum GameDeviceType
8 {
9  GAME_DEVICE_IPHONE1 = 0,
10  GAME_DEVICE_IPHONE3G,
11  GAME_DEVICE_IPHONE3GS,
12  GAME_DEVICE_IPHONE4,
13  GAME_DEVICE_IPHONE4S,
14  GAME_DEVICE_IPHONE5,
15  GAME_DEVICE_IPHONE5S,
16  GAME_DEVICE_IPHONE6,
17  GAME_DEVICE_IPHONE6PLUS,
18  GAME_DEVICE_IPHONE6S,
19  GAME_DEVICE_IPHONE6S_PLUS,
20  GAME_DEVICE_IPHONE_SE,
21  GAME_DEVICE_IPHONE7,
22  GAME_DEVICE_IPHONE7_PLUS,
23  GAME_DEVICE_IPHONE8,
24  GAME_DEVICE_IPHONE8_PLUS,
25  GAME_DEVICE_IPHONE_X,
26  // IMPORTANT: Remember to update the following when adding new phone devices.
27  GAME_DEVICE_LAST_PHONE = GAME_DEVICE_IPHONE_X,
28 
29  GAME_DEVICE_IPOD1GEN,
30  GAME_DEVICE_IPOD2GEN,
31  GAME_DEVICE_IPOD3GEN,
32  GAME_DEVICE_IPOD4GEN,
33  GAME_DEVICE_IPOD5GEN,
34  GAME_DEVICE_IPOD6GEN,
35  // IMPORTANT: Remember to update the following when adding new small devices.
36  GAME_DEVICE_LAST_SMALL_DEVICE = GAME_DEVICE_IPOD6GEN,
37 
38  GAME_DEVICE_IPAD1,
39  GAME_DEVICE_IPAD2,
40  GAME_DEVICE_IPAD3,
41  GAME_DEVICE_IPAD4,
42  GAME_DEVICE_IPADAIR,
43  GAME_DEVICE_IPADAIR_2,
44  GAME_DEVICE_IPADPRO_9_7_INCH,
45  GAME_DEVICE_IPADPRO_12_9_INCH,
46  GAME_DEVICE_IPAD5,
47  // IMPORTANT: Remember to update the following when adding new full sized ipad devices.
48  GAME_DEVICE_LAST_FULL_SIZE_IPAD = GAME_DEVICE_IPAD5,
49 
50  GAME_DEVICE_IPADMINI_1GEN,
51  GAME_DEVICE_IPADMINI_2,
52  GAME_DEVICE_IPADMINI_3,
53  GAME_DEVICE_IPADMINI_4,
54 
55  GAME_DEVICE_SIMULATOR,
56 };
57 
58 enum OrientationMode
59 {
60  ORIENTATION_MODE_UNKNOWN,
61  ORIENTATION_MODE_PORTRAIT,
62  ORIENTATION_MODE_LANDSCAPE
63 };
64 
65 class App
66 {
67  static bool m_initialised;
68  static bool m_gpsValid;
69  static double m_altitude;
70  static double m_speed;
71  static double m_latitude;
72  static double m_longitude;
73  static double m_heading;
74 
75  static u32 m_device;
76  static bool m_hasRetinaDisplay;
77 
78  static float m_deviceDpiOverPixelScale;
79  static float m_absoluteDeviceDpi;
80  static float m_nativeScale;
81 
82  static char* m_versionString;
83  static char* m_buildString;
84 
85 
86 public:
87 
88  static void Initialise ();
89  static void Shutdown ();
90  static bool IsInitialised();
91 
92  static u32 GetDevice ();
93  static bool HasRetinaDisplay ();
95  static float GetDeviceDpi ();
96  static float GetAbsoluteDeviceDpi();
97  static float GetNativeScale();
98 
99  static bool IsDeviceSmall ();
100  static bool IsDevicePhone ();
101  static bool IsDeviceMultiCore ();
102  static bool IsDeviceMultiCore (u32 deviceType);
103  static OrientationMode GetOrientationMode ();
104  static OrientationMode DetermineOrientationMode();
105 
106  static int GetMajorSystemVersion ();
107 
108  static const char* GetVersionString () { return m_versionString; }
109  static const char* GetBuildString () { return m_buildString; }
110 
111  static bool IsVersionGreaterThan (const char* version);
112  static bool IsVersionLessThan (const char* version);
113 
114  static void LaunchBrowser (const char* url);
115  static void LaunchEMail (const char* mailTo);
116  static void LaunchPhone (const char* number);
117  static void LaunchSMS (const char* number);
118 
119  static bool IsGPSInfoValid () { return m_gpsValid;}
120  static void SetGPSInfo (double altitude, double speed, double latitude, double longitude);
121  static void GetGPSInfo (double& altitude, double& speed, double& latitude, double& longitude);
122  static void SetHeading (double heading);
123  static float GetHeading ();
124 
125  static void LongLatToMercator (double lon, double lat, double& x, double& y);
126  static void MercatorToLongLat (double x, double y, double& lon, double& lat);
127 
128  static void LongLatOSGB36ToOSGrid (double lon, double lat, double& x, double& y);
129  static void OSGridToLongLatOSGB36 (double x, double y, double& lon, double& lat);
130 
131  static void ConvertOSGB36ToWGS84 (double inLon, double inLat, double& outLon, double& outLat);
132  static void ConvertWGS84ToOSGB36 (double inLon, double inLat, double& outLon, double& outLat);
133 
134  static void DetermineDeviceAndDpi (u32& out_device, float& out_dpi);
135 
136 };