Got full map drawing

master
Louis Pearson 2022-01-15 13:58:08 -07:00
parent 7dcf2f0e02
commit b050b4c104
7 changed files with 184 additions and 47 deletions

View File

@ -1,22 +1,5 @@
pub const map: [400]u32 = .{
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 1, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50, 19, 19, 18, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 50, 19, 52, 1, 1, 1, 1, 20, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 1, 1, 1, 37, 1,
1, 39, 1, 50, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 20, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 50, 19, 52, 1, 1, 1, 1, 51, 1, 1, 1, 37, 1,
1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 1, 1, 1, 37, 1,
1, 39, 1, 50, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 51, 1, 2, 1, 37, 1,
54, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 19, 19, 19, 66, 54,
1, 1, 1, 1, 1, 1, 1, 50, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 20, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 51, 1,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
};
const std = @import("std");
const Vec2 = std.meta.Vector(2,i32);
pub const solid: [400]u8 = .{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 1, 1, 1, 39, 1, 1, 1, 1, 1, 1, 1, 178, 180, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 1, 19, 52, 1, 50, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 1, 1, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 50, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 1, 50, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 50, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 51, 1, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
"height":20,
"id":1,
"name":"Tile Layer 1",
"name":"solid",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":20,
"x":0,
"y":0
},
{
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 131, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":20,
"id":2,
"name":"conduit",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":20,
"x":0,
"y":0
},
{
"draworder":"topdown",
"id":3,
"name":"wire",
"objects":[
{
"height":0,
"id":5,
"name":"",
"polyline":[
{
"x":0,
"y":0
},
{
"x":56,
"y":0
}],
"nextlayerid":2,
"nextobjectid":1,
"rotation":0,
"type":"wire",
"visible":true,
"width":0,
"x":20,
"y":20
},
{
"height":0,
"id":6,
"name":"",
"polyline":[
{
"x":0,
"y":0
},
{
"x":50.5,
"y":10.875
}],
"rotation":0,
"type":"wire",
"visible":true,
"width":0,
"x":84.125,
"y":19.875
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
}],
"nextlayerid":4,
"nextobjectid":7,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.7.2",

View File

@ -1,31 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.5" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="20" height="20" tilewidth="8" tileheight="8" infinite="0" nextlayerid="2" nextobjectid="1">
<map version="1.5" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="20" height="20" tilewidth="8" tileheight="8" infinite="0" nextlayerid="4" nextobjectid="7">
<editorsettings>
<export target="test.json" format="json"/>
</editorsettings>
<tileset firstgid="1" source="wired.tsx"/>
<layer id="1" name="Tile Layer 1" width="20" height="20">
<layer id="1" name="solid" width="20" height="20">
<data encoding="csv">
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,1,1,
1,39,1,1,1,1,1,1,1,178,180,1,1,1,1,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
1,1,19,52,1,50,19,19,19,19,19,19,19,19,19,19,19,19,1,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
1,39,1,50,19,52,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
1,39,1,1,1,1,1,50,19,52,1,1,1,1,1,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
1,39,1,50,19,52,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,50,19,19,18,1,1,1,37,1,
1,39,1,1,1,1,1,50,19,52,1,1,1,1,20,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,20,1,1,1,37,1,
1,39,1,50,19,52,1,1,1,1,1,1,1,1,20,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,20,1,1,1,37,1,
1,39,1,1,1,1,1,50,19,52,1,1,1,1,51,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,20,1,1,1,37,1,
1,39,1,50,19,52,1,1,1,1,1,1,1,1,51,1,2,1,37,1,
54,55,1,1,1,1,1,1,1,1,1,1,1,1,33,19,19,19,66,54,
1,39,1,1,1,1,1,50,19,52,1,1,1,1,1,1,1,1,37,1,
1,39,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
1,39,1,50,19,52,1,1,1,1,1,1,1,1,1,1,1,1,37,1,
54,55,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,33,54,
1,1,1,1,1,1,1,50,19,52,1,1,1,1,1,1,1,1,20,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,51,1,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
</data>
</layer>
<layer id="2" name="conduit" width="20" height="20">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
131,131,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,178,130,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="3" name="wire">
<object id="5" type="wire" x="20" y="20">
<polyline points="0,0 56,0"/>
</object>
<object id="6" type="wire" x="84.125" y="19.875">
<polyline points="0,0 50.5,10.875"/>
</object>
</objectgroup>
</map>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

After

Width:  |  Height:  |  Size: 675 B

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,34 @@
const std = @import("std");
const Point = struct {
x: f64 = 0,
y: f64 = 0,
};
const Object = struct {
height: u64 = 0,
id: u64 = 0,
name: []const u8,
polyline: []Point,
rotation: f64 = 0,
@"type": []const u8 = "",
visible: bool = true,
width: u64 = 0,
x: f64 = 0,
y: f64 = 0,
};
const Layer = struct {
data: []u64,
height: u64,
data: []u64 = &.{},
objects: []Object = &.{},
height: u64 = 0,
id: u64,
name: []const u8,
draworder: enum { topdown, none } = .none,
opacity: u64,
@"type": enum { tilelayer },
@"type": enum { tilelayer, objectgroup },
visible: bool,
width: u64,
width: u64 = 0,
x: i64,
y: i64,
};
@ -58,8 +78,36 @@ pub fn main() anyerror!void {
const map = try std.json.parse(MapType, &tokenstream, options);
defer std.json.parseFree(MapType, map, options);
var outbuffer: [64 * KB]u8 = undefined;
var outcontent = try std.fmt.bufPrint(&outbuffer, "pub const map: [{}]u8 = .{any};\n", .{ map.layers[0].data.len, map.layers[0].data });
_ = try output.writeAll(outcontent);
var outlist = std.ArrayList(u8).init(alloc);
defer outlist.deinit();
try outlist.appendSlice("const std = @import(\"std\");\n");
try outlist.appendSlice("const Vec2 = std.meta.Vector(2,i32);\n");
var outbuffer: [4 * KB]u8 = undefined;
for (map.layers) |layer| {
switch (layer.@"type") {
.tilelayer => {
var outcontent = try std.fmt.bufPrint(&outbuffer, "pub const {s}: [{}]u8 = .{any};\n", .{ layer.name, layer.data.len, layer.data });
_ = try outlist.appendSlice(outcontent);
},
.objectgroup => {
var outcontent = try std.fmt.bufPrint(&outbuffer, "pub const {s}: [{}][2]Vec2 = [_][2]Vec2{{", .{ layer.name, layer.objects.len });
try outlist.appendSlice(outcontent);
for (layer.objects) |obj| {
try outlist.appendSlice(".{");
for (obj.polyline) |point| {
var pointf = try std.fmt.bufPrint(&outbuffer, ".{{ {}, {} }},", .{ @floatToInt(i32, obj.x + point.x), @floatToInt(i32, obj.y + point.y) });
try outlist.appendSlice(pointf);
}
try outlist.appendSlice("}, ");
}
try outlist.appendSlice("};\n");
},
}
}
std.log.info("{s}", .{outlist.items});
_ = try output.writeAll(outlist.items);
}
}

