Skip to content
Snippets Groups Projects
Commit 39223416 authored by belkhiritaha's avatar belkhiritaha
Browse files

Merge branch 'render' of github.com:maberet/ProjetZZ1 into render

parents 1715eaa5 521c4644
Branches
No related tags found
No related merge requests found
travail_de_groupe/chef_oeuvre/Res/score.png

13.6 KiB

......@@ -50,6 +50,9 @@ SDL_Texture * emptyBucketTexture;
SDL_Surface * filledBucketSurface;
SDL_Texture * filledBucketTexture;
SDL_Surface * scoreSurface;
SDL_Texture * scoreTexture;
void createWindow(){
if (SDL_Init(SDL_INIT_VIDEO) != 0){
......@@ -204,6 +207,16 @@ void drawPlayerWaterLevel(){
}
}
void drawScore(){
SDL_Rect rect;
rect.h = screenDimension.h/6;
rect.w = (screenDimension.w - (MAPSIZE * CELLSIZE)) / 2;
rect.x = 0;
rect.y = 0;
SDL_RenderCopy(renderer, scoreTexture, NULL, &rect);
}
void drawGame(){
SDL_RenderClear(renderer);
drawBackgroundSides();
......@@ -211,6 +224,7 @@ void drawGame(){
drawPlayer();
drawFire();
drawPlayerWaterLevel();
drawScore();
SDL_RenderPresent(renderer);
}
......@@ -260,6 +274,9 @@ void mainLoop(){
filledBucketSurface = IMG_Load("Res/filled_bucket.png");
filledBucketTexture = SDL_CreateTextureFromSurface(renderer, filledBucketSurface);
scoreSurface = IMG_Load("Res/score.png");
scoreTexture = SDL_CreateTextureFromSurface(renderer, scoreSurface);
SDL_FreeSurface(grassSurface);
SDL_FreeSurface(treeSurface);
SDL_FreeSurface(hoverSurface);
......@@ -271,6 +288,10 @@ void mainLoop(){
SDL_FreeSurface(noHoverSurface);
SDL_FreeSurface(fireSurface);
SDL_FreeSurface(waterSurface);
SDL_FreeSurface(emptyBucketSurface);
SDL_FreeSurface(filledBucketSurface);
SDL_FreeSurface(scoreSurface);
unsigned int a = SDL_GetTicks();
unsigned int b = SDL_GetTicks();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment