[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/video sprite.c
From: |
Nehal Mistry |
Subject: |
[Stratagus-CVS] stratagus/src/video sprite.c |
Date: |
Thu, 27 Nov 2003 20:39:25 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Nehal Mistry <address@hidden> 03/11/27 20:39:25
Modified files:
src/video : sprite.c
Log message:
fix VideoDrawClipX
Patches:
Index: stratagus/src/video/sprite.c
diff -u stratagus/src/video/sprite.c:1.47 stratagus/src/video/sprite.c:1.48
--- stratagus/src/video/sprite.c:1.47 Thu Nov 27 05:40:29 2003
+++ stratagus/src/video/sprite.c Thu Nov 27 20:39:24 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sprite.c,v 1.47 2003/11/27 10:40:29 nehalmistry Exp $
+// $Id: sprite.c,v 1.48 2003/11/28 01:39:24 nehalmistry Exp $
//@{
@@ -111,6 +111,49 @@
SDL_BlitSurface(sprite->Surface, &srect, TheScreen, &drect);
}
+
+local void VideoDrawX(const Graphic* sprite, unsigned frame, int x, int y)
+{
+ SDL_Rect srect;
+ SDL_Rect drect;
+
+ DebugCheck(!sprite->SurfaceFlip);
+
+ srect.x = (sprite->SurfaceFlip->w - (frame % (sprite->SurfaceFlip->w /
+ sprite->Width)) * sprite->Width) - sprite->Width;
+ srect.y = (frame / (sprite->SurfaceFlip->w / sprite->Width)) *
sprite->Height;
+ srect.w = sprite->Width;
+ srect.h = sprite->Height;
+
+ drect.x = x;
+ drect.y = y;
+
+ SDL_BlitSurface(sprite->SurfaceFlip, &srect, TheScreen, &drect);
+}
+
+local void VideoDrawClipX(const Graphic* sprite, unsigned frame, int x, int y)
+{
+ SDL_Rect srect;
+ SDL_Rect drect;
+ int oldx;
+ int oldy;
+
+ srect.x = (frame % (sprite->Surface->w / sprite->Width)) * sprite->Width;
+ srect.y = (frame / (sprite->Surface->w / sprite->Width)) * sprite->Height;
+ srect.w = sprite->Width;
+ srect.h = sprite->Height;
+
+ oldx = x;
+ oldy = y;
+ CLIP_RECTANGLE(x, y, srect.w, srect.h);
+ srect.x += x - oldx;
+ srect.y += y - oldy;
+
+ drect.x = x;
+ drect.y = y;
+
+ SDL_BlitSurface(sprite->SurfaceFlip, &srect, TheScreen, &drect);
+}
#else
//
// The current implementation uses RLE encoded sprites.
@@ -267,32 +310,7 @@
}
#endif
-#ifdef USE_SDL_SURFACE
-local void VideoDrawX(const Graphic* sprite, unsigned frame, int x, int y)
-{
- SDL_Rect srect;
- SDL_Rect drect;
-
- DebugCheck(!sprite->SurfaceFlip);
-
- srect.x = (sprite->SurfaceFlip->w - (frame % (sprite->SurfaceFlip->w /
- sprite->Width)) * sprite->Width) - sprite->Width;
- srect.y = (frame / (sprite->SurfaceFlip->w / sprite->Width)) *
sprite->Height;
- srect.w = sprite->Width;
- srect.h = sprite->Height;
-
- drect.x = x;
- drect.y = y;
-
- SDL_BlitSurface(sprite->SurfaceFlip, &srect, TheScreen, &drect);
-}
-
-local void VideoDrawClipX(const Graphic* sprite, unsigned frame, int x, int y)
-{
- // FIXME?
- VideoDrawX(sprite, frame, x, y);
-}
-#else
+#ifndef USE_SDL_SURFACE
/**
** Draw 8bit graphic object unclipped and flipped in X direction
** into 8 bit framebuffer.
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/17
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/22
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/22
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/27
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/27
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/27
- [Stratagus-CVS] stratagus/src/video sprite.c,
Nehal Mistry <=
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/27
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/29
- [Stratagus-CVS] stratagus/src/video sprite.c, Nehal Mistry, 2003/11/30