diff options
author | Ludovic Pouzenc <lpouzenc@gmail.com> | 2013-07-18 20:55:55 +0200 |
---|---|---|
committer | Ludovic Pouzenc <lpouzenc@gmail.com> | 2013-07-18 20:55:55 +0200 |
commit | 2e8fce8250fdfc6c6d644c9354d4a3318975bae8 (patch) | |
tree | 058b876910dfb3353cab52f425f837205ee7843b /src/graphic.c | |
parent | f02db00ad4f41b4d098557a63461f6c5766c3273 (diff) | |
download | mplemmings-2e8fce8250fdfc6c6d644c9354d4a3318975bae8.tar.gz mplemmings-2e8fce8250fdfc6c6d644c9354d4a3318975bae8.tar.bz2 mplemmings-2e8fce8250fdfc6c6d644c9354d4a3318975bae8.zip |
Fin du codage de testrender.c. Diverses mises au point autour de ca.
Bug connu : la police de grande taille ne se charge pas bien. Texture trop longue ?
Diffstat (limited to 'src/graphic.c')
-rw-r--r-- | src/graphic.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/graphic.c b/src/graphic.c index b1844a3..f55f461 100644 --- a/src/graphic.c +++ b/src/graphic.c @@ -25,7 +25,7 @@ void my_SDL_init_or_die(char title[], SDL_Rect win_pos, Uint32 init_flags, Uint3 SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION,SDL_LOG_PRIORITY_INFO, - "SDL_GetWindowPixelFormat() returns %i", SDL_GetWindowPixelFormat(*win) + "SDL_GetWindowPixelFormat() returns 0x%x", SDL_GetWindowPixelFormat(*win) ); *rend=SDL_CreateRenderer(*win,-1, rend_flags); @@ -36,6 +36,8 @@ void my_SDL_init_or_die(char title[], SDL_Rect win_pos, Uint32 init_flags, Uint3 "SDL_CreateRenderer(...,SDL_RENDERER_ACCELERATED) failed" ); + SDL_SetRenderDrawColor(*rend, 0xA0, 0xA0, 0xA0, 0xFF); + res=SDL_GetRendererInfo(*rend, rend_info); MPL_CHECK( res==0, @@ -49,7 +51,7 @@ void my_SDL_init_or_die(char title[], SDL_Rect win_pos, Uint32 init_flags, Uint3 tf=rend_info->texture_formats[i]; SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION,SDL_LOG_PRIORITY_INFO, - "rend_info->texture_formats[%i] == %i", i, tf + "rend_info->texture_formats[%i] == 0x%x", i, tf ); } @@ -82,7 +84,7 @@ void my_SDL_init_or_die(char title[], SDL_Rect win_pos, Uint32 init_flags, Uint3 //FIXME : to be implmented #if 0 -int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameGraphics_t *gGraph) { +int paint_terrain(gameIni_t *gIni, gameRess_t *gRess, gameGraphics_t *gGraph) { int res, i, modifier; int x,y,xmin,xmax,ymin,ymax,y2,xdst,ydst; Uint32 dstPixel, dstStencil; @@ -187,3 +189,17 @@ int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameGraphics_t *gGraph) { return 0; } #endif + +void render_all(SDL_Renderer *rend, render_item_t render_list[], int list_size) { + int i, res; + SDL_Rect src,dst; + + for(i=0,res=0;i<list_size && res==0;i++) { + src = dst = render_list[i].sprite->size; + src.y = src.h * render_list[i].currframe; + dst.x = render_list[i].x; + dst.y = render_list[i].y; + /*res=*/ (void) SDL_RenderCopy(rend, render_list[i].sprite->t, &src, &dst); + } +} + |