-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
147 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,7 @@ jobs: | |
|
||
- name: Build | ||
run: zig build | ||
|
||
- name: Build Showcase | ||
working-directory: showcase | ||
run: zig build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const std = @import("std"); | ||
const sycl_badge = @import("sycl_badge"); | ||
|
||
pub const author_name = "Jonathan Marler"; | ||
pub const author_handle = "marler"; | ||
pub const cart_title = "blobs"; | ||
pub const description = "<TODO>: get Marler to give a description"; | ||
|
||
pub fn build(b: *std.Build) void { | ||
const optimize = b.standardOptimizeOption(.{}); | ||
const sycl_badge_dep = b.dependency("sycl_badge", .{}); | ||
|
||
const cart = sycl_badge.add_cart(sycl_badge_dep, b, .{ | ||
.name = "blobs", | ||
.optimize = optimize, | ||
.root_source_file = b.path("src/blobs.zig"), | ||
}); | ||
cart.install(b); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.{ | ||
.name = "blobs", | ||
.version = "0.0.0", | ||
.dependencies = .{ | ||
.sycl_badge = .{ .path = "../../.." }, | ||
}, | ||
.paths = .{ | ||
"build.zig", | ||
"build.zig.zon", | ||
"src", | ||
}, | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
const std = @import("std"); | ||
const Build = std.Build; | ||
|
||
const sycl_badge = @import("sycl_badge"); | ||
|
||
pub const author_name = "Fabio Arnold"; | ||
pub const author_handle = "CaptainHorst"; | ||
pub const cart_title = "Zeroman"; | ||
pub const description = "<TODO>: get Fabio to give a description"; | ||
|
||
pub fn build(b: *Build) void { | ||
const optimize = b.standardOptimizeOption(.{}); | ||
const sycl_badge_dep = b.dependency("sycl_badge", .{}); | ||
|
||
const cart = sycl_badge.add_cart(sycl_badge_dep, b, .{ | ||
.name = "zeroman", | ||
.optimize = optimize, | ||
.root_source_file = b.path("src/main.zig"), | ||
}); | ||
add_zeroman_assets_step(sycl_badge_dep, b, cart); | ||
cart.install(b); | ||
} | ||
|
||
fn add_zeroman_assets_step( | ||
sycl_badge_dep: *Build.Dependency, | ||
b: *Build, | ||
cart: *sycl_badge.Cart, | ||
) void { | ||
const convert = b.addExecutable(.{ | ||
.name = "convert_gfx", | ||
.root_source_file = b.path("build/convert_gfx.zig"), | ||
.target = b.host, | ||
.optimize = cart.options.optimize, | ||
.link_libc = true, | ||
}); | ||
convert.root_module.addImport("zigimg", b.dependency("zigimg", .{}).module("zigimg")); | ||
|
||
const gen_gfx = b.addRunArtifact(convert); | ||
inline for (zeroman_assets) |file| { | ||
gen_gfx.addArg("-i"); | ||
gen_gfx.addFileArg(b.path(file.path)); | ||
gen_gfx.addArg(std.fmt.comptimePrint("{}", .{file.bits})); | ||
gen_gfx.addArg(std.fmt.comptimePrint("{}", .{file.transparency})); | ||
} | ||
gen_gfx.addArg("-o"); | ||
const gfx_zig = gen_gfx.addOutputFileArg("gfx.zig"); | ||
|
||
const gfx_mod = b.addModule("gfx", .{ | ||
.root_source_file = gfx_zig, | ||
.optimize = cart.options.optimize, | ||
}); | ||
gfx_mod.addImport("cart-api", sycl_badge_dep.module("cart-api")); | ||
|
||
cart.wasm.step.dependOn(&gen_gfx.step); | ||
cart.wasm.root_module.addImport("gfx", gfx_mod); | ||
cart.cart_lib.root_module.addImport("gfx", gfx_mod); | ||
} | ||
|
||
const GfxAsset = struct { path: []const u8, bits: u4, transparency: bool }; | ||
|
||
const zeroman_assets = [_]GfxAsset{ | ||
.{ .path = "assets/door.png", .bits = 2, .transparency = false }, | ||
.{ .path = "assets/effects.png", .bits = 2, .transparency = true }, | ||
.{ .path = "assets/font.png", .bits = 2, .transparency = true }, | ||
.{ .path = "assets/gopher.png", .bits = 4, .transparency = true }, | ||
.{ .path = "assets/healthbar.png", .bits = 4, .transparency = true }, | ||
.{ .path = "assets/hurt.png", .bits = 1, .transparency = true }, | ||
.{ .path = "assets/needleman.png", .bits = 4, .transparency = false }, | ||
.{ .path = "assets/shot.png", .bits = 2, .transparency = true }, | ||
.{ .path = "assets/spike.png", .bits = 2, .transparency = true }, | ||
.{ .path = "assets/teleport.png", .bits = 2, .transparency = true }, | ||
.{ .path = "assets/title.png", .bits = 4, .transparency = false }, | ||
.{ .path = "assets/zero.png", .bits = 4, .transparency = true }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.{ | ||
.name = "zeroman", | ||
.version = "0.0.0", | ||
.dependencies = .{ | ||
.sycl_badge = .{ .path = "../../.." }, | ||
.zigimg = .{ | ||
.url = "https://github.com/zigimg/zigimg/archive/637974e2d31dcdbc33f1e9cc8ffb2e46abd2e215.tar.gz", | ||
.hash = "122012026c3a65ff1d4acba3b3fe80785f7cee9c6b4cdaff7ed0fbf23b0a6c803989", | ||
}, | ||
}, | ||
.paths = .{ | ||
"build.zig", | ||
"build.zig.zon", | ||
"src", | ||
"build", | ||
"assets", | ||
}, | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.