diff options
Diffstat (limited to 'src/level.zig')
| -rw-r--r-- | src/level.zig | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/level.zig b/src/level.zig index f277b19..31d86df 100644 --- a/src/level.zig +++ b/src/level.zig @@ -17,35 +17,30 @@ const std = @import("std"); -pub const Layer = struct { +pub const Polygon = union(enum) { pub const MAX_VERTS = 16; - height : f32 = 0, - vertical_texture : u8 = 0, - vertical_texture_scale : f32 = 4, - horizontal_texture : u8 = 0, - // What happened to this error? Is it comptime? + square: void, vertices: std.BoundedArray([2]f32, MAX_VERTS), }; +pub const Layer = struct { + height: f32 = 0, + vertical_texture: u8 = 0, + vertical_texture_scale: f32 = 4, + horizontal_texture: u8 = 0, + + polygon: Polygon, +}; + pub const Cell = struct { pub const MAX_LAYERS = 16; - // floor_height: f32 = 0, - // ceiling_height: f32 = DEFAULT_HEIGHT, - // draw_down: bool = false, - // lower_texture: u8 = 0, - // upper_texture: u8 = 0, - // floor_texture: u8 = 0, - // ceiling_texture: u8 = 2, - lower_layers : std.BoundedArray(Layer, MAX_LAYERS), + lower_layers: std.BoundedArray(Layer, MAX_LAYERS), - // I'm not sure how i feel about reaching into the implementation of - // BoundedArray like this. Surely there should be an ``.empty'' or something - // default? fn empty() !Cell { const lower_layers = try std.BoundedArray(Layer, MAX_LAYERS).init(0); - return Cell{ . lower_layers = lower_layers }; + return Cell{ .lower_layers = lower_layers }; } pub const DEFAULT_HEIGHT: f32 = 4; |
