aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJuan Linietsky2014-05-14 01:22:15 -0300
committerJuan Linietsky2014-05-14 01:22:15 -0300
commitb324ff7ea584676fcc3292808d7e7ea609982f8e (patch)
treeb80e9aa0b8f2926a398e25ef904f6229cb3e28dd /platform
parent45a509282e912d85c46b40974a2deb926be5be42 (diff)
downloadgodot-b324ff7ea584676fcc3292808d7e7ea609982f8e.tar.gz
godot-b324ff7ea584676fcc3292808d7e7ea609982f8e.tar.zst
godot-b324ff7ea584676fcc3292808d7e7ea609982f8e.zip
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')
-rw-r--r--platform/android/os_android.cpp7
-rw-r--r--platform/android/os_android.h2
-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
6 files changed, 49 insertions, 7 deletions
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 3a101515d..5bc433e85 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -676,7 +676,7 @@ String OS_Android::get_unique_ID() const {
return OS::get_unique_ID();
}
-Error OS_Android::native_video_play(String p_path) {
+Error OS_Android::native_video_play(String p_path, float p_volume) {
if (video_play_func)
video_play_func(p_path);
return OK;
@@ -719,6 +719,11 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFu
get_locale_func=p_get_locale_func;
get_model_func=p_get_model_func;
get_unique_id_func=p_get_unique_id;
+
+ video_play_func = p_video_play_func;
+ video_is_playing_func = p_video_is_playing_func;
+ video_pause_func = p_video_pause_func;
+ video_stop_func = p_video_stop_func;
show_virtual_keyboard_func = p_show_vk;
hide_virtual_keyboard_func = p_hide_vk;
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 76139c8a2..e6d0f7ede 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -208,7 +208,7 @@ public:
void process_event(InputEvent p_event);
void init_video_mode(int p_video_width,int p_video_height);
- 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();
virtual void native_video_pause();
virtual void native_video_stop();
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 56cb73ba7..c5ac5d926 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 402c75509..c482c36a3 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 756e8b575..2ef732183 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 643bf2b5e..14b46816e 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();