diff options
Diffstat (limited to 'src/graphic.c')
-rw-r--r-- | src/graphic.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/graphic.c b/src/graphic.c index b01714e..39bf44e 100644 --- a/src/graphic.c +++ b/src/graphic.c @@ -273,21 +273,23 @@ int renderTerrainToTextures(SDL_Renderer *rend, SDL_Surface *terrain, gameUI_t * int renderSprites(SDL_Renderer *rend, gameUI_t *gUI) { int i, res; SDL_Rect src,dst; - - renderItem_t *renderList = gUI->renderList; + renderItem_t *it; for(i=0,res=0 ; i < MAX_RENDERLIST_SIZE && res==0 ; i++) { - if (renderList[i].sprite == NULL) continue; + it = &gUI->renderList[i]; + if (it->sprite == NULL) continue; - src = dst = renderList[i].sprite->size; - src.y = src.h * renderList[i].currframe; - if ( renderList[i].absolute ) { - dst.x = renderList[i].x; + src = dst = it->sprite->size; + src.y = src.h * it->currframe; + if ( it->absolute ) { + dst.x = it->x; } else { - dst.x = renderList[i].x - gUI->cameraX; + dst.x = it->x - gUI->cameraX; } - dst.y = renderList[i].y; - res=SDL_RenderCopy(rend, renderList[i].sprite->t, &src, &dst); + dst.y = it->y; + + it->lastDstRect = dst; + res=SDL_RenderCopy(rend, it->sprite->t, &src, &dst); } return res; } |