ZKMKYEQIZEXSJODLLOQOE3NHIERICDPE7HASBOZ7UA7OYNADZCJAC
}
const building_names: [MAX_BUILDINGS][]const u8 = .{
"building_1",
"building_2",
"building_3",
"building_4",
"building_5",
"building_6",
"building_7",
"building_8",
"building_9",
"building_10",
"building_11",
"building_12",
"building_13",
"building_14",
"building_15",
"building_16",
"building_17",
"building_18",
"building_19",
"building_20",
"building_21",
"building_22",
"building_23",
"building_24",
"building_25",
"building_26",
"building_27",
"building_28",
"building_29",
"building_30",
"building_31",
"building_32",
"building_33",
"building_34",
"building_35",
"building_36",
"building_37",
"building_38",
"building_39",
"building_40",
"building_41",
"building_42",
"building_43",
"building_44",
"building_45",
"building_46",
"building_47",
"building_48",
"building_49",
"building_50",
"building_51",
"building_52",
"building_53",
"building_54",
"building_55",
"building_56",
"building_57",
"building_58",
"building_59",
"building_60",
"building_61",
"building_62",
"building_63",
"building_64",
"building_65",
"building_66",
"building_67",
"building_68",
"building_69",
"building_70",
"building_71",
"building_72",
"building_73",
"building_74",
"building_75",
"building_76",
"building_77",
"building_78",
"building_79",
"building_80",
"building_81",
"building_82",
"building_83",
"building_84",
"building_85",
"building_86",
"building_87",
"building_88",
"building_89",
"building_90",
"building_91",
"building_92",
"building_93",
"building_94",
"building_95",
"building_96",
"building_97",
"building_98",
"building_99",
"building_100",
};
fn format(comptime s: usize, comptime f: []const u8, args: anytype) ![]const u8 {
var buf: [s]u8 = undefined;
var writer = std.io.fixedBufferStream(&buf);
try std.fmt.format(writer.writer(), f, args);
const result = writer.writer().context.getWritten();
std.debug.print("result: {s}\n", .{result});
return result;
const r: u8 = @truncate(@as(u32, @intCast(rl.GetRandomValue(200, 240))));
const g: u8 = @truncate(@as(u32, @intCast(rl.GetRandomValue(200, 240))));
const b: u8 = @truncate(@as(u32, @intCast(rl.GetRandomValue(200, 240))));
std.debug.print("Color: {d} {d} {d}\n", .{ r, g, b });
const r1 = rl.GetRandomValue(200, 240);
const g1 = rl.GetRandomValue(200, 240);
const b1 = rl.GetRandomValue(200, 240);
const r: u8 = @truncate(@as(u32, @intCast(r1)));
const g: u8 = @truncate(@as(u32, @intCast(g1)));
const b: u8 = @truncate(@as(u32, @intCast(b1)));
}
}
fn draw_debug(game_state: GameState) void {
_ = game_state;
rl.DrawLine(
@intFromFloat(camera.target.x),
-screen_height * 10,
@intFromFloat(camera.target.x),
screen_height * 10,
rl.GREEN,
);
rl.DrawLine(
-screen_width * 10,
@intFromFloat(camera.target.y),
screen_width * 10,
@intFromFloat(camera.target.y),
rl.GREEN,
);
}
fn draw_ui(game_state: GameState) !void {
rl.DrawText("SCREEN AREA", 640, 10, 20, rl.RED);
var buf: [20]u8 = std.mem.zeroes([20]u8);
const fps = try std.fmt.bufPrint(&buf, "FPS: {}", .{rl.GetFPS()});
rl.DrawText(@ptrCast(fps), 10, 10, 20, rl.DARKGRAY);
rl.DrawRectangle(0, 0, screen_width, 5, rl.RED);
rl.DrawRectangle(0, 5, 5, screen_height - 10, rl.RED);
rl.DrawRectangle(screen_width - 5, 5, 5, screen_height - 10, rl.RED);
rl.DrawRectangle(0, screen_height - 5, screen_width, 5, rl.RED);
const info_box_y = 20;
rl.DrawRectangle(10, info_box_y + 10, 250, 80, rl.Fade(rl.SKYBLUE, 0.5));
rl.DrawRectangleLines(10, info_box_y + 10, 250, 80, rl.BLUE);
rl.DrawText("Free 2d camera controls:", 20, info_box_y + 20, 10, rl.BLACK);
rl.DrawText("- WASD to move", 40, info_box_y + 40, 10, rl.DARKGRAY);
rl.DrawText("- Mouse Wheel to Zoom in-out", 40, info_box_y + 60, 10, rl.DARKGRAY);
switch (game_state) {
GameState.exit_requested => {
rl.DrawRectangle(0, 100, screen_width, 200, rl.BLACK);
rl.DrawText("Do you want to exit? (Y/N)", 40, 180, 30, rl.WHITE);
},
else => {},
// const allocator = std.heap.c_allocator;
// var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
// const allocator = general_purpose_allocator.allocator();
rl.InitWindow(screen_width, screen_height, "ZigGame");
defer rl.CloseWindow();
const seed = std.time.milliTimestamp(); // Get a timestamp or another varying seed
rl.SetRandomSeed(@as(u32, @truncate(@as(u64, @intCast(seed)))));
pub fn SYSTEM(
world: *ecs.world_t,
name: [*:0]const u8,
phase: ecs.entity_t,
system_desc: *ecs.system_desc_t,
) ecs.entity_t {
var entity_desc = ecs.entity_desc_t{};
entity_desc.id = ecs.new_id(world);
entity_desc.name = name;
entity_desc.add[0] = if (phase != 0) ecs.pair(ecs.DependsOn, phase) else 0;
entity_desc.add[1] = phase;
system_desc.entity = ecs.entity_init(world, &entity_desc);
return ecs.system_init(world, system_desc);
}
"problemMatcher": []
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": ["$zig"]
},
{
"label": "Build (Linux x64) Release",
"type": "shell",
"command": "zig",
"args": [
"build",
"-Doptimize=ReleaseFast",
"-Dtarget=x86_64-linux-gnu"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": ["$zig"]
},
{
"label": "Build (Windows x64) Release",
"type": "shell",
"command": "zig",
"args": [
"build",
"-Doptimize=ReleaseFast",
"-Dtarget=x86_64-windows-gnu"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"problemMatcher": ["$zig"]