You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add support for embedding game process in the Android Editor
- Implement Android editor specific `EmbeddedGodotGame` to support embedding the game window in the Android editor
This commit is contained in:
@@ -487,6 +487,49 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getEditorSetting(J
|
||||
return env->NewStringUTF(editor_setting_value.utf8().get_data());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setEditorSetting(JNIEnv *env, jclass clazz, jstring p_key, jobject p_data) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (EditorSettings::get_singleton() != nullptr) {
|
||||
String key = jstring_to_string(p_key, env);
|
||||
Variant data = _jobject_to_variant(env, p_data);
|
||||
EditorSettings::get_singleton()->set(key, data);
|
||||
}
|
||||
#else
|
||||
WARN_PRINT("Access to the Editor Settings in only available on Editor builds");
|
||||
#endif
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_org_godotengine_godot_GodotLib_getEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_default_value) {
|
||||
jvalret result;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (EditorSettings::get_singleton() != nullptr) {
|
||||
String section = jstring_to_string(p_section, env);
|
||||
String key = jstring_to_string(p_key, env);
|
||||
Variant default_value = _jobject_to_variant(env, p_default_value);
|
||||
Variant data = EditorSettings::get_singleton()->get_project_metadata(section, key, default_value);
|
||||
result = _variant_to_jvalue(env, data.get_type(), &data, true);
|
||||
}
|
||||
#else
|
||||
WARN_PRINT("Access to the Editor Settings Project Metadata is only available on Editor builds");
|
||||
#endif
|
||||
|
||||
return result.obj;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setEditorProjectMetadata(JNIEnv *env, jclass clazz, jstring p_section, jstring p_key, jobject p_data) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (EditorSettings::get_singleton() != nullptr) {
|
||||
String section = jstring_to_string(p_section, env);
|
||||
String key = jstring_to_string(p_key, env);
|
||||
Variant data = _jobject_to_variant(env, p_data);
|
||||
EditorSettings::get_singleton()->set_project_metadata(section, key, data);
|
||||
}
|
||||
#else
|
||||
WARN_PRINT("Access to the Editor Settings Project Metadata is only available on Editor builds");
|
||||
#endif
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onNightModeChanged(JNIEnv *env, jclass clazz) {
|
||||
DisplayServerAndroid *ds = (DisplayServerAndroid *)DisplayServer::get_singleton();
|
||||
if (ds) {
|
||||
@@ -555,4 +598,19 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getProjectResource
|
||||
const String resource_dir = OS::get_singleton()->get_resource_dir();
|
||||
return env->NewStringUTF(resource_dir.utf8().get_data());
|
||||
}
|
||||
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_isEditorHint(JNIEnv *env, jclass clazz) {
|
||||
Engine *engine = Engine::get_singleton();
|
||||
if (engine) {
|
||||
return engine->is_editor_hint();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_isProjectManagerHint(JNIEnv *env, jclass clazz) {
|
||||
Engine *engine = Engine::get_singleton();
|
||||
if (engine) {
|
||||
return engine->is_project_manager_hint();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user