summaryrefslogtreecommitdiff
path: root/level.c
diff options
context:
space:
mode:
Diffstat (limited to 'level.c')
-rw-r--r--level.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/level.c b/level.c
index 6097f23..b00e235 100644
--- a/level.c
+++ b/level.c
@@ -67,7 +67,9 @@ struct level_struct
// 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;
// A various selection of losing screens
SDL_Surface * surf_losingscreens[5];
@@ -77,7 +79,6 @@ struct level_struct
// Up to ten echidnas
struct echidna echidnas[10];
-
};
@@ -106,10 +107,20 @@ void level_load_resources(SDL_Renderer* renderer, struct level_struct *level )
level->surf_entities = SDL_ConvertSurfaceFormat(surf_entities,
SDL_PIXELFORMAT_ARGB8888, 0);
+ level->surf_entities_tex = SDL_CreateTextureFromSurface(renderer,
+ level->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);
+ 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");