View File

@ -110,12 +110,23 @@ export fn update() void {
world.process(1, &.{ .sprite, .controlAnim, .control }, controlAnimProcess);
world.process(1, &.{ .pos, .sprite }, drawProcess);
w4.DRAW_COLORS.* = 0x0010;
for (assets.map) |tilePlus, i| {
w4.DRAW_COLORS.* = 0x0210;
for (assets.solid) |tilePlus, i| {
const tile = tilePlus - 1;
const t = w4.Vec2{ @intCast(i32, (tile % 16) * 8), @intCast(i32, (tile / 16) * 8) };
const pos = w4.Vec2{ @intCast(i32, (i % 20) * 8), @intCast(i32, (i / 20) * 8) };
w4.blitSub(&assets.tiles, pos, .{ 8, 8 }, t, 128, .{ .bpp = .b2 });
const conduitRaw = assets.conduit[i];
if (conduitRaw != 0) {
const conduittile = conduitRaw - 1;
const tconduit = w4.Vec2{ @intCast(i32, (conduittile % 16) * 8), @intCast(i32, (conduittile / 16) * 8) };
w4.blitSub(&assets.tiles, pos, .{ 8, 8 }, tconduit, 128, .{ .bpp = .b2 });
}
}
w4.DRAW_COLORS.* = 0x0001;
for (assets.wire) |wire| {
w4.line(wire[0], wire[1]);
}
}