Fix drawing of vertically clipped surfaces.

Also fix bottom platforms disappearing and wrong coordinates being
sent to the function that draws debug lines. Obviously debug lines
drawing is still messed up... but at least you see the two lines!
This commit is contained in:
King_DuckZ 2016-11-17 01:17:20 +01:00
parent 10f830809b
commit 706f1aaa0a
4 changed files with 6 additions and 5 deletions

View file

@ -61,7 +61,7 @@ namespace cloonel {
///--------------------------------------------------------------------------
///--------------------------------------------------------------------------
void Platform::Draw() const {
m_surface->Render(TopLeft(), m_size, m_screenRatio.Ratio(), true);
m_surface->Render(BottomLeft(), 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());

View file

@ -47,8 +47,8 @@ namespace cloonel {
virtual ~Platform ( void ) noexcept;
Platform& operator= ( const Platform& parOther );
float2 TopLeft ( void ) const { return GetPos(); }
float2 BottomRight ( void ) const { return TopLeft() + m_size; }
float2 BottomLeft ( void ) const { return GetPos(); }
float2 TopLeft ( void ) const { return GetPos() + float2(0.0f, m_size.y()); }
const HorzCollisionBar* TopCollisionBar ( void ) const { return m_collisionTop.get(); }
void CopyDrawables ( std::vector<const Drawable*>& parOut ) const;

View file

@ -35,7 +35,7 @@ namespace cloonel {
///----------------------------------------------------------------------
boost::circular_buffer<Platform>::const_iterator FindFirstVisible (const boost::circular_buffer<Platform>& parPlatforms) {
auto curr = parPlatforms.begin();
while (curr != parPlatforms.end() and curr->TopLeft().y() < 0.0f) {
while (curr != parPlatforms.end() and curr->TopLeft().y() <= 0.0f) {
++curr;
}
return curr;

View file

@ -388,7 +388,8 @@ namespace cloonel {
}
#endif
const SDL_Rect sdlsrc(src);
SDL_Rect sdlsrc(src);
sdlsrc.y = static_cast<decltype(sdlsrc.y)>(m_size.y()) - sdlsrc.y - sdlsrc.h;
SDL_Rect sdldst(dest);
sdldst.y = m_sdlmain->WidthHeight().y() - sdldst.y - sdldst.h;