Cast vectors explicitly using vector_cast.
This commit is contained in:
parent
650f8d6de1
commit
68d179975e
11 changed files with 41 additions and 39 deletions
|
@ -33,7 +33,7 @@ namespace cloonel {
|
|||
///----------------------------------------------------------------------
|
||||
float2 CountTilesInScreen (const ushort2& parScreenSize, const ushort2& parTileSize) {
|
||||
assert(ushort2(0) != parTileSize);
|
||||
return static_cast<float2>((parTileSize - 1 + parScreenSize) / parTileSize);
|
||||
return vector_cast<float2>((parTileSize - 1 + parScreenSize) / parTileSize);
|
||||
}
|
||||
} //unnamed namespace
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace cloonel {
|
|||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void TiledWallpaper::Draw() const {
|
||||
const ushort2 grid(static_cast<ushort2>(m_tileCount.tileCount()));
|
||||
const ushort2 grid(vector_cast<ushort2>(m_tileCount.tileCount()));
|
||||
const float2& sz = m_tileCount.tileSize();
|
||||
|
||||
//TODO: add code to tell the renderer if the current tile will need clipping or not
|
||||
|
@ -100,7 +100,7 @@ namespace cloonel {
|
|||
TiledWallpaper::TileCountNotifiable::TileCountNotifiable (SDLMain* parMain, const ushort2& parTileSize) :
|
||||
BaseClass(parMain),
|
||||
m_tileCount(CountTilesInScreen(parMain->WidthHeight(), parTileSize)),
|
||||
m_tileSize(static_cast<float2>(parTileSize))
|
||||
m_tileSize(vector_cast<float2>(parTileSize))
|
||||
#if defined(WITH_DEBUG_VISUALS)
|
||||
, m_screenRes(1.0f)
|
||||
#endif
|
||||
|
@ -114,16 +114,16 @@ 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));
|
||||
m_tileCount = CountTilesInScreen(vector_cast<ushort2>(parSize.Resolution()), vector_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));
|
||||
const ushort2 tileSize(vector_cast<ushort2>(m_tileSize));
|
||||
const ushort2 screenRes(vector_cast<ushort2>(parSize.Resolution()));
|
||||
const ushort2 tileCount(vector_cast<ushort2>(m_tileCount));
|
||||
assert(tileCount * tileSize < screenRes + tileSize);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue