Add old code that is presumably made to display debug collision lines.

This commit is contained in:
King_DuckZ 2016-10-31 20:10:33 +01:00
parent a7bd060452
commit 7985ba2bc4
3 changed files with 35 additions and 0 deletions

View file

@ -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
}

View file

@ -23,6 +23,7 @@
#include "sizeratio.hpp"
#include "compatibility.h"
#include <cassert>
#include <iostream>
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<float2>(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<ushort2>(parSize.Resolution()), static_cast<ushort2>(m_tileSize));
#if defined(WITH_DEBUG_VISUALS)
m_screenRes = parSize.Resolution();
#endif
#if !defined(NDEBUG)
{
m_screenRes = parSize.Resolution();
const ushort2 tileSize(static_cast<ushort2>(m_tileSize));
const ushort2 screenRes(static_cast<ushort2>(parSize.Resolution()));
const ushort2 tileCount(static_cast<ushort2>(m_tileCount));

View file

@ -23,6 +23,9 @@
#include "drawable.hpp"
#include "sizenotifiable.hpp"
#include "drawableset.hpp"
#if defined(WITH_DEBUG_VISUALS)
# include "drawableline.hpp"
#endif
#include <memory>
#include <vector>
@ -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<Texture> m_tile;
#if defined(WITH_DEBUG_VISUALS)
DrawableLine m_midscreen;
#endif
};
} //namespace cloonel