diff options
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/SCsub | 2 | ||||
-rw-r--r-- | platform/android/android_input_handler.cpp | 4 | ||||
-rw-r--r-- | platform/android/detect.py | 1 | ||||
-rw-r--r-- | platform/android/display_server_android.cpp | 86 | ||||
-rw-r--r-- | platform/android/display_server_android.h | 9 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/Godot.kt | 21 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java | 8 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/GodotLib.java | 5 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java | 16 | ||||
-rw-r--r-- | platform/android/java_godot_lib_jni.cpp | 7 | ||||
-rw-r--r-- | platform/android/java_godot_lib_jni.h | 1 | ||||
-rw-r--r-- | platform/android/rendering_context_driver_vulkan_android.cpp (renamed from platform/android/vulkan_context_android.cpp) | 36 | ||||
-rw-r--r-- | platform/android/rendering_context_driver_vulkan_android.h (renamed from platform/android/vulkan_context_android.h) | 25 |
13 files changed, 150 insertions, 71 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub index 97262cf148..31bc7c25b0 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -23,7 +23,7 @@ android_files = [ "android_keys_utils.cpp", "display_server_android.cpp", "plugin/godot_plugin_jni.cpp", - "vulkan_context_android.cpp", + "rendering_context_driver_vulkan_android.cpp", ] env_android = env.Clone() diff --git a/platform/android/android_input_handler.cpp b/platform/android/android_input_handler.cpp index 8e7f355114..373dd399e4 100644 --- a/platform/android/android_input_handler.cpp +++ b/platform/android/android_input_handler.cpp @@ -207,6 +207,7 @@ void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const ev->set_index(touch[i].id); ev->set_position(p_points[idx].pos); ev->set_relative(p_points[idx].pos - touch[i].pos); + ev->set_relative_screen_position(ev->get_relative()); Input::get_singleton()->parse_input_event(ev); touch.write[i].pos = p_points[idx].pos; } @@ -306,6 +307,7 @@ void AndroidInputHandler::process_mouse_event(int p_event_action, int p_event_an ev->set_position(p_event_pos); ev->set_global_position(p_event_pos); ev->set_relative(p_event_pos - hover_prev_pos); + ev->set_relative_screen_position(ev->get_relative()); Input::get_singleton()->parse_input_event(ev); hover_prev_pos = p_event_pos; } break; @@ -342,10 +344,12 @@ void AndroidInputHandler::process_mouse_event(int p_event_action, int p_event_an ev->set_position(hover_prev_pos); ev->set_global_position(hover_prev_pos); ev->set_relative(p_event_pos); + ev->set_relative_screen_position(p_event_pos); } else { ev->set_position(p_event_pos); ev->set_global_position(p_event_pos); ev->set_relative(p_event_pos - hover_prev_pos); + ev->set_relative_screen_position(ev->get_relative()); mouse_event_info.pos = p_event_pos; hover_prev_pos = p_event_pos; } diff --git a/platform/android/detect.py b/platform/android/detect.py index b396e5eb2d..8976e218b3 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -28,6 +28,7 @@ def get_opts(): "android-" + str(get_min_target_api()), ), BoolVariable("store_release", "Editor build for Google Play Store (for official builds only)", False), + BoolVariable("generate_apk", "Generate an APK/AAB after building Android library by calling Gradle", False), ] diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index 4a9915379a..01ecbc7164 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -42,7 +42,7 @@ #include "servers/rendering/rendering_device.h" #if defined(VULKAN_ENABLED) -#include "vulkan_context_android.h" +#include "rendering_context_driver_vulkan_android.h" #endif #endif @@ -127,6 +127,16 @@ bool DisplayServerAndroid::is_dark_mode() const { return godot_java->is_dark_mode(); } +void DisplayServerAndroid::set_system_theme_change_callback(const Callable &p_callable) { + system_theme_changed = p_callable; +} + +void DisplayServerAndroid::emit_system_theme_changed() { + if (system_theme_changed.is_valid()) { + system_theme_changed.call_deferred(); + } +} + void DisplayServerAndroid::clipboard_set(const String &p_text) { GodotJavaWrapper *godot_java = OS_Android::get_singleton()->get_godot_java(); ERR_FAIL_NULL(godot_java); @@ -518,15 +528,17 @@ void DisplayServerAndroid::register_android_driver() { void DisplayServerAndroid::reset_window() { #if defined(RD_ENABLED) - if (context_rd) { - VSyncMode last_vsync_mode = context_rd->get_vsync_mode(MAIN_WINDOW_ID); - context_rd->window_destroy(MAIN_WINDOW_ID); + if (rendering_context) { + if (rendering_device) { + rendering_device->screen_free(MAIN_WINDOW_ID); + } - Size2i display_size = OS_Android::get_singleton()->get_display_size(); + VSyncMode last_vsync_mode = rendering_context->window_get_vsync_mode(MAIN_WINDOW_ID); + rendering_context->window_destroy(MAIN_WINDOW_ID); union { #ifdef VULKAN_ENABLED - VulkanContextAndroid::WindowPlatformData vulkan; + RenderingContextDriverVulkanAndroid::WindowPlatformData vulkan; #endif } wpd; #ifdef VULKAN_ENABLED @@ -537,12 +549,20 @@ void DisplayServerAndroid::reset_window() { } #endif - if (context_rd->window_create(MAIN_WINDOW_ID, last_vsync_mode, display_size.width, display_size.height, &wpd) != OK) { - ERR_PRINT(vformat("Failed to reset %s window.", context_rd->get_api_name())); - memdelete(context_rd); - context_rd = nullptr; + if (rendering_context->window_create(MAIN_WINDOW_ID, &wpd) != OK) { + ERR_PRINT(vformat("Failed to reset %s window.", rendering_driver)); + memdelete(rendering_context); + rendering_context = nullptr; return; } + + Size2i display_size = OS_Android::get_singleton()->get_display_size(); + rendering_context->window_set_size(MAIN_WINDOW_ID, display_size.width, display_size.height); + rendering_context->window_set_vsync_mode(MAIN_WINDOW_ID, last_vsync_mode); + + if (rendering_device) { + rendering_device->screen_create(MAIN_WINDOW_ID); + } } #endif } @@ -565,28 +585,26 @@ DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, Dis #endif #if defined(RD_ENABLED) - context_rd = nullptr; + rendering_context = nullptr; rendering_device = nullptr; #if defined(VULKAN_ENABLED) if (rendering_driver == "vulkan") { - context_rd = memnew(VulkanContextAndroid); + rendering_context = memnew(RenderingContextDriverVulkanAndroid); } #endif - if (context_rd) { - if (context_rd->initialize() != OK) { - ERR_PRINT(vformat("Failed to initialize %s context", context_rd->get_api_name())); - memdelete(context_rd); - context_rd = nullptr; + if (rendering_context) { + if (rendering_context->initialize() != OK) { + ERR_PRINT(vformat("Failed to initialize %s context", rendering_driver)); + memdelete(rendering_context); + rendering_context = nullptr; return; } - Size2i display_size = OS_Android::get_singleton()->get_display_size(); - union { #ifdef VULKAN_ENABLED - VulkanContextAndroid::WindowPlatformData vulkan; + RenderingContextDriverVulkanAndroid::WindowPlatformData vulkan; #endif } wpd; #ifdef VULKAN_ENABLED @@ -597,15 +615,20 @@ DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, Dis } #endif - if (context_rd->window_create(MAIN_WINDOW_ID, p_vsync_mode, display_size.width, display_size.height, &wpd) != OK) { - ERR_PRINT(vformat("Failed to create %s window.", context_rd->get_api_name())); - memdelete(context_rd); - context_rd = nullptr; + if (rendering_context->window_create(MAIN_WINDOW_ID, &wpd) != OK) { + ERR_PRINT(vformat("Failed to create %s window.", rendering_driver)); + memdelete(rendering_context); + rendering_context = nullptr; return; } + Size2i display_size = OS_Android::get_singleton()->get_display_size(); + rendering_context->window_set_size(MAIN_WINDOW_ID, display_size.width, display_size.height); + rendering_context->window_set_vsync_mode(MAIN_WINDOW_ID, p_vsync_mode); + rendering_device = memnew(RenderingDevice); - rendering_device->initialize(context_rd); + rendering_device->initialize(rendering_context, MAIN_WINDOW_ID); + rendering_device->screen_create(MAIN_WINDOW_ID); RendererCompositorRD::make_current(); } @@ -620,11 +643,10 @@ DisplayServerAndroid::DisplayServerAndroid(const String &p_rendering_driver, Dis DisplayServerAndroid::~DisplayServerAndroid() { #if defined(RD_ENABLED) if (rendering_device) { - rendering_device->finalize(); memdelete(rendering_device); } - if (context_rd) { - memdelete(context_rd); + if (rendering_context) { + memdelete(rendering_context); } #endif } @@ -716,16 +738,16 @@ void DisplayServerAndroid::cursor_set_custom_image(const Ref<Resource> &p_cursor void DisplayServerAndroid::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) { #if defined(RD_ENABLED) - if (context_rd) { - context_rd->set_vsync_mode(p_window, p_vsync_mode); + if (rendering_context) { + rendering_context->window_set_vsync_mode(p_window, p_vsync_mode); } #endif } DisplayServer::VSyncMode DisplayServerAndroid::window_get_vsync_mode(WindowID p_window) const { #if defined(RD_ENABLED) - if (context_rd) { - return context_rd->get_vsync_mode(p_window); + if (rendering_context) { + return rendering_context->window_get_vsync_mode(p_window); } #endif return DisplayServer::VSYNC_ENABLED; diff --git a/platform/android/display_server_android.h b/platform/android/display_server_android.h index 80af4f00c1..c95eaddf93 100644 --- a/platform/android/display_server_android.h +++ b/platform/android/display_server_android.h @@ -34,7 +34,7 @@ #include "servers/display_server.h" #if defined(RD_ENABLED) -class ApiContextRD; +class RenderingContextDriver; class RenderingDevice; #endif @@ -73,7 +73,7 @@ class DisplayServerAndroid : public DisplayServer { CursorShape cursor_shape = CursorShape::CURSOR_ARROW; #if defined(RD_ENABLED) - ApiContextRD *context_rd = nullptr; + RenderingContextDriver *rendering_context = nullptr; RenderingDevice *rendering_device = nullptr; #endif @@ -84,6 +84,8 @@ class DisplayServerAndroid : public DisplayServer { Callable input_text_callback; Callable rect_changed_callback; + Callable system_theme_changed; + void _window_callback(const Callable &p_callable, const Variant &p_arg, bool p_deferred = false) const; static void _dispatch_input_events(const Ref<InputEvent> &p_event); @@ -103,8 +105,11 @@ public: virtual void tts_resume() override; virtual void tts_stop() override; + void emit_system_theme_changed(); + virtual bool is_dark_mode_supported() const override; virtual bool is_dark_mode() const override; + virtual void set_system_theme_change_callback(const Callable &p_callable) override; virtual void clipboard_set(const String &p_text) override; virtual String clipboard_get() const override; diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt index 3189d3de1d..a0e020b55e 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.kt @@ -149,6 +149,7 @@ class Godot(private val context: Context) : SensorEventListener { private var useApkExpansion = false private var useImmersive = false private var useDebugOpengl = false + private var darkMode = false; private var containerLayout: FrameLayout? = null var renderView: GodotRenderView? = null @@ -184,6 +185,8 @@ class Godot(private val context: Context) : SensorEventListener { return } + darkMode = context.resources?.configuration?.uiMode?.and(Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES + beginBenchmarkMeasure("Startup", "Godot::onCreate") try { this.primaryHost = primaryHost @@ -560,6 +563,17 @@ class Godot(private val context: Context) : SensorEventListener { } /** + * Configuration change callback + */ + fun onConfigurationChanged(newConfig: Configuration) { + var newDarkMode = newConfig.uiMode?.and(Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES + if (darkMode != newDarkMode) { + darkMode = newDarkMode + GodotLib.onNightModeChanged() + } + } + + /** * Activity result callback */ fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { @@ -733,7 +747,7 @@ class Godot(private val context: Context) : SensorEventListener { */ @Keep private fun isDarkModeSupported(): Boolean { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q + return context.resources?.configuration?.uiMode?.and(Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_UNDEFINED } /** @@ -741,10 +755,7 @@ class Godot(private val context: Context) : SensorEventListener { */ @Keep private fun isDarkMode(): Boolean { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - return context.resources?.configuration?.uiMode?.and(Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES - } - return false + return darkMode } fun hasClipboard(): Boolean { diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java b/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java index 643c9a658e..a323045e1b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotFragment.java @@ -38,6 +38,7 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.os.Messenger; @@ -147,6 +148,13 @@ public class GodotFragment extends Fragment implements IDownloaderClient, GodotH @CallSuper @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + godot.onConfigurationChanged(newConfig); + } + + @CallSuper + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCallback != null) { diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java index fee50e93c2..d0c3d4a687 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotLib.java @@ -220,6 +220,11 @@ public class GodotLib { public static native void requestPermissionResult(String p_permission, boolean p_result); /** + * Invoked on the theme light/dark mode change. + */ + public static native void onNightModeChanged(); + + /** * Invoked on the GL thread to configure the height of the virtual keyboard. */ public static native void setVirtualKeyboardHeight(int p_height); diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java index 3070a8a207..dc8a0e54bb 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java @@ -34,10 +34,13 @@ import org.godotengine.godot.*; import android.content.Context; import android.content.res.Configuration; +import android.os.Build; import android.os.Handler; import android.os.Message; import android.text.InputFilter; import android.text.InputType; +import android.text.TextUtils; +import android.text.method.DigitsKeyListener; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; @@ -45,6 +48,7 @@ import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import java.lang.ref.WeakReference; +import java.util.Locale; public class GodotEditText extends EditText { // =========================================================== @@ -137,6 +141,7 @@ public class GodotEditText extends EditText { } int inputType = InputType.TYPE_CLASS_TEXT; + String acceptCharacters = null; switch (edit.getKeyboardType()) { case KEYBOARD_TYPE_DEFAULT: inputType = InputType.TYPE_CLASS_TEXT; @@ -148,7 +153,8 @@ public class GodotEditText extends EditText { inputType = InputType.TYPE_CLASS_NUMBER; break; case KEYBOARD_TYPE_NUMBER_DECIMAL: - inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED; + inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL; + acceptCharacters = "0123456789,.- "; break; case KEYBOARD_TYPE_PHONE: inputType = InputType.TYPE_CLASS_PHONE; @@ -165,6 +171,14 @@ public class GodotEditText extends EditText { } edit.setInputType(inputType); + if (!TextUtils.isEmpty(acceptCharacters)) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + edit.setKeyListener(DigitsKeyListener.getInstance(Locale.getDefault())); + } else { + edit.setKeyListener(DigitsKeyListener.getInstance(acceptCharacters)); + } + } + edit.mInputWrapper.setOriginText(text); edit.addTextChangedListener(edit.mInputWrapper); final InputMethodManager imm = (InputMethodManager)mRenderView.getView().getContext().getSystemService(Context.INPUT_METHOD_SERVICE); diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index 08e792cc04..85d5cf2796 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -487,6 +487,13 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv * Callable(obj, str_method).call_deferredp(argptrs, count); } +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onNightModeChanged(JNIEnv *env, jclass clazz) { + DisplayServerAndroid *ds = (DisplayServerAndroid *)DisplayServer::get_singleton(); + if (ds) { + ds->emit_system_theme_changed(); + } +} + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result) { String permission = jstring_to_string(p_permission, env); if (permission == "android.permission.RECORD_AUDIO" && p_result) { diff --git a/platform/android/java_godot_lib_jni.h b/platform/android/java_godot_lib_jni.h index 1ddda6c1c8..f32ffc291a 100644 --- a/platform/android/java_godot_lib_jni.h +++ b/platform/android/java_godot_lib_jni.h @@ -66,6 +66,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jclass clazz, jlong ID, jstring method, jobjectArray params); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHeight(JNIEnv *env, jclass clazz, jint p_height); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onNightModeChanged(JNIEnv *env, jclass clazz); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererResumed(JNIEnv *env, jclass clazz); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererPaused(JNIEnv *env, jclass clazz); } diff --git a/platform/android/vulkan_context_android.cpp b/platform/android/rendering_context_driver_vulkan_android.cpp index 4f9140bf3e..9232126b04 100644 --- a/platform/android/vulkan_context_android.cpp +++ b/platform/android/rendering_context_driver_vulkan_android.cpp @@ -1,5 +1,5 @@ /**************************************************************************/ -/* vulkan_context_android.cpp */ +/* rendering_context_driver_vulkan_android.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#include "vulkan_context_android.h" +#include "rendering_context_driver_vulkan_android.h" #ifdef VULKAN_ENABLED @@ -38,32 +38,32 @@ #include <vulkan/vulkan.h> #endif -const char *VulkanContextAndroid::_get_platform_surface_extension() const { +const char *RenderingContextDriverVulkanAndroid::_get_platform_surface_extension() const { return VK_KHR_ANDROID_SURFACE_EXTENSION_NAME; } -Error VulkanContextAndroid::window_create(DisplayServer::WindowID p_window_id, DisplayServer::VSyncMode p_vsync_mode, int p_width, int p_height, const void *p_platform_data) { - const WindowPlatformData *wpd = (const WindowPlatformData *)p_platform_data; +RenderingContextDriver::SurfaceID RenderingContextDriverVulkanAndroid::surface_create(const void *p_platform_data) { + const WindowPlatformData *wpd = (const WindowPlatformData *)(p_platform_data); - VkAndroidSurfaceCreateInfoKHR createInfo = {}; - createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; - createInfo.window = wpd->window; + VkAndroidSurfaceCreateInfoKHR create_info = {}; + create_info.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; + create_info.window = wpd->window; - VkSurfaceKHR surface = VK_NULL_HANDLE; - VkResult err = vkCreateAndroidSurfaceKHR(get_instance(), &createInfo, nullptr, &surface); - if (err != VK_SUCCESS) { - ERR_FAIL_V_MSG(ERR_CANT_CREATE, "vkCreateAndroidSurfaceKHR failed with error " + itos(err)); - } + VkSurfaceKHR vk_surface = VK_NULL_HANDLE; + VkResult err = vkCreateAndroidSurfaceKHR(instance_get(), &create_info, nullptr, &vk_surface); + ERR_FAIL_COND_V(err != VK_SUCCESS, SurfaceID()); - return _window_create(DisplayServer::MAIN_WINDOW_ID, p_vsync_mode, surface, p_width, p_height); + Surface *surface = memnew(Surface); + surface->vk_surface = vk_surface; + return SurfaceID(surface); } -bool VulkanContextAndroid::_use_validation_layers() { - uint32_t count = 0; - _get_preferred_validation_layers(&count, nullptr); +bool RenderingContextDriverVulkanAndroid::_use_validation_layers() const { + TightLocalVector<const char *> layer_names; + Error err = _find_validation_layers(layer_names); // On Android, we use validation layers automatically if they were explicitly linked with the app. - return count > 0; + return (err == OK) && !layer_names.is_empty(); } #endif // VULKAN_ENABLED diff --git a/platform/android/vulkan_context_android.h b/platform/android/rendering_context_driver_vulkan_android.h index 3cee3feb86..a2a42eef24 100644 --- a/platform/android/vulkan_context_android.h +++ b/platform/android/rendering_context_driver_vulkan_android.h @@ -1,5 +1,5 @@ /**************************************************************************/ -/* vulkan_context_android.h */ +/* rendering_context_driver_vulkan_android.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,31 +28,32 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ -#ifndef VULKAN_CONTEXT_ANDROID_H -#define VULKAN_CONTEXT_ANDROID_H +#ifndef RENDERING_CONTEXT_DRIVER_VULKAN_ANDROID_H +#define RENDERING_CONTEXT_DRIVER_VULKAN_ANDROID_H #ifdef VULKAN_ENABLED -#include "drivers/vulkan/vulkan_context.h" +#include "drivers/vulkan/rendering_context_driver_vulkan.h" struct ANativeWindow; -class VulkanContextAndroid : public VulkanContext { +class RenderingContextDriverVulkanAndroid : public RenderingContextDriverVulkan { +private: virtual const char *_get_platform_surface_extension() const override final; +protected: + SurfaceID surface_create(const void *p_platform_data) override final; + bool _use_validation_layers() const override final; + public: struct WindowPlatformData { ANativeWindow *window; }; - virtual Error window_create(DisplayServer::WindowID p_window_id, DisplayServer::VSyncMode p_vsync_mode, int p_width, int p_height, const void *p_platform_data) override final; - VulkanContextAndroid() = default; - ~VulkanContextAndroid() override = default; - -protected: - bool _use_validation_layers() override; + RenderingContextDriverVulkanAndroid() = default; + ~RenderingContextDriverVulkanAndroid() override = default; }; #endif // VULKAN_ENABLED -#endif // VULKAN_CONTEXT_ANDROID_H +#endif // RENDERING_CONTEXT_DRIVER_VULKAN_ANDROID_H |