diff options
Diffstat (limited to 'platform/iphone')
-rw-r--r-- | platform/iphone/app_delegate.mm | 2 | ||||
-rw-r--r-- | platform/iphone/detect.py | 8 | ||||
-rw-r--r-- | platform/iphone/export/export.cpp | 6 | ||||
-rw-r--r-- | platform/iphone/game_center.mm | 5 | ||||
-rw-r--r-- | platform/iphone/logo.png | bin | 1905 -> 1489 bytes | |||
-rw-r--r-- | platform/iphone/os_iphone.cpp | 15 | ||||
-rw-r--r-- | platform/iphone/os_iphone.h | 14 | ||||
-rw-r--r-- | platform/iphone/view_controller.mm | 65 |
8 files changed, 46 insertions, 69 deletions
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index dd5ce4ab10..cc4985eb0c 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -643,7 +643,7 @@ static int frame_count = 0; view_controller.view = glView; window.rootViewController = view_controller; - _set_keep_screen_on(bool(GLOBAL_DEF("display/window/keep_screen_on", true)) ? YES : NO); + _set_keep_screen_on(bool(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true)) ? YES : NO); glView.useCADisplayLink = bool(GLOBAL_DEF("display.iOS/use_cadisplaylink", true)) ? YES : NO; printf("cadisaplylink: %d", glView.useCADisplayLink); diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 25674c2b47..b13a1e9643 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -47,8 +47,12 @@ def configure(env): if (env["target"].startswith("release")): env.Append(CPPFLAGS=['-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1']) - env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer', '-ffast-math', '-funsafe-math-optimizations']) - env.Append(LINKFLAGS=['-O2']) + if (env["optimize"] == "speed"): #optimize for speed (default) + env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer', '-ffast-math', '-funsafe-math-optimizations']) + env.Append(LINKFLAGS=['-O2']) + else: #optimize for size + env.Append(CPPFLAGS=['-Os', '-ftree-vectorize']) + env.Append(LINKFLAGS=['-Os']) if env["target"] == "release_debug": env.Append(CPPFLAGS=['-DDEBUG_ENABLED']) diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 4c1e02baf7..5480d30e7a 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -781,7 +781,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p int ret = unzGoToFirstFile(src_pkg_zip); Vector<uint8_t> project_file_data; while (ret == UNZ_OK) { +#if defined(OSX_ENABLED) || defined(X11_ENABLED) bool is_execute = false; +#endif //get filename unz_file_info info; @@ -812,7 +814,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p continue; //ignore! } found_library = true; +#if defined(OSX_ENABLED) || defined(X11_ENABLED) is_execute = true; +#endif file = "godot_ios.a"; } if (file == project_file) { @@ -855,7 +859,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p f->close(); memdelete(f); -#ifdef OSX_ENABLED +#if defined(OSX_ENABLED) || defined(X11_ENABLED) if (is_execute) { // we need execute rights on this file chmod(file.utf8().get_data(), 0755); diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm index 57ff79f7bc..e210bfb862 100644 --- a/platform/iphone/game_center.mm +++ b/platform/iphone/game_center.mm @@ -139,7 +139,6 @@ Error GameCenter::post_score(Variant p_score) { [GKScore reportScores:@[ reporter ] withCompletionHandler:^(NSError *error) { - Dictionary ret; ret["type"] = "post_score"; if (error == nil) { @@ -177,7 +176,6 @@ Error GameCenter::award_achievement(Variant p_params) { [GKAchievement reportAchievements:@[ achievement ] withCompletionHandler:^(NSError *error) { - Dictionary ret; ret["type"] = "award_achievement"; if (error == nil) { @@ -196,7 +194,6 @@ Error GameCenter::award_achievement(Variant p_params) { void GameCenter::request_achievement_descriptions() { [GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:^(NSArray *descriptions, NSError *error) { - Dictionary ret; ret["type"] = "achievement_descriptions"; if (error == nil) { @@ -252,7 +249,6 @@ void GameCenter::request_achievement_descriptions() { void GameCenter::request_achievements() { [GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) { - Dictionary ret; ret["type"] = "achievements"; if (error == nil) { @@ -347,7 +343,6 @@ Error GameCenter::request_identity_verification_signature() { GKLocalPlayer *player = [GKLocalPlayer localPlayer]; [player generateIdentityVerificationSignatureWithCompletionHandler:^(NSURL *publicKeyUrl, NSData *signature, NSData *salt, uint64_t timestamp, NSError *error) { - Dictionary ret; ret["type"] = "identity_verification_signature"; if (error == nil) { diff --git a/platform/iphone/logo.png b/platform/iphone/logo.png Binary files differindex 8dd718524c..405b6f93ca 100644 --- a/platform/iphone/logo.png +++ b/platform/iphone/logo.png diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index f618c80a77..a4538a6673 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -64,11 +64,6 @@ OSIPhone *OSIPhone::get_singleton() { return (OSIPhone *)OS::get_singleton(); }; -uint8_t OSIPhone::get_orientations() const { - - return supported_orientations; -}; - extern int gl_view_base_fb; // from gl_view.mm void OSIPhone::set_data_dir(String p_dir) { @@ -98,13 +93,13 @@ void OSIPhone::initialize_core() { set_data_dir(data_dir); }; +int OSIPhone::get_current_video_driver() const { + return video_driver_index; +} + Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { - supported_orientations = 0; - supported_orientations |= ((GLOBAL_DEF("video_mode/allow_horizontal", true) ? 1 : 0) << LandscapeLeft); - supported_orientations |= ((GLOBAL_DEF("video_mode/allow_horizontal_flipped", false) ? 1 : 0) << LandscapeRight); - supported_orientations |= ((GLOBAL_DEF("video_mode/allow_vertical", false) ? 1 : 0) << PortraitDown); - supported_orientations |= ((GLOBAL_DEF("video_mode/allow_vertical_flipped", false) ? 1 : 0) << PortraitUp); + video_driver_index = p_video_driver; //this may be misleading RasterizerGLES3::register_config(); RasterizerGLES3::make_current(); diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index 7d73a6fe5c..db2912ad93 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -47,14 +47,6 @@ class OSIPhone : public OS_Unix { -public: - enum Orientations { - PortraitDown, - PortraitUp, - LandscapeLeft, - LandscapeRight, - }; - private: enum { MAX_MOUSE_COUNT = 8, @@ -64,8 +56,6 @@ private: static HashMap<String, void *> dynamic_symbol_lookup_table; friend void register_dynamic_symbol(char *name, void *address); - uint8_t supported_orientations; - VisualServer *visual_server; AudioDriverCoreAudio audio_driver; @@ -87,6 +77,8 @@ private: virtual int get_video_driver_count() const; virtual const char *get_video_driver_name(int p_driver) const; + virtual int get_current_video_driver() const; + virtual void initialize_core(); virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); @@ -122,6 +114,8 @@ private: int virtual_keyboard_height; + int video_driver_index; + public: bool iterate(); diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm index cdaae0cb81..f75f0fd812 100644 --- a/platform/iphone/view_controller.mm +++ b/platform/iphone/view_controller.mm @@ -83,51 +83,36 @@ int add_cmdline(int p_argc, char **p_args) { printf("*********** did receive memory warning!\n"); }; -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)p_orientation { - - if (/*OSIPhone::get_singleton() == NULL*/ TRUE) { - - printf("checking on info.plist\n"); - NSArray *arr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]; - switch (p_orientation) { - - case UIInterfaceOrientationLandscapeLeft: - return [arr indexOfObject:@"UIInterfaceOrientationLandscapeLeft"] != NSNotFound ? YES : NO; - - case UIInterfaceOrientationLandscapeRight: - return [arr indexOfObject:@"UIInterfaceOrientationLandscapeRight"] != NSNotFound ? YES : NO; - - case UIInterfaceOrientationPortrait: - return [arr indexOfObject:@"UIInterfaceOrientationPortrait"] != NSNotFound ? YES : NO; - - case UIInterfaceOrientationPortraitUpsideDown: - return [arr indexOfObject:@"UIInterfaceOrientationPortraitUpsideDown"] != NSNotFound ? YES : NO; - - default: - return NO; - } - }; - - uint8_t supported = OSIPhone::get_singleton()->get_orientations(); - switch (p_orientation) { - - case UIInterfaceOrientationLandscapeLeft: - return supported & (1 << OSIPhone::LandscapeLeft) ? YES : NO; - - case UIInterfaceOrientationLandscapeRight: - return supported & (1 << OSIPhone::LandscapeRight) ? YES : NO; - - case UIInterfaceOrientationPortrait: - return supported & (1 << OSIPhone::PortraitDown) ? YES : NO; - - case UIInterfaceOrientationPortraitUpsideDown: - return supported & (1 << OSIPhone::PortraitUp) ? YES : NO; - +- (BOOL)shouldAutorotate { + switch (OS::get_singleton()->get_screen_orientation()) { + case OS::SCREEN_SENSOR: + case OS::SCREEN_SENSOR_LANDSCAPE: + case OS::SCREEN_SENSOR_PORTRAIT: + return YES; default: return NO; } }; +- (UIInterfaceOrientationMask)supportedInterfaceOrientations { + switch (OS::get_singleton()->get_screen_orientation()) { + case OS::SCREEN_PORTRAIT: + return UIInterfaceOrientationMaskPortrait; + case OS::SCREEN_REVERSE_LANDSCAPE: + return UIInterfaceOrientationMaskLandscapeRight; + case OS::SCREEN_REVERSE_PORTRAIT: + return UIInterfaceOrientationMaskPortraitUpsideDown; + case OS::SCREEN_SENSOR_LANDSCAPE: + return UIInterfaceOrientationMaskLandscape; + case OS::SCREEN_SENSOR_PORTRAIT: + return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown; + case OS::SCREEN_SENSOR: + return UIInterfaceOrientationMaskAll; + case OS::SCREEN_LANDSCAPE: + return UIInterfaceOrientationMaskLandscapeLeft; + } +}; + - (BOOL)prefersStatusBarHidden { return YES; } |