hello world! (window)

This commit is contained in:
Vivianne 2022-06-29 23:04:08 -07:00
parent 36df738d4c
commit 6a42ef8868
6 changed files with 21181 additions and 0 deletions

28
build.zig Normal file
View File

@ -0,0 +1,28 @@
const std = @import("std");
const pkgs = @import("deps.zig").pkgs;
const build_pkgs = @import("deps.zig").build_pkgs;
pub fn build(b: *std.build.Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("efemra", "src/main.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
const gen = build_pkgs.build_vulkan.VkGenerateStep.init(b, "etc/vk.xml", "vk.zig");
exe.addPackage(pkgs.glfw);
exe.addPackage(gen.package);
build_pkgs.build_glfw.link(b, exe, .{});
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}

21110
etc/vk.xml Normal file

File diff suppressed because it is too large Load Diff

4
gyro.lock Normal file
View File

@ -0,0 +1,4 @@
git https://github.com/Snektron/vulkan-zig.git fdf43d846a4c3ff4d977bd4395898e4e16ca62cf generator/main.zig fdf43d846a4c3ff4d977bd4395898e4e16ca62cf
git https://github.com/hexops/mach-glfw.git 99bf7df61b9afe7c80aae29d664a566f42a8db35 src/main.zig 99bf7df61b9afe7c80aae29d664a566f42a8db35
git https://github.com/Snektron/vulkan-zig.git fdf43d846a4c3ff4d977bd4395898e4e16ca62cf generator/index.zig fdf43d846a4c3ff4d977bd4395898e4e16ca62cf
git https://github.com/hexops/mach-glfw.git 99bf7df61b9afe7c80aae29d664a566f42a8db35 build.zig 99bf7df61b9afe7c80aae29d664a566f42a8db35

22
gyro.zzz Normal file
View File

@ -0,0 +1,22 @@
deps:
vulkan:
git:
url: "https://github.com/Snektron/vulkan-zig.git"
ref: fdf43d846a4c3ff4d977bd4395898e4e16ca62cf
root: generator/main.zig
glfw:
git:
url: "https://github.com/hexops/mach-glfw.git"
ref: 99bf7df61b9afe7c80aae29d664a566f42a8db35
root: src/main.zig
build_deps:
build_vulkan:
git:
url: "https://github.com/Snektron/vulkan-zig.git"
ref: fdf43d846a4c3ff4d977bd4395898e4e16ca62cf
root: generator/index.zig
build_glfw:
git:
url: "https://github.com/hexops/mach-glfw.git"
ref: 99bf7df61b9afe7c80aae29d664a566f42a8db35
root: build.zig

3
notes.txt Normal file
View File

@ -0,0 +1,3 @@
- mach-glfw for glfw bindings
- vulkan-zig for vulkan - probably simplifies this part?
- Can always reimplement if desired.

14
src/main.zig Normal file
View File

@ -0,0 +1,14 @@
const std = @import("std");
const glfw = @import("glfw");
pub fn main() !void {
try glfw.init(.{});
defer glfw.terminate();
const window = try glfw.Window.create(1280, 720, "YOOOO", null, null, .{});
defer window.destroy();
while (!window.shouldClose()) {
try glfw.pollEvents();
}
}