diff options
author | Damien Appert <dappert> | 2010-12-11 14:30:17 +0000 |
---|---|---|
committer | Damien Appert <dappert> | 2010-12-11 14:30:17 +0000 |
commit | 57ed3585ebf8393230bf633cf2f249fa9b91a1bf (patch) | |
tree | e33b1d4ab9d8b8d3df34d5aaba61251643574dfa /src | |
parent | 1eac9d1f82dc92722ecaeb9fbe9cbbfa7726651c (diff) | |
download | 2010-netlemmings-57ed3585ebf8393230bf633cf2f249fa9b91a1bf.tar.gz 2010-netlemmings-57ed3585ebf8393230bf633cf2f249fa9b91a1bf.tar.bz2 2010-netlemmings-57ed3585ebf8393230bf633cf2f249fa9b91a1bf.zip |
bon j'ai regardé le code :p
git-svn-id: file:///var/svn/2010-netlemmings/trunk@190 077b3477-7977-48bd-8428-443f22f7bfda
Diffstat (limited to 'src')
-rw-r--r-- | src/graphic.c | 21 | ||||
-rw-r--r-- | src/include/graphic.h | 1 | ||||
-rw-r--r-- | src/loader.c | 1 |
3 files changed, 23 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); + */ + } } } diff --git a/src/include/graphic.h b/src/include/graphic.h index 32046aa..a4756ea 100644 --- a/src/include/graphic.h +++ b/src/include/graphic.h @@ -16,6 +16,7 @@ int isTransparent(SDL_Surface *s, int x, int y); void putPixel(SDL_Surface *s, int x, int y, Uint32 p); SDL_Surface * createSurface(int width, int height); SDL_Surface * loadGif(char *filePath); +int pxAreaColor (SDL_Surface* s, Uint32 p , int x , int y , int mX , int mY ); int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameGraphics_t *gGraph); #endif /*GRAPHIC_H*/ diff --git a/src/loader.c b/src/loader.c index d3cce84..e818ff4 100644 --- a/src/loader.c +++ b/src/loader.c @@ -59,6 +59,7 @@ int loadRessources(gameIni_t *gIni, gameRess_t *gRess) { case 7: case 8: snprintf(filepath, filenamelen, "%s/%s/%som_%d.gif", PATH_STYLE, gIni->style.name, gIni->style.name, i); + // ... cheater !! gRess->style.objectMasks[i] = loadGif(filepath); if (gRess->style.objectMasks[i]==NULL) { logs2(LOG_WARN, "loadRessources(), loadGif() error for ", filepath); |