diff options
-rw-r--r-- | sdl-test/SDL_tuto/TestParserLemmingsLVL/SpecLemming.odt | bin | 20911 -> 25885 bytes | |||
-rw-r--r-- | src/graphic.c | 21 | ||||
-rw-r--r-- | src/include/graphic.h | 1 | ||||
-rw-r--r-- | src/loader.c | 1 |
4 files changed, 23 insertions, 0 deletions
diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/SpecLemming.odt b/sdl-test/SDL_tuto/TestParserLemmingsLVL/SpecLemming.odt Binary files differindex 675e2c9..878a5ee 100644 --- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/SpecLemming.odt +++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/SpecLemming.odt 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); |