From 54bb3b30f1a625e48621a9b139127e7a2dd82561 Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Sun, 13 Jan 2019 17:12:17 +0100 Subject: Switch back to surfaces --- render.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index faea80f..2e8e97d 100644 --- a/render.c +++ b/render.c @@ -64,12 +64,10 @@ void render(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Textu pixmap_crop.w = TILE_SIZE; pixmap_crop.h = TILE_SIZE; - /// Level drawing // ieterate through each square of the level, drawing the appropriate // pictures for each onto the screen - int tilex, tiley; // Where we are up to @@ -89,7 +87,9 @@ 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 ); - SDL_UpdateTexture(surf_screen, &destination, currentlevel->surf_tiles, 640 * sizeof (Uint32)); + SDL_UpdateTexture(surf_screen, &destination, + currentlevel->surf_tiles->pixels, + currentlevel->surf_tiles->pitch); } } @@ -101,11 +101,12 @@ void render(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Textu // Draw onto screen //SDL_BlitSurface ( currentlevel->surf_entities, &pixmap_crop, surf_screen, &destination ); - SDL_UpdateTexture(surf_screen, &destination, currentlevel->surf_entities, 640 * sizeof (Uint32)); + SDL_UpdateTexture(surf_screen, &destination, + currentlevel->surf_entities->pixels, + currentlevel->surf_entities->pitch); // Now draw all of the echidnas int ech_no; // Echidna number - for ( ech_no = 0; ech_no < 10; ech_no++ ) { struct echidna current_echidna = currentlevel->echidnas[ech_no]; @@ -121,9 +122,10 @@ void render(SDL_Renderer* renderer, struct level_struct *currentlevel, SDL_Textu // Draw it onscreen // SDL_BlitSurface ( currentlevel->surf_entities, &pixmap_crop, surf_screen, &destination ); - SDL_UpdateTexture(surf_screen, &destination, currentlevel->surf_entities, 640 * sizeof (Uint32)); + SDL_UpdateTexture(surf_screen, &destination, + currentlevel->surf_entities->pixels, + currentlevel->surf_entities->pitch); } - } /// Flip screen, so everything we have 'blitted' can now be seen @@ -139,7 +141,9 @@ void render_a_losingscreen(SDL_Renderer* renderer, struct level_struct *currentl // Render a losing screen //SDL_BlitSurface ( currentlevel->surf_losingscreens[0], NULL, surf_screen, NULL ); - SDL_UpdateTexture(surf_screen, NULL, currentlevel->surf_losingscreens[0], 640 * sizeof (Uint32)); + SDL_UpdateTexture(surf_screen, NULL, + currentlevel->surf_losingscreens[0]->pixels, + currentlevel->surf_losingscreens[0]->pitch); //SDL_Flip( surf_screen ); -- cgit v1.2.1-18-gbd029