1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Add clipboard operation for android OS

This commit is contained in:
Xavier Sellier
2018-04-03 11:58:17 -04:00
parent 0b180a0732
commit 4d2853fcdc
4 changed files with 71 additions and 48 deletions

View File

@@ -177,43 +177,6 @@ void OS_Android::set_main_loop(MainLoop *p_main_loop) {
main_loop = p_main_loop;
input->set_main_loop(p_main_loop);
#if 0
print_line("preGS");
FileAccess *f=memnew( FileAccessAndroid );
print("made f %p\n",f);
Error err = f->open("AndroidManifest.xml",FileAccess::READ);
if (err) {
print("************NO FILE!!\n");
} else {
print("************YES FILE!!\n");
}
f->close();
print_line("end");
AAssetDir* aad = AAssetManager_openDir(FileAccessAndroid::asset_manager,".");
if (aad) {
print_line("DIR OPEN OK");
const char *fn= AAssetDir_getNextFileName(aad);
while(fn) {
print_line("FNAME: "+String(fn));
fn= AAssetDir_getNextFileName(aad);
}
AAssetDir_close(aad);
} else {
print_line("DIR NO OPEN");
}
#endif
}
void OS_Android::delete_main_loop() {
@@ -271,13 +234,10 @@ int OS_Android::get_mouse_button_state() const {
return 0;
}
void OS_Android::set_window_title(const String &p_title) {
}
//interesting byt not yet
//void set_clipboard(const String& p_text);
//String get_clipboard() const;
void OS_Android::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
}
@@ -324,7 +284,7 @@ void OS_Android::set_cursor_shape(CursorShape p_shape) {
//android really really really has no mouse.. how amazing..
}
void OS_Android::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
void OS_Android::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
// Since android has no mouse, we do not need to change its texture (how amazing !)
}
@@ -678,6 +638,23 @@ String OS_Android::get_locale() const {
return OS_Unix::get_locale();
}
void OS_Android::set_clipboard(const String &p_text) {
if (set_clipboard_func) {
set_clipboard_func(p_text);
} else {
OS_Unix::set_clipboard(p_text);
}
}
String OS_Android::get_clipboard() const {
if (get_clipboard_func) {
return get_clipboard_func();
}
return OS_Unix::get_clipboard();
}
String OS_Android::get_model_name() const {
if (get_model_func)
@@ -791,7 +768,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, AlertFunc p_alert_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, SetClipboardFunc p_set_clipboard_func, GetClipboardFunc p_get_clipboard_func) {
use_apk_expansion = p_use_apk_expansion;
default_videomode.width = 800;
@@ -827,6 +804,9 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI
set_keep_screen_on_func = p_set_keep_screen_on_func;
alert_func = p_alert_func;
use_reload_hooks = false;
set_clipboard_func = p_set_clipboard_func;
get_clipboard_func = p_get_clipboard_func;
}
OS_Android::~OS_Android() {