summaryrefslogtreecommitdiff
path: root/level.c
diff options
context:
space:
mode:
Diffstat (limited to 'level.c')
-rw-r--r--level.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/level.c b/level.c
index 8e47bf2..6097f23 100644
--- a/level.c
+++ b/level.c
@@ -102,13 +102,23 @@ 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'
- level->surf_entities = IMG_Load( "entities.png" );
+ SDL_Surface* surf_entities = IMG_Load( "entities.png" );
+ level->surf_entities = SDL_ConvertSurfaceFormat(surf_entities,
+ SDL_PIXELFORMAT_ARGB8888, 0);
- level->surf_tiles = IMG_Load( "tiles.png" );
+ SDL_Surface* surf_tiles = IMG_Load( "tiles.png" );
+ level->surf_tiles = SDL_ConvertSurfaceFormat(surf_tiles,
+ SDL_PIXELFORMAT_ARGB8888, 0);
// Do the same for the losing screens
- level->surf_losingscreens[0] = IMG_Load("failscreen_01.png");
- level->surf_winning_screen = IMG_Load("winningscreen.png");
+
+ SDL_Surface* surf_losing = IMG_Load("failscreen_01.png");
+ level->surf_losingscreens[0] = SDL_ConvertSurfaceFormat(surf_losing,
+ SDL_PIXELFORMAT_ARGB8888, 0);
+
+ SDL_Surface* surf_win = IMG_Load("winningscreen.png");
+ level->surf_winning_screen = SDL_ConvertSurfaceFormat(surf_win,
+ SDL_PIXELFORMAT_ARGB8888, 0);
}
@@ -149,7 +159,7 @@ void level_load( int level_number, struct level_struct *level )
/* Ieterate through the file and load the squares into the level's structure
* Each row/line in the file represents a row of squares in the level
* Each square is represented in the rows by a number from 0 to 255
- * Open up one of the level files with a text editor to study its structure further
+ * Open up one of the level files with a text editor to study its structure further
*/
/* WARNING: This code assumes the file is structured correctly in the first place!
@@ -206,8 +216,6 @@ void level_load( int level_number, struct level_struct *level )
}
-
-
// Replace every tile in the level of firsttype with secondtype
// Useful for eg opening doors
void level_replace_tiles( struct level_struct *currentlevel, char firsttype, char secondtype )
@@ -222,15 +230,3 @@ void level_replace_tiles( struct level_struct *currentlevel, char firsttype, cha
}
}
}
-
-
-
-
-
-
-
-
-
-
-
-