diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/java/src/org/godotengine/godot/Godot.java | 19 | ||||
-rw-r--r-- | platform/android/java_glue.cpp | 11 | ||||
-rw-r--r-- | platform/android/os_android.cpp | 7 | ||||
-rw-r--r-- | platform/android/os_android.h | 6 | ||||
-rw-r--r-- | platform/osx/detect.py | 2 | ||||
-rw-r--r-- | platform/server/detect.py | 1 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 12 | ||||
-rw-r--r-- | platform/x11/detect.py | 1 |
8 files changed, 50 insertions, 9 deletions
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 4b80db7e33..27b90cc669 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -295,6 +295,25 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC }); } } + + public void alert(final String message, final String title) { + runOnUiThread(new Runnable() { + @Override + public void run() { + AlertDialog.Builder builder = new AlertDialog.Builder(getInstance()); + builder.setMessage(message).setTitle(title); + builder.setPositiveButton( + "OK", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + AlertDialog dialog = builder.create(); + dialog.show(); + } + }); + } private static Godot _self; diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index e5b655e5d5..0937620c8a 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -679,6 +679,7 @@ static jmethodID _isVideoPlaying=0; static jmethodID _pauseVideo=0; static jmethodID _stopVideo=0; static jmethodID _setKeepScreenOn=0; +static jmethodID _alertDialog=0; static void _gfx_init_func(void* ud, bool gl2) { @@ -783,6 +784,13 @@ static void _set_keep_screen_on(bool p_enabled) { env->CallVoidMethod(_godot_instance, _setKeepScreenOn, p_enabled); } +static void _alert(const String& p_message, const String& p_title) { + JNIEnv* env = ThreadAndroid::get_env(); + jstring jStrMessage = env->NewStringUTF(p_message.utf8().get_data()); + jstring jStrTitle = env->NewStringUTF(p_title.utf8().get_data()); + env->CallVoidMethod(_godot_instance, _alertDialog, jStrMessage, jStrTitle); +} + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * env, jobject obj, jobject activity,jboolean p_need_reload_hook, jobjectArray p_cmdline,jobject p_asset_manager) { __android_log_print(ANDROID_LOG_INFO,"godot","**INIT EVENT! - %p\n",env); @@ -820,6 +828,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e _on_video_init = env->GetMethodID(cls, "onVideoInit", "(Z)V"); _setKeepScreenOn = env->GetMethodID(cls,"setKeepScreenOn","(Z)V"); + _alertDialog = env->GetMethodID(cls,"alert","(Ljava/lang/String;Ljava/lang/String;)V"); jclass clsio = env->FindClass("org/godotengine/godot/Godot"); if (cls) { @@ -883,7 +892,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e __android_log_print(ANDROID_LOG_INFO,"godot","CMDLINE LEN %i - APK EXPANSION %I\n",cmdlen,int(use_apk_expansion)); - os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _get_system_dir, _play_video,_is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, use_apk_expansion); + os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _get_system_dir, _play_video,_is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, use_apk_expansion); os_android->set_need_reload_hooks(p_need_reload_hook); char wd[500]; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 862709fc7d..3513e6fc04 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -246,9 +246,11 @@ void OS_Android::print(const char *p_format, ... ) { } -void OS_Android::alert(const String& p_alert) { +void OS_Android::alert(const String& p_alert,const String& p_title) { print("ALERT: %s\n",p_alert.utf8().get_data()); + if (alert_func) + alert_func(p_alert, p_title); } @@ -812,7 +814,7 @@ String OS_Android::get_joy_guid(int p_device) const { return input->get_joy_guid_remapped(p_device); } -OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func,GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, bool p_use_apk_expansion) { +OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func,GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) { use_apk_expansion=p_use_apk_expansion; default_videomode.width=800; @@ -846,6 +848,7 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFu set_screen_orientation_func=p_screen_orient; set_keep_screen_on_func = p_set_keep_screen_on_func; + alert_func = p_alert_func; use_reload_hooks=false; } diff --git a/platform/android/os_android.h b/platform/android/os_android.h index d383fd2036..84ee00bab6 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -75,6 +75,7 @@ typedef bool (*VideoIsPlayingFunc)(); typedef void (*VideoPauseFunc)(); typedef void (*VideoStopFunc)(); typedef void (*SetKeepScreenOnFunc)(bool p_enabled); +typedef void (*AlertFunc)(const String&, const String&); class OS_Android : public OS_Unix { public: @@ -154,6 +155,7 @@ private: VideoPauseFunc video_pause_func; VideoStopFunc video_stop_func; SetKeepScreenOnFunc set_keep_screen_on_func; + AlertFunc alert_func; public: @@ -181,7 +183,7 @@ public: virtual void vprint(const char* p_format, va_list p_list, bool p_stderr=false); virtual void print(const char *p_format, ... ); - virtual void alert(const String& p_alert); + virtual void alert(const String& p_alert,const String& p_title="ALERT!"); virtual void set_mouse_show(bool p_show); @@ -260,7 +262,7 @@ public: virtual String get_joy_guid(int p_device) const; void joy_connection_changed(int p_device, bool p_connected, String p_name); - OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func,GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, bool p_use_apk_expansion); + OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func,GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion); ~OS_Android(); }; diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 9191f1aabc..ccd86177ab 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -80,10 +80,12 @@ def configure(env): env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"]) env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED']) + env.Append(CPPFLAGS=["-mmacosx-version-min=10.9"]) env.Append(LIBS=['pthread']) #env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4']) #env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk']) env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback']) + env.Append(LINKFLAGS=["-mmacosx-version-min=10.9"]) if (env["CXX"] == "clang++"): env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) diff --git a/platform/server/detect.py b/platform/server/detect.py index 4d86ffd376..8bc85f342d 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -76,7 +76,6 @@ def configure(env): env.ParseConfig('pkg-config libwebp --cflags --libs') if (env['builtin_freetype'] == 'no'): - env['builtin_libpng'] = 'no' # Freetype links against libpng env.ParseConfig('pkg-config freetype2 --cflags --libs') if (env['builtin_libpng'] == 'no'): diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 3987044d80..04afe63e64 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1329,10 +1329,18 @@ void OS_Windows::vprint(const char* p_format, va_list p_list, bool p_stderr) { MultiByteToWideChar(CP_UTF8,0,buf,len,wbuf,wlen); wbuf[wlen]=0; +// Recent MinGW and MSVC compilers seem to disagree on the case here +#ifdef __MINGW32__ if (p_stderr) - fwprintf(stderr,L"%s",wbuf); + fwprintf(stderr, L"%S", wbuf); else - wprintf(L"%s",wbuf); + wprintf(L"%S", wbuf); +#else // MSVC + if (p_stderr) + fwprintf(stderr, L"%s", wbuf); + else + wprintf(L"%s", wbuf); +#endif #ifdef STDOUT_FILE //vwfprintf(stdo,p_format,p_list); diff --git a/platform/x11/detect.py b/platform/x11/detect.py index d8cd79297e..857b147e14 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -140,7 +140,6 @@ def configure(env): env.ParseConfig('pkg-config libwebp --cflags --libs') if (env['builtin_freetype'] == 'no'): - env['builtin_libpng'] = 'no' # Freetype links against libpng env.ParseConfig('pkg-config freetype2 --cflags --libs') if (env['builtin_libpng'] == 'no'): |