Background color per level, fixed a few warns.

This commit is contained in:
KikooDX 2021-01-12 13:28:22 +01:00
parent e67a9eb9c5
commit d00fa96a9d
5 changed files with 5 additions and 4 deletions

@ -1 +1 @@
Subproject commit ffc3f5f595509d1d952a02a45a4a7b28c6ecc4ef
Subproject commit bc1e99c2db0a5c85f68b2be6c1638debb061b6ab

View File

@ -8,6 +8,7 @@
typedef struct Level {
uint width; /* in tiles */
uint height; /* in tiles */
uint16_t bg_color; /* background color */
const Tile **layers; /* points toward the level content */
uint8_t layers_count;
uint8_t solid_layer; /* id of the solid layer */

2
levels

@ -1 +1 @@
Subproject commit 5458e79f752d5f16fb95bb7d6fe90833ee8edfb4
Subproject commit 144f9142f3b7a9bf015fd254516bfa3342d370fc

View File

@ -87,7 +87,7 @@ void step_event(Player *player, const Level *level, Camera *camera, Input *input
}
void draw_event(Player *player, const Level *level, Camera *camera, Input *input, uint step) {
dclear(C_WHITE);
dclear(level->bg_color);
level_draw(level, camera);
player_draw(player, camera);
#ifdef DEBUG

View File

@ -56,7 +56,7 @@ void player_set_vars(Player *player, const Level *level) {
pos.x -= 2;
flags |= player_collide_or(player, pos, level);
/* test for each flag */
for (int i = 0; i < sizeof(Tile_flags) * 8; i++) {
for (uint i = 0; i < sizeof(Tile_flags) * 8; i++) {
if (flags & 1) {
switch (1 << i) {
case F_ICE: