summaryrefslogtreecommitdiff
path: root/level.c
diff options
context:
space:
mode:
Diffstat (limited to 'level.c')
-rw-r--r--level.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/level.c b/level.c
index b00e235..4fd4277 100644
--- a/level.c
+++ b/level.c
@@ -66,10 +66,8 @@ struct level_struct
int sx, sy; // Player X and Y starting positions
// Resources
- SDL_Surface * surf_entities; // Player and echidna pictures
- SDL_Texture * surf_entities_tex;
- SDL_Surface * surf_tiles; // Level tiles/squares
- SDL_Texture * surf_tiles_tex;
+ SDL_Texture * surf_entities;
+ SDL_Texture * surf_tiles;
// A various selection of losing screens
SDL_Surface * surf_losingscreens[5];
@@ -103,26 +101,14 @@ void eat_until_newline( FILE *currentfile )
void level_load_resources(SDL_Renderer* renderer, struct level_struct *level )
{
// Load the images for things into their own 'surfaces'
- SDL_Surface* surf_entities = IMG_Load( "entities.png" );
- level->surf_entities = SDL_ConvertSurfaceFormat(surf_entities,
- SDL_PIXELFORMAT_ARGB8888, 0);
-
- level->surf_entities_tex = SDL_CreateTextureFromSurface(renderer,
- level->surf_entities);
+ SDL_Surface* surf_entities = IMG_Load("entities.png");
+ level->surf_entities = SDL_CreateTextureFromSurface(renderer,
+ surf_entities);
- SDL_Surface* surf_tiles = IMG_Load( "tiles.png" );
- level->surf_tiles = SDL_ConvertSurfaceFormat(surf_tiles,
- SDL_PIXELFORMAT_ARGB8888, 0);
-
- level->surf_tiles_tex = SDL_CreateTextureFromSurface(renderer,
- level->surf_tiles);
+ SDL_Surface* surf_tiles = IMG_Load("tiles.png");
+ level->surf_tiles = SDL_CreateTextureFromSurface(renderer,
+ surf_tiles);
- int w, h;
- Uint32 format;
- SDL_QueryTexture(level->surf_tiles_tex, &format, NULL, &w, &h);
- printf("surf_tiles_tex: w: %d, h: %d, format: %s\n", w, h, SDL_GetPixelFormatName(format));
- // Do the same for the losing screens
-
SDL_Surface* surf_losing = IMG_Load("failscreen_01.png");
level->surf_losingscreens[0] = SDL_ConvertSurfaceFormat(surf_losing,
SDL_PIXELFORMAT_ARGB8888, 0);