Add System.manufacturer, Systemem.model, System.version (TODO: Windows)
This commit is contained in:
@@ -32,6 +32,9 @@ namespace lime {
|
||||
static std::wstring* GetIOSDirectory (SystemDirectory type);
|
||||
static bool GetIOSTablet ();
|
||||
#endif
|
||||
static std::wstring* GetManufacturer ();
|
||||
static std::wstring* GetModel ();
|
||||
static std::wstring* GetVersion ();
|
||||
#ifdef HX_WINDOWS
|
||||
static int GetWindowsConsoleMode (int handleType);
|
||||
#endif
|
||||
|
||||
@@ -1481,6 +1481,44 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
value lime_system_get_manufacturer () {
|
||||
|
||||
std::wstring* manufacturer = System::GetManufacturer ();
|
||||
|
||||
if (manufacturer) {
|
||||
|
||||
value result = alloc_wstring (manufacturer->c_str ());
|
||||
delete manufacturer;
|
||||
return result;
|
||||
|
||||
} else {
|
||||
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
value lime_system_get_model () {
|
||||
|
||||
std::wstring* model = System::GetModel ();
|
||||
|
||||
if (model) {
|
||||
|
||||
value result = alloc_wstring (model->c_str ());
|
||||
delete model;
|
||||
return result;
|
||||
|
||||
} else {
|
||||
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int lime_system_get_num_displays () {
|
||||
|
||||
return System::GetNumDisplays ();
|
||||
@@ -1495,6 +1533,25 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
value lime_system_get_version () {
|
||||
|
||||
std::wstring* version = System::GetVersion ();
|
||||
|
||||
if (version) {
|
||||
|
||||
value result = alloc_wstring (version->c_str ());
|
||||
delete version;
|
||||
return result;
|
||||
|
||||
} else {
|
||||
|
||||
return alloc_null ();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int lime_system_get_windows_console_mode (int handleType) {
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
@@ -1976,8 +2033,11 @@ namespace lime {
|
||||
DEFINE_PRIME3 (lime_system_get_directory);
|
||||
DEFINE_PRIME1 (lime_system_get_display);
|
||||
DEFINE_PRIME0 (lime_system_get_ios_tablet);
|
||||
DEFINE_PRIME0 (lime_system_get_manufacturer);
|
||||
DEFINE_PRIME0 (lime_system_get_model);
|
||||
DEFINE_PRIME0 (lime_system_get_num_displays);
|
||||
DEFINE_PRIME0 (lime_system_get_timer);
|
||||
DEFINE_PRIME0 (lime_system_get_version);
|
||||
DEFINE_PRIME1 (lime_system_get_windows_console_mode);
|
||||
DEFINE_PRIME1v (lime_system_open_file);
|
||||
DEFINE_PRIME2v (lime_system_open_url);
|
||||
|
||||
@@ -8,6 +8,27 @@
|
||||
namespace lime {
|
||||
|
||||
|
||||
std::wstring* System::GetManufacturer () {
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::wstring* System::GetModel () {
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::wstring* System::GetVersion () {
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
int System::GetWindowsConsoleMode (int handleType) {
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
#import <sys/utsname.h>
|
||||
#include <system/System.h>
|
||||
|
||||
|
||||
@@ -61,6 +62,41 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
std::wstring* System::GetManufacturer () {
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::wstring* System::GetModel () {
|
||||
|
||||
#ifdef IPHONE
|
||||
struct utsname systemInfo;
|
||||
uname (&systemInfo);
|
||||
|
||||
std::string model = std::string (systemInfo.machine);
|
||||
return new std::wstring (model.begin (), model.end ());
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::wstring* System::GetVersion () {
|
||||
|
||||
#ifdef IPHONE
|
||||
NSString *versionString = [[UIDevice currentDevice] systemVersion];
|
||||
std::string result = std::string ([versionString UTF8String]);
|
||||
return new std::wstring (result.begin (), result.end ());
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void System::OpenFile (const char* path) {
|
||||
|
||||
OpenURL (path, NULL);
|
||||
|
||||
Reference in New Issue
Block a user