summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2010-12-22 21:22:50 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2010-12-22 21:22:50 +0000
commit5256caadef6c3c29d4a2fd29618b987a7e2a9744 (patch)
tree816cb68b17ae2e71975bceb933518f44dbf392da /src
parentda826d3bf832bf9440db1705d5aa4bdc64e96481 (diff)
download2010-netlemmings-5256caadef6c3c29d4a2fd29618b987a7e2a9744.tar.gz
2010-netlemmings-5256caadef6c3c29d4a2fd29618b987a7e2a9744.tar.bz2
2010-netlemmings-5256caadef6c3c29d4a2fd29618b987a7e2a9744.zip
Debug des dirty rectangles in progress. 3 bugs corrigés, il en reste d'autres. Snif. Je me couche.
git-svn-id: file:///var/svn/2010-netlemmings/trunk@210 077b3477-7977-48bd-8428-443f22f7bfda
Diffstat (limited to 'src')
-rw-r--r--src/graphic.c11
-rw-r--r--src/include/graphic.h1
-rw-r--r--src/netlem.c6
3 files changed, 16 insertions, 2 deletions
diff --git a/src/graphic.c b/src/graphic.c
index 802fd5d..a444819 100644
--- a/src/graphic.c
+++ b/src/graphic.c
@@ -265,3 +265,14 @@ int paintObject(struct gameObjectState *obj, SDL_Rect *srcRect, SDL_Surface *dst
return 0;
}
+int refresh(SDL_Surface *tmpSurf, SDL_Rect *srcRect, SDL_Surface *screen, SDL_Rect dstRect) {
+ int res;
+
+ res=SDL_BlitSurface(tmpSurf, srcRect, screen, &dstRect);
+ if ( res!=0 ) {
+ logs2(LOG_DEBUG, "refresh(), SDL_BlitSurface()", SDL_GetError());
+ }
+
+ SDL_UpdateRect(screen, dstRect.x, dstRect.y, dstRect.w, dstRect.h);
+ return res;
+}
diff --git a/src/include/graphic.h b/src/include/graphic.h
index 7160b43..7d7761e 100644
--- a/src/include/graphic.h
+++ b/src/include/graphic.h
@@ -25,4 +25,5 @@ int repaint(gameObjectsState_t *objStates, gameGraphSurfaces_t *srcSurfs, SDL_Re
int findAndZSortObjects(gameObjectsState_t *objectsStat, SDL_Rect *offsetRect, gameObjectsState_t *objectsFound);
int paintObject(struct gameObjectState *obj, SDL_Rect *srcRect, SDL_Surface *dstSurf, SDL_Rect *dstRect);
+int refresh(SDL_Surface *tmpSurf, SDL_Rect *srcRect, SDL_Surface *screen, SDL_Rect dstRect);
#endif /*GRAPHIC_H*/
diff --git a/src/netlem.c b/src/netlem.c
index 8b6b3da..a6d6c38 100644
--- a/src/netlem.c
+++ b/src/netlem.c
@@ -514,12 +514,13 @@ int updateGraphics(gameObjectsState_t *objStates, localParams_t *params, gameGra
case eMultiGame:
// If we had a camera movement, we have to refesh all the screen
tmpSurf=gGraph->surfaces.tmpSurf;
+ SDL_FillRect(tmpSurf, &(tmpSurf->clip_rect), 0xcccccccc);
if ( lastViewport.x != gGraph->viewport.x ) {
lastViewport.x=gGraph->viewport.x;
dstRect.x=0;
dstRect.y=0;
- dstRect.w=0;
- dstRect.h=0;
+ // dstRect.w=0;
+ // dstRect.h=0;
srcRect.x=lastViewport.x;
srcRect.y=lastViewport.y;
srcRect.w=gGraph->screen->clip_rect.w;
@@ -528,6 +529,7 @@ int updateGraphics(gameObjectsState_t *objStates, localParams_t *params, gameGra
if ( res != 0 ) {
logs(LOG_WARN, "updateGraphics(), repaint() failed");
}
+ refresh(tmpSurf, &srcRect, gGraph->screen, dstRect);
} else {
// We use a dirty rectangle method for performance
for(i=0; i<objStates->objCount; i++) {