diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index a18f002f3..37bb88fdf 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -13,6 +13,7 @@ std::vector settings_dont_save { { "Debug" }, { "DebugGrid" }, { "DebugText" }, + { "DebugImage" }, { "ForceKid" }, { "ForceKiosk" }, { "IgnoreGamelist" }, diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index bc4267e8b..47a8cd622 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -168,6 +168,11 @@ void Window::input(InputConfig* config, Input input) // toggle TextComponent debug view with Ctrl-T Settings::getInstance()->setBool("DebugText", !Settings::getInstance()->getBool("DebugText")); } + else if(config->getDeviceId() == DEVICE_KEYBOARD && input.value && input.id == SDLK_i && SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug")) + { + // toggle TextComponent debug view with Ctrl-I + Settings::getInstance()->setBool("DebugImage", !Settings::getInstance()->getBool("DebugImage")); + } else { if (peekGui()) diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index f51581547..aefa065ad 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -3,6 +3,7 @@ #include "resources/TextureResource.h" #include "Log.h" #include "Renderer.h" +#include "Settings.h" #include "ThemeData.h" Vector2i ImageComponent::getTextureSize() const @@ -229,6 +230,11 @@ void ImageComponent::render(const Transform4x4f& parentTrans) if(mTexture && mOpacity > 0) { + if(Settings::getInstance()->getBool("DebugImage")) { + Vector2f targetSizePos = (mTargetSize - mSize) * mOrigin * -1; + Renderer::drawRect(targetSizePos.x(), targetSizePos.y(), mTargetSize.x(), mTargetSize.y(), 0xFF000033); + Renderer::drawRect(0.0f, 0.0f, mSize.x(), mSize.y(), 0x00000033); + } if(mTexture->isInitialized()) { // actually draw the image