From 812b1024f0c34306d48a5cf1393e320357540295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 14 Dec 2023 11:10:36 +0100 Subject: [PATCH] Move TouchTestScreen to DevScreens --- Common/Render/ManagedTexture.cpp | 2 - Common/UI/Context.cpp | 2 + Common/UI/Context.h | 4 + UI/ControlMappingScreen.cpp | 212 ------------------------------- UI/ControlMappingScreen.h | 41 ------ UI/DevScreens.cpp | 212 +++++++++++++++++++++++++++++++ UI/DevScreens.h | 41 ++++++ UI/NativeApp.cpp | 1 + 8 files changed, 260 insertions(+), 255 deletions(-) diff --git a/Common/Render/ManagedTexture.cpp b/Common/Render/ManagedTexture.cpp index 0aeef5ba51..36a5031263 100644 --- a/Common/Render/ManagedTexture.cpp +++ b/Common/Render/ManagedTexture.cpp @@ -173,7 +173,6 @@ Draw::Texture *CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t } Draw::Texture *CreateTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType type, bool generateMips) { - INFO_LOG(SYSTEM, "CreateTextureFromFile(%s)", filename); size_t fileSize; uint8_t *buffer = g_VFS.ReadFile(filename, &fileSize); if (!buffer) { @@ -203,7 +202,6 @@ Draw::Texture *ManagedTexture::GetTexture() { ManagedTexture::ManagedTexture(Draw::DrawContext *draw, std::string_view filename, ImageFileType type, bool generateMips) : draw_(draw), filename_(filename), type_(type), generateMips_(generateMips) { - INFO_LOG(SYSTEM, "ManagedTexture::ManagedTexture (%s)", filename_.c_str()); StartLoadTask(); } diff --git a/Common/UI/Context.cpp b/Common/UI/Context.cpp index c92bbb794f..1a69b6bad6 100644 --- a/Common/UI/Context.cpp +++ b/Common/UI/Context.cpp @@ -11,6 +11,7 @@ #include "Common/Render/Text/draw_text.h" #include "Common/Render/ManagedTexture.h" #include "Common/Log.h" +#include "Common/TimeUtil.h" #include "Common/LogReporting.h" UIContext::UIContext() { @@ -44,6 +45,7 @@ void UIContext::setUIAtlas(const std::string &name) { } void UIContext::BeginFrame() { + frameStartTime_ = time_now_d(); if (!uitexture_ || UIAtlas_ != lastUIAtlas_) { uitexture_ = CreateTextureFromFile(draw_, UIAtlas_.c_str(), ImageFileType::ZIM, false); lastUIAtlas_ = UIAtlas_; diff --git a/Common/UI/Context.h b/Common/UI/Context.h index 754814f419..b64fd1f1ad 100644 --- a/Common/UI/Context.h +++ b/Common/UI/Context.h @@ -61,6 +61,8 @@ public: void RebindTexture() const; void BindFontTexture() const; + double FrameStartTime() const { return frameStartTime_; } + // TODO: Support transformed bounds using stencil void PushScissor(const Bounds &bounds); void PopScissor(); @@ -119,6 +121,8 @@ private: Draw::DrawContext *draw_ = nullptr; Bounds bounds_; + double frameStartTime_ = 0.0; + float fontScaleX_ = 1.0f; float fontScaleY_ = 1.0f; UI::FontStyle *fontStyle_ = nullptr; diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 13d0c38a65..50c5ae56a3 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -565,218 +565,6 @@ UI::EventReturn AnalogSetupScreen::OnResetToDefaults(UI::EventParams &e) { return UI::EVENT_DONE; } -void TouchTestScreen::touch(const TouchInput &touch) { - UIDialogScreenWithGameBackground::touch(touch); - if (touch.flags & TOUCH_DOWN) { - bool found = false; - for (int i = 0; i < MAX_TOUCH_POINTS; i++) { - if (touches_[i].id == touch.id) { - WARN_LOG(SYSTEM, "Double touch"); - touches_[i].x = touch.x; - touches_[i].y = touch.y; - found = true; - } - } - if (!found) { - for (int i = 0; i < MAX_TOUCH_POINTS; i++) { - if (touches_[i].id == -1) { - touches_[i].id = touch.id; - touches_[i].x = touch.x; - touches_[i].y = touch.y; - break; - } - } - } - } - if (touch.flags & TOUCH_MOVE) { - bool found = false; - for (int i = 0; i < MAX_TOUCH_POINTS; i++) { - if (touches_[i].id == touch.id) { - touches_[i].x = touch.x; - touches_[i].y = touch.y; - found = true; - } - } - if (!found) { - WARN_LOG(SYSTEM, "Move without touch down: %d", touch.id); - } - } - if (touch.flags & TOUCH_UP) { - bool found = false; - for (int i = 0; i < MAX_TOUCH_POINTS; i++) { - if (touches_[i].id == touch.id) { - found = true; - touches_[i].id = -1; - break; - } - } - if (!found) { - WARN_LOG(SYSTEM, "Touch release without touch down"); - } - } -} - -// TODO: Move this screen out into its own file. -void TouchTestScreen::CreateViews() { - using namespace UI; - - auto di = GetI18NCategory(I18NCat::DIALOG); - auto gr = GetI18NCategory(I18NCat::GRAPHICS); - root_ = new LinearLayout(ORIENT_VERTICAL); - LinearLayout *theTwo = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); - - lastKeyEvents_ = theTwo->Add(new TextView("-", new LayoutParams(FILL_PARENT, WRAP_CONTENT))); - - root_->Add(theTwo); - -#if !PPSSPP_PLATFORM(UWP) - static const char *renderingBackend[] = { "OpenGL", "Direct3D 9", "Direct3D 11", "Vulkan" }; - PopupMultiChoice *renderingBackendChoice = root_->Add(new PopupMultiChoice(&g_Config.iGPUBackend, gr->T("Backend"), renderingBackend, (int)GPUBackend::OPENGL, ARRAY_SIZE(renderingBackend), I18NCat::GRAPHICS, screenManager())); - renderingBackendChoice->OnChoice.Handle(this, &TouchTestScreen::OnRenderingBackend); - - if (!g_Config.IsBackendEnabled(GPUBackend::OPENGL)) - renderingBackendChoice->HideChoice((int)GPUBackend::OPENGL); - if (!g_Config.IsBackendEnabled(GPUBackend::DIRECT3D9)) - renderingBackendChoice->HideChoice((int)GPUBackend::DIRECT3D9); - if (!g_Config.IsBackendEnabled(GPUBackend::DIRECT3D11)) - renderingBackendChoice->HideChoice((int)GPUBackend::DIRECT3D11); - if (!g_Config.IsBackendEnabled(GPUBackend::VULKAN)) - renderingBackendChoice->HideChoice((int)GPUBackend::VULKAN); -#endif - -#if PPSSPP_PLATFORM(ANDROID) - root_->Add(new Choice(gr->T("Recreate Activity")))->OnClick.Handle(this, &TouchTestScreen::OnRecreateActivity); -#endif - root_->Add(new CheckBox(&g_Config.bImmersiveMode, gr->T("FullScreen", "Full Screen")))->OnClick.Handle(this, &TouchTestScreen::OnImmersiveModeChange); - root_->Add(new Button(di->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); -} - -void TouchTestScreen::UpdateLogView() { - while (keyEventLog_.size() > 8) { - keyEventLog_.erase(keyEventLog_.begin()); - } - - std::string text; - for (auto &iter : keyEventLog_) { - text += iter + "\n"; - } - - if (lastKeyEvents_) { - lastKeyEvents_->SetText(text); - } -} - -bool TouchTestScreen::key(const KeyInput &key) { - UIScreen::key(key); - char buf[512]; - snprintf(buf, sizeof(buf), "%s (%d) Device ID: %d [%s%s%s%s]", KeyMap::GetKeyName(key.keyCode).c_str(), key.keyCode, key.deviceId, - (key.flags & KEY_IS_REPEAT) ? "REP" : "", - (key.flags & KEY_UP) ? "UP" : "", - (key.flags & KEY_DOWN) ? "DOWN" : "", - (key.flags & KEY_CHAR) ? "CHAR" : ""); - keyEventLog_.push_back(buf); - UpdateLogView(); - return true; -} - -void TouchTestScreen::axis(const AxisInput &axis) { - char buf[512]; - snprintf(buf, sizeof(buf), "Axis: %s (%d) (value %1.3f) Device ID: %d", - KeyMap::GetAxisName(axis.axisId).c_str(), axis.axisId, axis.value, axis.deviceId); - - keyEventLog_.push_back(buf); - if (keyEventLog_.size() > 8) { - keyEventLog_.erase(keyEventLog_.begin()); - } - UpdateLogView(); -} - -void TouchTestScreen::DrawForeground(UIContext &dc) { - Bounds bounds = dc.GetLayoutBounds(); - - double now = time_now_d(); - double delta = now - lastFrameTime_; - lastFrameTime_ = now; - - dc.BeginNoTex(); - for (int i = 0; i < MAX_TOUCH_POINTS; i++) { - if (touches_[i].id != -1) { - dc.Draw()->Circle(touches_[i].x, touches_[i].y, 100.0, 3.0, 80, 0.0f, 0xFFFFFFFF, 1.0); - } - } - dc.Flush(); - - dc.Begin(); - - char buffer[4096]; - for (int i = 0; i < MAX_TOUCH_POINTS; i++) { - if (touches_[i].id != -1) { - dc.Draw()->Circle(touches_[i].x, touches_[i].y, 100.0, 3.0, 80, 0.0f, 0xFFFFFFFF, 1.0); - snprintf(buffer, sizeof(buffer), "%0.1fx%0.1f", touches_[i].x, touches_[i].y); - dc.DrawText(buffer, touches_[i].x, touches_[i].y + (touches_[i].y > g_display.dp_yres - 100.0f ? -135.0f : 95.0f), 0xFFFFFFFF, ALIGN_HCENTER | FLAG_DYNAMIC_ASCII); - } - } - - char extra_debug[2048]{}; - -#if PPSSPP_PLATFORM(ANDROID) - truncate_cpy(extra_debug, Android_GetInputDeviceDebugString().c_str()); -#endif - - snprintf(buffer, sizeof(buffer), -#if PPSSPP_PLATFORM(ANDROID) - "display_res: %dx%d\n" -#endif - "dp_res: %dx%d pixel_res: %dx%d\n" - "g_dpi: %0.3f g_dpi_scale: %0.3fx%0.3f\n" - "g_dpi_scale_real: %0.3fx%0.3f\n" - "delta: %0.2f ms fps: %0.3f\n%s", -#if PPSSPP_PLATFORM(ANDROID) - System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES), -#endif - g_display.dp_xres, g_display.dp_yres, g_display.pixel_xres, g_display.pixel_yres, - g_display.dpi, g_display.dpi_scale_x, g_display.dpi_scale_y, - g_display.dpi_scale_real_x, g_display.dpi_scale_real_y, - delta * 1000.0, 1.0 / delta, - extra_debug); - - // On Android, also add joystick debug data. - - dc.DrawTextShadow(buffer, bounds.centerX(), bounds.y + 20.0f, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII); - dc.Flush(); -} - -void RecreateActivity() { - const int SYSTEM_JELLYBEAN = 16; - if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= SYSTEM_JELLYBEAN) { - INFO_LOG(SYSTEM, "Sending recreate"); - System_Notify(SystemNotification::FORCE_RECREATE_ACTIVITY); - INFO_LOG(SYSTEM, "Got back from recreate"); - } else { - auto gr = GetI18NCategory(I18NCat::GRAPHICS); - System_Toast(gr->T("Must Restart", "You must restart PPSSPP for this change to take effect")); - } -} - -UI::EventReturn TouchTestScreen::OnImmersiveModeChange(UI::EventParams &e) { - System_Notify(SystemNotification::IMMERSIVE_MODE_CHANGE); - if (g_Config.iAndroidHwScale != 0) { - RecreateActivity(); - } - return UI::EVENT_DONE; -} - -UI::EventReturn TouchTestScreen::OnRenderingBackend(UI::EventParams &e) { - g_Config.Save("GameSettingsScreen::RenderingBackend"); - System_RestartApp("--touchscreentest"); - return UI::EVENT_DONE; -} - -UI::EventReturn TouchTestScreen::OnRecreateActivity(UI::EventParams &e) { - RecreateActivity(); - return UI::EVENT_DONE; -} - class Backplate : public UI::InertView { public: Backplate(float scale, UI::LayoutParams *layoutParams = nullptr) : InertView(layoutParams), scale_(scale) {} diff --git a/UI/ControlMappingScreen.h b/UI/ControlMappingScreen.h index 3f66bb1a99..b2202bd3a8 100644 --- a/UI/ControlMappingScreen.h +++ b/UI/ControlMappingScreen.h @@ -138,47 +138,6 @@ private: JoystickHistoryView *stickView_[2]{}; }; -class TouchTestScreen : public UIDialogScreenWithGameBackground { -public: - TouchTestScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) { - for (int i = 0; i < MAX_TOUCH_POINTS; i++) { - touches_[i].id = -1; - } - } - - void touch(const TouchInput &touch) override; - void DrawForeground(UIContext &dc) override; - - bool key(const KeyInput &key) override; - void axis(const AxisInput &axis) override; - - const char *tag() const override { return "TouchTest"; } - -protected: - struct TrackedTouch { - int id; - float x; - float y; - }; - enum { - MAX_TOUCH_POINTS = 10, - }; - TrackedTouch touches_[MAX_TOUCH_POINTS]{}; - - std::vector keyEventLog_; - - UI::TextView *lastKeyEvents_ = nullptr; - - double lastFrameTime_ = 0.0; - - void CreateViews() override; - void UpdateLogView(); - - UI::EventReturn OnImmersiveModeChange(UI::EventParams &e); - UI::EventReturn OnRenderingBackend(UI::EventParams &e); - UI::EventReturn OnRecreateActivity(UI::EventParams &e); -}; - class MockPSP; class VisualMappingScreen : public UIDialogScreenWithGameBackground { diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index ac7e896036..1bc7a66ce3 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -1452,3 +1452,215 @@ void FrameDumpTestScreen::update() { RecreateViews(); } } + +void TouchTestScreen::touch(const TouchInput &touch) { + UIDialogScreenWithGameBackground::touch(touch); + if (touch.flags & TOUCH_DOWN) { + bool found = false; + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + if (touches_[i].id == touch.id) { + WARN_LOG(SYSTEM, "Double touch"); + touches_[i].x = touch.x; + touches_[i].y = touch.y; + found = true; + } + } + if (!found) { + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + if (touches_[i].id == -1) { + touches_[i].id = touch.id; + touches_[i].x = touch.x; + touches_[i].y = touch.y; + break; + } + } + } + } + if (touch.flags & TOUCH_MOVE) { + bool found = false; + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + if (touches_[i].id == touch.id) { + touches_[i].x = touch.x; + touches_[i].y = touch.y; + found = true; + } + } + if (!found) { + WARN_LOG(SYSTEM, "Move without touch down: %d", touch.id); + } + } + if (touch.flags & TOUCH_UP) { + bool found = false; + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + if (touches_[i].id == touch.id) { + found = true; + touches_[i].id = -1; + break; + } + } + if (!found) { + WARN_LOG(SYSTEM, "Touch release without touch down"); + } + } +} + +// TODO: Move this screen out into its own file. +void TouchTestScreen::CreateViews() { + using namespace UI; + + auto di = GetI18NCategory(I18NCat::DIALOG); + auto gr = GetI18NCategory(I18NCat::GRAPHICS); + root_ = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *theTwo = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); + + lastKeyEvents_ = theTwo->Add(new TextView("-", new LayoutParams(FILL_PARENT, WRAP_CONTENT))); + + root_->Add(theTwo); + +#if !PPSSPP_PLATFORM(UWP) + static const char *renderingBackend[] = { "OpenGL", "Direct3D 9", "Direct3D 11", "Vulkan" }; + PopupMultiChoice *renderingBackendChoice = root_->Add(new PopupMultiChoice(&g_Config.iGPUBackend, gr->T("Backend"), renderingBackend, (int)GPUBackend::OPENGL, ARRAY_SIZE(renderingBackend), I18NCat::GRAPHICS, screenManager())); + renderingBackendChoice->OnChoice.Handle(this, &TouchTestScreen::OnRenderingBackend); + + if (!g_Config.IsBackendEnabled(GPUBackend::OPENGL)) + renderingBackendChoice->HideChoice((int)GPUBackend::OPENGL); + if (!g_Config.IsBackendEnabled(GPUBackend::DIRECT3D9)) + renderingBackendChoice->HideChoice((int)GPUBackend::DIRECT3D9); + if (!g_Config.IsBackendEnabled(GPUBackend::DIRECT3D11)) + renderingBackendChoice->HideChoice((int)GPUBackend::DIRECT3D11); + if (!g_Config.IsBackendEnabled(GPUBackend::VULKAN)) + renderingBackendChoice->HideChoice((int)GPUBackend::VULKAN); +#endif + +#if PPSSPP_PLATFORM(ANDROID) + root_->Add(new Choice(gr->T("Recreate Activity")))->OnClick.Handle(this, &TouchTestScreen::OnRecreateActivity); +#endif + root_->Add(new CheckBox(&g_Config.bImmersiveMode, gr->T("FullScreen", "Full Screen")))->OnClick.Handle(this, &TouchTestScreen::OnImmersiveModeChange); + root_->Add(new Button(di->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); +} + +void TouchTestScreen::UpdateLogView() { + while (keyEventLog_.size() > 8) { + keyEventLog_.erase(keyEventLog_.begin()); + } + + std::string text; + for (auto &iter : keyEventLog_) { + text += iter + "\n"; + } + + if (lastKeyEvents_) { + lastKeyEvents_->SetText(text); + } +} + +bool TouchTestScreen::key(const KeyInput &key) { + UIScreen::key(key); + char buf[512]; + snprintf(buf, sizeof(buf), "%s (%d) Device ID: %d [%s%s%s%s]", KeyMap::GetKeyName(key.keyCode).c_str(), key.keyCode, key.deviceId, + (key.flags & KEY_IS_REPEAT) ? "REP" : "", + (key.flags & KEY_UP) ? "UP" : "", + (key.flags & KEY_DOWN) ? "DOWN" : "", + (key.flags & KEY_CHAR) ? "CHAR" : ""); + keyEventLog_.push_back(buf); + UpdateLogView(); + return true; +} + +void TouchTestScreen::axis(const AxisInput &axis) { + char buf[512]; + snprintf(buf, sizeof(buf), "Axis: %s (%d) (value %1.3f) Device ID: %d", + KeyMap::GetAxisName(axis.axisId).c_str(), axis.axisId, axis.value, axis.deviceId); + + keyEventLog_.push_back(buf); + if (keyEventLog_.size() > 8) { + keyEventLog_.erase(keyEventLog_.begin()); + } + UpdateLogView(); +} + +void TouchTestScreen::DrawForeground(UIContext &dc) { + Bounds bounds = dc.GetLayoutBounds(); + + double now = dc.FrameStartTime(); + double delta = now - lastFrameTime_; + lastFrameTime_ = now; + + dc.BeginNoTex(); + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + if (touches_[i].id != -1) { + dc.Draw()->Circle(touches_[i].x, touches_[i].y, 100.0, 3.0, 80, 0.0f, 0xFFFFFFFF, 1.0); + } + } + dc.Flush(); + + dc.Begin(); + + char buffer[4096]; + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + if (touches_[i].id != -1) { + dc.Draw()->Circle(touches_[i].x, touches_[i].y, 100.0, 3.0, 80, 0.0f, 0xFFFFFFFF, 1.0); + snprintf(buffer, sizeof(buffer), "%0.1fx%0.1f", touches_[i].x, touches_[i].y); + dc.DrawText(buffer, touches_[i].x, touches_[i].y + (touches_[i].y > g_display.dp_yres - 100.0f ? -135.0f : 95.0f), 0xFFFFFFFF, ALIGN_HCENTER | FLAG_DYNAMIC_ASCII); + } + } + + char extra_debug[2048]{}; + +#if PPSSPP_PLATFORM(ANDROID) + truncate_cpy(extra_debug, Android_GetInputDeviceDebugString().c_str()); +#endif + + snprintf(buffer, sizeof(buffer), +#if PPSSPP_PLATFORM(ANDROID) + "display_res: %dx%d\n" +#endif + "dp_res: %dx%d pixel_res: %dx%d\n" + "g_dpi: %0.3f g_dpi_scale: %0.3fx%0.3f\n" + "g_dpi_scale_real: %0.3fx%0.3f\n" + "delta: %0.2f ms fps: %0.3f\n%s", +#if PPSSPP_PLATFORM(ANDROID) + System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES), +#endif + g_display.dp_xres, g_display.dp_yres, g_display.pixel_xres, g_display.pixel_yres, + g_display.dpi, g_display.dpi_scale_x, g_display.dpi_scale_y, + g_display.dpi_scale_real_x, g_display.dpi_scale_real_y, + delta * 1000.0, 1.0 / delta, + extra_debug); + + // On Android, also add joystick debug data. + + dc.DrawTextShadow(buffer, bounds.centerX(), bounds.y + 20.0f, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII); + dc.Flush(); +} + +void RecreateActivity() { + const int SYSTEM_JELLYBEAN = 16; + if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= SYSTEM_JELLYBEAN) { + INFO_LOG(SYSTEM, "Sending recreate"); + System_Notify(SystemNotification::FORCE_RECREATE_ACTIVITY); + INFO_LOG(SYSTEM, "Got back from recreate"); + } else { + auto gr = GetI18NCategory(I18NCat::GRAPHICS); + System_Toast(gr->T("Must Restart", "You must restart PPSSPP for this change to take effect")); + } +} + +UI::EventReturn TouchTestScreen::OnImmersiveModeChange(UI::EventParams &e) { + System_Notify(SystemNotification::IMMERSIVE_MODE_CHANGE); + if (g_Config.iAndroidHwScale != 0) { + RecreateActivity(); + } + return UI::EVENT_DONE; +} + +UI::EventReturn TouchTestScreen::OnRenderingBackend(UI::EventParams &e) { + g_Config.Save("GameSettingsScreen::RenderingBackend"); + System_RestartApp("--touchscreentest"); + return UI::EVENT_DONE; +} + +UI::EventReturn TouchTestScreen::OnRecreateActivity(UI::EventParams &e) { + RecreateActivity(); + return UI::EVENT_DONE; +} diff --git a/UI/DevScreens.h b/UI/DevScreens.h index 3572061c9f..551cc71901 100644 --- a/UI/DevScreens.h +++ b/UI/DevScreens.h @@ -222,6 +222,47 @@ private: std::shared_ptr dumpDownload_; }; +class TouchTestScreen : public UIDialogScreenWithGameBackground { +public: + TouchTestScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) { + for (int i = 0; i < MAX_TOUCH_POINTS; i++) { + touches_[i].id = -1; + } + } + + void touch(const TouchInput &touch) override; + void DrawForeground(UIContext &dc) override; + + bool key(const KeyInput &key) override; + void axis(const AxisInput &axis) override; + + const char *tag() const override { return "TouchTest"; } + +protected: + struct TrackedTouch { + int id; + float x; + float y; + }; + enum { + MAX_TOUCH_POINTS = 10, + }; + TrackedTouch touches_[MAX_TOUCH_POINTS]{}; + + std::vector keyEventLog_; + + UI::TextView *lastKeyEvents_ = nullptr; + + double lastFrameTime_ = 0.0; + + void CreateViews() override; + void UpdateLogView(); + + UI::EventReturn OnImmersiveModeChange(UI::EventParams &e); + UI::EventReturn OnRenderingBackend(UI::EventParams &e); + UI::EventReturn OnRecreateActivity(UI::EventParams &e); +}; + void DrawProfile(UIContext &ui); const char *GetCompilerABI(); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 0e069c1c73..4994dfce22 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -114,6 +114,7 @@ #include "UI/AudioCommon.h" #include "UI/BackgroundAudio.h" #include "UI/ControlMappingScreen.h" +#include "UI/DevScreens.h" #include "UI/DiscordIntegration.h" #include "UI/EmuScreen.h" #include "UI/GameInfoCache.h"