From 514fed1a940d82a812ff2c38564517772ba6ed15 Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Sun, 13 Jan 2019 19:32:43 +0100 Subject: Get rid of unneeded surfaces --- render.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 04a3105..1e7fa63 100644 --- a/render.c +++ b/render.c @@ -49,7 +49,7 @@ void get_pixmap_level( char number, SDL_Rect * crop ) // render() paints everything onto the screen when called -void render(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Texture * surf_screen ) +void render(SDL_Renderer* renderer, struct level_struct *currentlevel) { /* The picture on-screen is made in three steps: * 1) Draw the level onto the screen surface @@ -87,11 +87,11 @@ void render(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Textu /// Draw this tile onto the screen //SDL_BlitSurface ( currentlevel->surf_tiles, &pixmap_crop, surf_screen, &destination ); - int ret = SDL_RenderCopy(renderer, currentlevel->surf_tiles, + int ret = SDL_RenderCopy(renderer, currentlevel->tiles, &pixmap_crop, &destination); if (ret < 0 ) { - printf("Error (SDL): %s: %s\n", "could not render copy surf_tiles", SDL_GetError()); + printf("Error (SDL): %s: %s\n", "could not render copy tiles", SDL_GetError()); } } } @@ -103,7 +103,7 @@ void render(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Textu destination.y = currentlevel->py * TILE_SIZE; // Render onto screen - SDL_RenderCopy(renderer, currentlevel->surf_entities, + SDL_RenderCopy(renderer, currentlevel->entities, &pixmap_crop, &destination); @@ -123,7 +123,7 @@ void render(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Textu destination.y = current_echidna.ypos * TILE_SIZE; // Render it onscreen - SDL_RenderCopy(renderer, currentlevel->surf_entities, + SDL_RenderCopy(renderer, currentlevel->entities, &pixmap_crop, &destination); } @@ -133,16 +133,11 @@ void render(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Textu SDL_RenderPresent(renderer); } -void render_a_losingscreen(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Texture * surf_screen ) +void render_a_losingscreen(SDL_Renderer* renderer, struct level_struct *currentlevel) { // Render a losing screen - SDL_UpdateTexture(surf_screen, NULL, - currentlevel->surf_losingscreens[0]->pixels, - currentlevel->surf_losingscreens[0]->pitch); - - SDL_RenderClear(renderer); - SDL_RenderCopy(renderer, surf_screen, NULL, NULL); + SDL_RenderCopy(renderer, currentlevel->winning_screen, NULL, NULL); SDL_RenderPresent(renderer); // Wait a second so the user can see the losing screen -- cgit v1.2.1-18-gbd029