summaryrefslogtreecommitdiff
path: root/platform/iphone
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-05-14 01:22:15 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-05-14 01:22:15 -0300
commitb324ff7ea584676fcc3292808d7e7ea609982f8e (patch)
treeb80e9aa0b8f2926a398e25ef904f6229cb3e28dd /platform/iphone
parent45a509282e912d85c46b40974a2deb926be5be42 (diff)
A bit of everything:
-IMA-ADPCM support for samples, this means that sound effects can be compressed and use 4 timess less RAM. -New 3D import workflow based on Wavefront OBJ. Import single objects as mesh resources instead of full scenes. Many people prefers to work this way. Just like the rest of the imported resources, these are updated in realtime if modified externally. -Mesh resources now support naming surfaces. This helps reimporting to identify which user-created materials must be kept. -Several fixes and improvements to SurfaceTool. -Anti Aliasing added to WorldEnvironment effects (using FXAA) -2D Physics bodies (RigidBody, KinematicBody, etc), Raycasts, Tilemap, etc support collision layers. This makes easy to group which objects collide against which. -2D Trigger shapes can now also trigger collision reporting in other 2D bodies (it used to be in Area2D before) -Viewport render target textures can now be filtered. -Few fixes in GDscript make it easier to work with static functions and class members. -Several and many bugfixes.
Diffstat (limited to 'platform/iphone')
-rw-r--r--platform/iphone/app_delegate.mm1
-rwxr-xr-xplatform/iphone/gl_view.mm38
-rw-r--r--platform/iphone/os_iphone.cpp6
-rw-r--r--platform/iphone/os_iphone.h2
4 files changed, 42 insertions, 5 deletions
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 56cb73ba7b..c5ac5d9263 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -165,6 +165,7 @@ static int frame_count = 0;
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
printf("****************** did receive memory warning!\n");
+ OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_MEMORY_WARNING);
};
- (void)applicationDidFinishLaunching:(UIApplication*)application {
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 402c755094..c482c36a30 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -32,6 +32,7 @@
#include "os_iphone.h"
#include "core/os/keyboard.h"
#include "core/globals.h"
+#include "servers/audio_server.h"
#import "gl_view.h"
@@ -48,6 +49,9 @@ int gl_view_base_fb;
static String keyboard_text;
static GLView* _instance = NULL;
+static bool video_found_error = false;
+static float video_previous_volume = 0.0f;
+
void _show_keyboard(String p_existing) {
keyboard_text = p_existing;
printf("instance on show is %p\n", _instance);
@@ -60,8 +64,13 @@ void _hide_keyboard() {
keyboard_text = "";
};
-bool _play_video(String p_path) {
+bool _play_video(String p_path, float p_volume) {
+ float player_volume = p_volume * AudioServer::get_singleton()->get_singleton()->get_stream_global_volume_scale();
+ video_previous_volume = [[MPMusicPlayerController applicationMusicPlayer] volume];
+
+ [[MPMusicPlayerController applicationMusicPlayer] setVolume: player_volume];
+
p_path = Globals::get_singleton()->globalize_path(p_path);
NSString* file_path = [[[NSString alloc] initWithUTF8String:p_path.utf8().get_data()] autorelease];
@@ -87,6 +96,8 @@ bool _play_video(String p_path) {
bool _is_video_playing() {
//NSInteger playback_state = _instance.moviePlayerController.playbackState;
+ if (video_found_error)
+ return false;
return (_instance.moviePlayerController.playbackState == MPMoviePlaybackStatePlaying);
}
@@ -97,6 +108,7 @@ void _pause_video() {
void _stop_video() {
[_instance.moviePlayerController stop];
[_instance.moviePlayerController.view removeFromSuperview];
+ [[MPMusicPlayerController applicationMusicPlayer] setVolume: video_previous_volume];
}
@implementation GLView
@@ -506,13 +518,37 @@ static void clear_touches() {
}
- (void)moviePlayBackDidFinish:(NSNotification*)notification {
+
+
+ NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
+ switch ([reason intValue]) {
+ case MPMovieFinishReasonPlaybackEnded:
+ //NSLog(@"Playback Ended");
+ break;
+ case MPMovieFinishReasonPlaybackError:
+ //NSLog(@"Playback Error");
+ video_found_error = true;
+ break;
+ case MPMovieFinishReasonUserExited:
+ //NSLog(@"User Exited");
+ video_found_error = true;
+ break;
+ default:
+ //NSLog(@"Unsupported reason!");
+ break;
+ }
+
MPMoviePlayerController *player = [notification object];
+
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
+ [_instance.moviePlayerController stop];
[_instance.moviePlayerController.view removeFromSuperview];
+
+ [[MPMusicPlayerController applicationMusicPlayer] setVolume: video_previous_volume];
}
@end
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 756e8b575e..2ef732183b 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -485,13 +485,13 @@ String OSIPhone::get_locale() const {
return locale_code;
}
-extern bool _play_video(String p_path);
+extern bool _play_video(String p_path, float p_volume);
extern bool _is_video_playing();
extern void _pause_video();
extern void _stop_video();
-Error OSIPhone::native_video_play(String p_path) {
- if ( _play_video(p_path) )
+Error OSIPhone::native_video_play(String p_path, float p_volume) {
+ if ( _play_video(p_path, p_volume) )
return OK;
return FAILED;
}
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 643bf2b5e3..14b46816e9 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -184,7 +184,7 @@ public:
void set_unique_ID(String p_ID);
String get_unique_ID() const;
- virtual Error native_video_play(String p_path);
+ virtual Error native_video_play(String p_path, float p_volume);
virtual bool native_video_is_playing() const;
virtual void native_video_pause();
virtual void native_video_stop();