Skip to content
Snippets Groups Projects
Commit 32149716 authored by Taha Belkhiri's avatar Taha Belkhiri
Browse files

added background sides

parent 7b697905
Branches
No related tags found
No related merge requests found
travail_de_groupe/chef_oeuvre/Res/background_sides.png

87.6 KiB

File deleted
......@@ -74,11 +74,11 @@ void manageGame(){
continue;
case SDLK_UP:
keys[0] = 0;
keys[PLAYER_UP] = 0;
break;
case SDLK_DOWN:
keys[1] = 0;
keys[PLAYER_DOWN] = 0;
break;
case SDLK_LEFT:
......@@ -102,11 +102,11 @@ void manageGame(){
continue;
case SDLK_UP:
keys[0] = 1;
keys[PLAYER_UP] = 1;
break;
case SDLK_DOWN:
keys[1] = 1;
keys[PLAYER_DOWN] = 1;
break;
case SDLK_LEFT:
......
......@@ -23,6 +23,9 @@ SDL_Texture * playerTexture;
SDL_Surface * backgroundSurface;
SDL_Texture * backgroundTexture;
SDL_Surface * backgroundSidesSurface;
SDL_Texture * backgroundSidesTexture;
SDL_Surface * playButtonSurface;
SDL_Texture * playButtonTexture;
......@@ -125,8 +128,14 @@ void drawPlayer(){
SDL_RenderCopyEx(renderer, playerTexture, &destRect, &rect, 0, NULL, SDL_FLIP_NONE);
}
void drawBackgroundSides(){
SDL_Rect rect = {0, 0, screenDimension.w, screenDimension.h};
SDL_RenderCopy(renderer, backgroundSidesTexture, NULL, &rect);
}
void drawGame(){
SDL_RenderClear(renderer);
drawBackgroundSides();
drawMap();
drawPlayer();
SDL_RenderPresent(renderer);
......@@ -150,6 +159,9 @@ void mainLoop(){
backgroundSurface = IMG_Load("Res/background_mat.png");
backgroundTexture = SDL_CreateTextureFromSurface(renderer, backgroundSurface);
backgroundSidesSurface = IMG_Load("Res/background_sides.png");
backgroundSidesTexture = SDL_CreateTextureFromSurface(renderer, backgroundSidesSurface);
playButtonSurface = IMG_Load("Res/play_button.png");
playButtonTexture = SDL_CreateTextureFromSurface(renderer, playButtonSurface);
......@@ -163,6 +175,7 @@ void mainLoop(){
SDL_FreeSurface(backgroundSurface);
SDL_FreeSurface(playButtonSurface);
SDL_FreeSurface(playButtonHoverSurface);
SDL_FreeSurface(backgroundSidesSurface);
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 register or to comment