Add link helper for iOS
This commit is contained in:
parent
fa249efac1
commit
01c57fa483
@ -121,6 +121,7 @@ namespace irr
|
||||
m_right_padding = right;
|
||||
}
|
||||
static std::string getSystemLanguageCode();
|
||||
static void openURLiOS(const char* url);
|
||||
virtual s32 getTopPadding()
|
||||
{
|
||||
return m_top_padding * m_native_scale;
|
||||
|
@ -950,6 +950,13 @@ namespace irr
|
||||
NSString* language = [[NSLocale preferredLanguages] firstObject];
|
||||
return std::string([language UTF8String]);
|
||||
}
|
||||
void CIrrDeviceiOS::openURLiOS(const char* url)
|
||||
{
|
||||
UIApplication* application = [UIApplication sharedApplication];
|
||||
NSString* url_nsstring = [NSString stringWithCString:url encoding:NSUTF8StringEncoding];
|
||||
NSURL* nsurl_val = [NSURL URLWithString:url_nsstring];
|
||||
[application openURL:nsurl_val];
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_IOS_BUILTIN_MAIN_
|
||||
|
@ -27,6 +27,10 @@
|
||||
#include "../../../lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.h"
|
||||
#endif
|
||||
|
||||
#ifdef IOS_STK
|
||||
#include "../../../lib/irrlicht/source/Irrlicht/CIrrDeviceiOS.h"
|
||||
#endif
|
||||
|
||||
using namespace Online;
|
||||
|
||||
namespace Online
|
||||
@ -48,7 +52,9 @@ namespace Online
|
||||
android->openURL(url);
|
||||
#elif defined(_WIN32)
|
||||
ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
#elif defined(__APPLE__) && !defined(IOS_STK)
|
||||
#elif defined(IOS_STK)
|
||||
irr::CIrrDeviceiOS::openURLiOS(url.c_str());
|
||||
#elif defined(__APPLE__)
|
||||
std::string command = std::string("open ").append(url);
|
||||
if (system(command.c_str()))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user