ZE_SDL fix

This commit is contained in:
James Turk 2003-09-01 06:01:06 +00:00
parent 1cce44c276
commit cf38597557
2 changed files with 14 additions and 6 deletions

View File

@ -13,7 +13,7 @@
\brief Source file for ZImage. \brief Source file for ZImage.
Implementation of ZImage, the Image class for ZEngine. Implementation of ZImage, the Image class for ZEngine.
<br>$Id: ZE_ZImage.cpp,v 1.43 2003/09/01 03:30:39 cozman Exp $<br> <br>$Id: ZE_ZImage.cpp,v 1.44 2003/09/01 06:01:34 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -407,10 +407,16 @@ void ZImage::Draw(int x, int y) const
void ZImage::DrawClipped(int x, int y, ZRect clipRect) const void ZImage::DrawClipped(int x, int y, ZRect clipRect) const
{ {
SDL_Rect rect; ZRect img(static_cast<Sint16>(x),static_cast<Sint16>(y),static_cast<Sint16>(rImage->w),static_cast<Sint16>(rImage->h));
rect.x = static_cast<Sint16>(x); SDL_Rect inRect,imgRect;
rect.y = static_cast<Sint16>(y);
SDL_BlitSurface(rImage, &clipRect.SDLrect(), rEngine->Display(), &rect);
imgRect = inRect = clipRect.Intersection(img).SDLrect();
inRect.x -= x;
inRect.y -= y;
SDL_BlitSurface(rImage, &inRect, rEngine->Display(), &imgRect);
//SDL_FillRect(rEngine->Display(), &inRect, SDL_MapRGB(rEngine->Display()->format,0,255,0));
} }
bool ZImage::IsLoaded() const bool ZImage::IsLoaded() const

View File

@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions.
and the home of this Library is http://www.zengine.sourceforge.net and the home of this Library is http://www.zengine.sourceforge.net
*******************************************************************************/ *******************************************************************************/
/*$Id: ZImageTest.cpp,v 1.21 2003/09/01 03:30:39 cozman Exp $*/ /*$Id: ZImageTest.cpp,v 1.22 2003/09/01 06:01:06 cozman Exp $*/
#include <ZEngine.h> #include <ZEngine.h>
#include <string> #include <string>
@ -59,7 +59,9 @@ void Test()
temp = NULL; //and temp will now be controlled and freed by image1 temp = NULL; //and temp will now be controlled and freed by image1
image1.SetColorKey(255,0,255); image1.SetColorKey(255,0,255);
image2.SetColorKey(255,0,255); image2.SetColorKey(255,0,255);
#if (GFX_BACKEND == ZE_OGL)
image4.Resize(400,300); image4.Resize(400,300);
#endif
font.DrawShadedText("ZImage Test.",textImage); font.DrawShadedText("ZImage Test.",textImage);
do do