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:
parent
10f830809b
commit
706f1aaa0a
4 changed files with 6 additions and 5 deletions
|
@ -61,7 +61,7 @@ namespace cloonel {
|
||||||
///--------------------------------------------------------------------------
|
///--------------------------------------------------------------------------
|
||||||
///--------------------------------------------------------------------------
|
///--------------------------------------------------------------------------
|
||||||
void Platform::Draw() const {
|
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)
|
#if defined(WITH_DEBUG_VISUALS)
|
||||||
m_collisionTopDrawable.Render(m_collisionTop->From(), m_screenRatio.Ratio());
|
m_collisionTopDrawable.Render(m_collisionTop->From(), m_screenRatio.Ratio());
|
||||||
m_collisionTopDrawable.Render(TopLeft(), m_screenRatio.Ratio());
|
m_collisionTopDrawable.Render(TopLeft(), m_screenRatio.Ratio());
|
||||||
|
|
|
@ -47,8 +47,8 @@ namespace cloonel {
|
||||||
virtual ~Platform ( void ) noexcept;
|
virtual ~Platform ( void ) noexcept;
|
||||||
Platform& operator= ( const Platform& parOther );
|
Platform& operator= ( const Platform& parOther );
|
||||||
|
|
||||||
float2 TopLeft ( void ) const { return GetPos(); }
|
float2 BottomLeft ( void ) const { return GetPos(); }
|
||||||
float2 BottomRight ( void ) const { return TopLeft() + m_size; }
|
float2 TopLeft ( void ) const { return GetPos() + float2(0.0f, m_size.y()); }
|
||||||
const HorzCollisionBar* TopCollisionBar ( void ) const { return m_collisionTop.get(); }
|
const HorzCollisionBar* TopCollisionBar ( void ) const { return m_collisionTop.get(); }
|
||||||
void CopyDrawables ( std::vector<const Drawable*>& parOut ) const;
|
void CopyDrawables ( std::vector<const Drawable*>& parOut ) const;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace cloonel {
|
||||||
///----------------------------------------------------------------------
|
///----------------------------------------------------------------------
|
||||||
boost::circular_buffer<Platform>::const_iterator FindFirstVisible (const boost::circular_buffer<Platform>& parPlatforms) {
|
boost::circular_buffer<Platform>::const_iterator FindFirstVisible (const boost::circular_buffer<Platform>& parPlatforms) {
|
||||||
auto curr = parPlatforms.begin();
|
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;
|
++curr;
|
||||||
}
|
}
|
||||||
return curr;
|
return curr;
|
||||||
|
|
|
@ -388,7 +388,8 @@ namespace cloonel {
|
||||||
}
|
}
|
||||||
#endif
|
#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);
|
SDL_Rect sdldst(dest);
|
||||||
sdldst.y = m_sdlmain->WidthHeight().y() - sdldst.y - sdldst.h;
|
sdldst.y = m_sdlmain->WidthHeight().y() - sdldst.y - sdldst.h;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue