1KBCJ3 flashbacks. Draw multiple layers.

master
kdx 2 years ago
parent 943348e545
commit 6b3178566b
  1. 8
      include/level.h
  2. 2
      levels/create_demo.lua
  3. 4
      src/level.c

@ -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"

@ -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)

@ -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) {

Loading…
Cancel
Save