Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Zig 0.14.0-dev, run through $ zig fmt #2675

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ CMakeSettings.json
tic_mruby_build_config.rb.lock
tic_mruby_wasm_build_config.rb.lock
build/mruby_vendor-prefix/
**/zig-cache
**/.zig-cache
**/zig-out
.cache
*~
Expand Down
2 changes: 1 addition & 1 deletion demos/bunny/wasmmark/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bunnymark in Zig / WASM

This is a Zig project. To build it you'll need Zig 0.12 or newer.
This is a Zig project. To build it you'll need the latest Zig development release (`0.14.0-dev.1421+f87dd43c1` or newer).

### Building

Expand Down
2 changes: 1 addition & 1 deletion demos/bunny/wasmmark/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void {
const target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
const exe = b.addExecutable(.{
.name = "cart",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
Expand Down
8 changes: 4 additions & 4 deletions demos/bunny/wasmmark/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

const tic = @import("tic80.zig");
const std = @import("std");
const RndGen = std.rand.DefaultPrng;
var rnd: std.rand.Random = undefined;
const RndGen = std.Random.DefaultPrng;
var rnd: std.Random = undefined;

const screenWidth = 240;
const screenHeight = 136;
Expand Down Expand Up @@ -150,14 +150,14 @@ export fn TIC() void {
}
}

// -- Update
// -- Update
var i: u32 = 0;
while (i < bunnyCount) {
bunnies[i].update();
i += 1;
}

// -- Draw
// -- Draw
tic.cls(15);
i = 0;
while (i < bunnyCount) {
Expand Down
2 changes: 1 addition & 1 deletion demos/wasm/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void {
const target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
const exe = b.addExecutable(.{
.name = "cart",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
Expand Down
22 changes: 9 additions & 13 deletions demos/wasm/src/main.zig
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
const tic = @import("tic80.zig");

const TICGuy = struct {
x : i32 = 96,
y : i32 = 24,
x: i32 = 96,
y: i32 = 24,
};

var t : u16 = 0;
var mascot : TICGuy = .{};
var t: u16 = 0;
var mascot: TICGuy = .{};

export fn BOOT() void {}

export fn TIC() void {
tic.sync(.{
.sections = .{.tiles = true},
.bank = 1,
.toCartridge = true
});
tic.sync(.{ .sections = .{ .tiles = true }, .bank = 1, .toCartridge = true });

if (tic.btn(0)) {
mascot.y -= 1;
}
if (tic.btn(1)) {
mascot.y +=1;
mascot.y += 1;
}
if (tic.btn(2)) {
mascot.x -= 1;
Expand All @@ -31,17 +27,17 @@ export fn TIC() void {
}

tic.cls(13);
tic.spr(@as(i32, 1+t%60/30*2),mascot.x,mascot.y,.{
tic.spr(@as(i32, 1 + t % 60 / 30 * 2), mascot.x, mascot.y, .{
.transparent = &.{14},
.scale = 3,
.w = 2,
.h = 2,
});
_ = tic.print("HELLO WORLD!", 84, 84, .{.fixed = true});
_ = tic.print("HELLO WORLD!", 84, 84, .{ .fixed = true });

t += 1;
}

export fn BDR() void {}

export fn OVR() void {}
export fn OVR() void {}
2 changes: 1 addition & 1 deletion templates/zig/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ZIG Starter Project Template

This is a ZIG / TIC-80 starter template. To build it, ensure you have the latest development release (`0.12.0-dev.2727+fad5e7a99` or newer), then run:
This is a ZIG / TIC-80 starter template. To build it, ensure you have the latest development release (`0.14.0-dev.1421+f87dd43c1` or newer), then run:

```
zig build --release=small
Expand Down
2 changes: 1 addition & 1 deletion templates/zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void {
const target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
const exe = b.addExecutable(.{
.name = "cart",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
Expand Down
2 changes: 1 addition & 1 deletion templates/zig/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ export fn TIC() void {

export fn BDR() void {}

export fn OVR() void {}
export fn OVR() void {}
Loading