From f64e345e9b35dc07628a30a5ed8a88b8b67fdc69 Mon Sep 17 00:00:00 2001 From: xiangsilian Date: Mon, 29 Sep 2025 23:42:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/texture_loading/texture_loading.cpp | 43 ++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/samples/api/texture_loading/texture_loading.cpp b/samples/api/texture_loading/texture_loading.cpp index 99abf41..cb50fa7 100644 --- a/samples/api/texture_loading/texture_loading.cpp +++ b/samples/api/texture_loading/texture_loading.cpp @@ -1408,10 +1408,10 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) const char* filename_demo4 = "assets/demo4.png"; #else const char* filename_test = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/DemoHeadBaseColor.png"; - const char* filename_demo1 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/assets/demo1.png"; - const char* filename_demo2 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/assets/demo2.png"; - const char* filename_demo3 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/assets/demo3.png"; - const char* filename_demo4 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/assets/demo4.png"; + const char* filename_demo1 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/demo1.png"; + const char* filename_demo2 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/demo2.png"; + const char* filename_demo3 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/demo3.png"; + const char* filename_demo4 = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/demo4.png"; #endif // _WIN32 @@ -1625,7 +1625,7 @@ void TextureLoading::view_changed() void TextureLoading::input_event(const vkb::InputEvent& input_event) { ApiVulkanSample::input_event(input_event); - if (input_event.get_source() == vkb::EventSource::Touchscreen || input_event.get_source() == vkb::EventSource::Mouse) + if (input_event.get_source() == vkb::EventSource::Touchscreen) { const auto& touch_event = static_cast(input_event); @@ -1662,6 +1662,39 @@ void TextureLoading::input_event(const vkb::InputEvent& input_event) } } } + + if (input_event.get_source() == vkb::EventSource::Mouse) + { + const auto& touch_event = static_cast(input_event); + if (touch_event.get_action() == vkb::MouseAction::Up) + { + if (cur_texture == "texture") + { + update_texture(tex_demo1); + cur_texture = "tex_demo1"; + } + else if (cur_texture == "tex_demo1") + { + update_texture(tex_demo2); + cur_texture = "tex_demo2"; + } + else if (cur_texture == "tex_demo2") + { + update_texture(tex_demo3); + cur_texture = "tex_demo3"; + } + else if (cur_texture == "tex_demo3") + { + update_texture(tex_demo4); + cur_texture = "tex_demo4"; + } + else if (cur_texture == "tex_demo4") + { + update_texture(texture); + cur_texture = "texture"; + } + } + } } void TextureLoading::on_update_ui_overlay(vkb::Drawer& drawer)