diff options
Diffstat (limited to 'src/graphic.c')
-rw-r--r-- | src/graphic.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/graphic.c b/src/graphic.c index b596be8..05a12cd 100644 --- a/src/graphic.c +++ b/src/graphic.c @@ -70,8 +70,23 @@ SDL_Surface * loadGif(char *filePath) { return IMG_Load(filePath); } +int pxAreaColor (SDL_Surface* s, Uint32 p , int x , int y , int mX , int mY ){ + int i,j; + + // FIXME : make some test to prevent out of bound pixel + + for (i=x;i<x+mX;++i){ + for (j=y;j<y+mY;++j){ + putPixel(s, i , j , p); + } + } + + return 0; +} + int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameGraphics_t *gGraph) { int res, i, modifier; + int l,k; int x,y,xmin,xmax,ymin,ymax,y2,xdst,ydst; Uint32 dstPixel, dstStencil; SDL_Surface *tile; @@ -162,15 +177,21 @@ int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameGraphics_t *gGraph) { dstStencil=ccc_terrain; } + pxAreaColor (gGraph->surfaces.terrain,dstPixel,xdst,ydst,2,2); + pxAreaColor (gGraph->surfaces.stencil,dstStencil,xdst,ydst,2,2); + /* //FIXME : optimiser le nombre d'appels ici ! putPixel(gGraph->surfaces.terrain, xdst, ydst, dstPixel); putPixel(gGraph->surfaces.terrain, xdst+1, ydst, dstPixel); putPixel(gGraph->surfaces.terrain, xdst, ydst+1, dstPixel); putPixel(gGraph->surfaces.terrain, xdst+1, ydst+1, dstPixel); + putPixel(gGraph->surfaces.stencil, xdst, ydst, dstStencil); putPixel(gGraph->surfaces.stencil, xdst+1, ydst, dstStencil); putPixel(gGraph->surfaces.stencil, xdst, ydst+1, dstStencil); putPixel(gGraph->surfaces.stencil, xdst+1, ydst+1, dstStencil); + */ + } } } |