From 7985ba2bc4e0b932575b8920bcb06f86e3e30ee9 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Mon, 31 Oct 2016 20:10:33 +0100 Subject: [PATCH] Add old code that is presumably made to display debug collision lines. --- src/platform.cpp | 1 + src/tiledwallpaper.cpp | 22 ++++++++++++++++++++++ src/tiledwallpaper.hpp | 12 ++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/platform.cpp b/src/platform.cpp index 51ece8a..7f69fc9 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -64,6 +64,7 @@ namespace cloonel { m_surface->Render(TopLeft(), m_size, m_screenRatio.Ratio(), true); #if defined(WITH_DEBUG_VISUALS) m_collisionTopDrawable.Render(m_collisionTop->From(), m_screenRatio.Ratio()); + m_collisionTopDrawable.Render(TopLeft(), m_screenRatio.Ratio()); #endif } diff --git a/src/tiledwallpaper.cpp b/src/tiledwallpaper.cpp index 8d73eef..5cf693d 100644 --- a/src/tiledwallpaper.cpp +++ b/src/tiledwallpaper.cpp @@ -23,6 +23,7 @@ #include "sizeratio.hpp" #include "compatibility.h" #include +#include namespace cloonel { namespace { @@ -42,6 +43,13 @@ namespace cloonel { Drawable(128.0f, 128.0f), m_tileCount(parMain, ushort2(128)), m_tile(new Texture(parPath, parMain, false)) +#if defined(WITH_DEBUG_VISUALS) + , m_midscreen(parMain, + Colour(80, 250, 6), + short2(0), + short2(1) + ) +#endif { } @@ -79,6 +87,12 @@ namespace cloonel { } dest.y() += sz.y(); } + +#if defined(WITH_DEBUG_VISUALS) + //std::cout << "drawing line at " << WidthHeight() * float2(1.0f, 0.5f); + //std::cout << " to " << m_tileCount.screenRes() << "\n"; + m_midscreen.Render(WidthHeight() * float2(1.0f, 0.5f), m_tileCount.screenRes()); +#endif } ///-------------------------------------------------------------------------- @@ -87,6 +101,9 @@ namespace cloonel { BaseClass(parMain), m_tileCount(CountTilesInScreen(parMain->WidthHeight(), parTileSize)), m_tileSize(static_cast(parTileSize)) +#if defined(WITH_DEBUG_VISUALS) + , m_screenRes(1.0f) +#endif { assert(parMain); assert(ushort2(0) != parTileSize); @@ -95,10 +112,15 @@ namespace cloonel { ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- void TiledWallpaper::TileCountNotifiable::NotifyResChanged (const SizeRatio& parSize) { + std::cout << "Autoregistering" << std::endl; BaseClass::NotifyResChanged(parSize); m_tileCount = CountTilesInScreen(static_cast(parSize.Resolution()), static_cast(m_tileSize)); +#if defined(WITH_DEBUG_VISUALS) + m_screenRes = parSize.Resolution(); +#endif #if !defined(NDEBUG) { + m_screenRes = parSize.Resolution(); const ushort2 tileSize(static_cast(m_tileSize)); const ushort2 screenRes(static_cast(parSize.Resolution())); const ushort2 tileCount(static_cast(m_tileCount)); diff --git a/src/tiledwallpaper.hpp b/src/tiledwallpaper.hpp index be2b9e5..50a6dac 100644 --- a/src/tiledwallpaper.hpp +++ b/src/tiledwallpaper.hpp @@ -23,6 +23,9 @@ #include "drawable.hpp" #include "sizenotifiable.hpp" #include "drawableset.hpp" +#if defined(WITH_DEBUG_VISUALS) +# include "drawableline.hpp" +#endif #include #include @@ -52,14 +55,23 @@ namespace cloonel { virtual void NotifyResChanged ( const SizeRatio& parSize ); const float2& tileCount ( void ) const noexcept { return m_tileCount; } const float2& tileSize ( void ) const noexcept { return m_tileSize; } +#if defined(WITH_DEBUG_VISUALS) + const float2& screenRes ( void ) const { return m_screenRes; } +#endif private: float2 m_tileCount; const float2 m_tileSize; +#if defined(WITH_DEBUG_VISUALS) + float2 m_screenRes; +#endif }; TileCountNotifiable m_tileCount; const std::unique_ptr m_tile; +#if defined(WITH_DEBUG_VISUALS) + DrawableLine m_midscreen; +#endif }; } //namespace cloonel