1KBCJ3 flashbacks. Draw multiple layers.

This commit is contained in:
KikooDX 2020-12-28 00:31:33 +01:00
parent 943348e545
commit 6b3178566b
3 changed files with 8 additions and 6 deletions

View File

@ -4,11 +4,11 @@
#include <gint/defs/types.h>
typedef struct Level {
int width; /* in tiles */
int height; /* in tiles */
uint width; /* in tiles */
uint height; /* in tiles */
const uint8_t **layers; /* points toward the level content */
int layers_count;
uint solid_layer; /* id of the solid layer */
uint8_t layers_count;
uint8_t solid_layer; /* id of the solid layer */
} Level;
#include "camera.h"

View File

@ -15,4 +15,4 @@ local function create_random_level(width, height, layers)
end
end
create_random_level(64, 64, 1)
create_random_level(64, 64, 3)

View File

@ -10,7 +10,9 @@ void level_step(const Level *level) {
}
void level_draw(const Level *level, Camera *camera) {
layer_draw(level, camera, 0);
for (int i = 0; i < level->layers_count; ++i) {
layer_draw(level, camera, i);
}
}
void layer_draw(const Level *level, Camera *camera, uint layer_id) {