diff options
author | Silvan Jegen <s.jegen@gmail.com> | 2019-01-13 19:32:43 +0100 |
---|---|---|
committer | Silvan Jegen <s.jegen@gmail.com> | 2019-01-13 19:32:43 +0100 |
commit | 514fed1a940d82a812ff2c38564517772ba6ed15 (patch) | |
tree | ea27609ebd16c1f30e573c52b09993d21965556f /render.c | |
parent | fcd09fafc54849557def0a4e22c93dc4fc7dd892 (diff) |
Get rid of unneeded surfaces
Diffstat (limited to 'render.c')
-rw-r--r-- | render.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -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
|