diff options
Diffstat (limited to 'render.c')
-rw-r--r-- | render.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -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 );
|