Skip to content

Commit

Permalink
Fix intro, remove samples dir (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperAuguste authored May 19, 2024
1 parent 5b6c2cd commit 58a59a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
16 changes: 2 additions & 14 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,12 @@ pub fn build(b: *Build) void {
const feature_test_cart = add_cart(&dep, b, .{
.name = "feature_test",
.optimize = optimize,
.root_source_file = b.path("samples/feature_test.zig"),
.root_source_file = b.path("src/badge/feature_test.zig"),
});
feature_test_cart.install(b);
const watch_run_step = feature_test_cart.install_with_watcher(&dep, b, .{});

//{
// const cart = add_cart(&dep, b, .{
// .name = "blobs",
// .optimize = .ReleaseSmall,
// .root_source_file = .{ .path = "samples/blobs/blobs.zig" },
// });
// cart.install(b);
// b.step("watch-blobs", "Watch/run blobs in the simulator").dependOn(
// &cart.install_with_watcher(&dep, b, .{}).step,
// );
//}

const watch_step = b.step("watch", "");
const watch_step = b.step("feature-test", "");
watch_step.dependOn(&watch_run_step.step);

inline for (.{
Expand Down
4 changes: 2 additions & 2 deletions docs/introduction/src/hello.zig
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ fn scene_game() void {
fn set_background() void {
const ratio = (4095 - @as(f32, @floatFromInt(cart.light_level.*))) / 4095 * 0.2;

@memset(cart.framebuffer, cart.DisplayColor{
@memset(@as(*volatile [cart.screen_width * cart.screen_height]cart.Pixel, @ptrCast(cart.framebuffer)), cart.Pixel.fromColor(.{
.r = @intFromFloat(ratio * 31),
.g = @intFromFloat(ratio * 63),
.b = @intFromFloat(ratio * 31),
});
}));
}

fn check_win() bool {
Expand Down
2 changes: 2 additions & 0 deletions samples/feature_test.zig → src/badge/feature_test.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Test all features at once!

const std = @import("std");
const cart = @import("cart-api");

Expand Down
2 changes: 2 additions & 0 deletions src/cart/api.zig
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ pub const Pixel = extern struct {
pub fn fromColor(color: DisplayColor) Pixel {
return .{ .bits = @byteSwap(@as(u16, @bitCast(color))) };
}

pub fn toColor(pixel: Pixel) DisplayColor {
return @bitCast(@byteSwap(pixel.bits));
}

pub fn setColor(pixel: *volatile Pixel, color: DisplayColor) void {
pixel.* = fromColor(color);
}
Expand Down

0 comments on commit 58a59a8

Please sign in to comment.