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
const std = @import("std"); | |
pub fn build(b: *std.Build) void { | |
const exe = b.addExecutable(.{ | |
.name = "cart", | |
.root_source_file = .{ .path = "src/main.zig" }, | |
.target = .{ .cpu_arch = .wasm32, .os_tag = .wasi }, | |
.optimize = .ReleaseSmall, | |
}); |
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
zig-cache | |
bin |
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
const tic = @import("tic"); | |
fn pp(c: u8) void { | |
var m: tic.MouseData = .{}; | |
tic.mouse(&m); | |
if (m.left) { | |
const x = m.x - 1; | |
const y = m.y - 1; |
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
const tic = @import("tic80.zig"); | |
const Rainbow = struct { | |
red: u8 = 255, | |
grn: u8 = 0, | |
blu: u8 = 0, | |
cyRG: bool = true, | |
cyGB: bool = false, | |
cyBR: bool = false, |
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
const math = @import("std").math; | |
const tic = @import("tic80.zig"); | |
export fn BDR(row: i32) void { | |
const urow: u8 = @intCast(row); | |
{ // skygradient | |
scanline(0x42, 0xFF -| urow, 0x99 +| urow); | |
} |
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
const math = @import("std").math; | |
const tic = @import("tic80.zig"); | |
fn drawCable(p1: [2]f32, p2: [2]f32, max_sag: f32, color: i32) [2]f32 { | |
const dx = p2[0] - p1[0]; | |
const dy = p2[1] - p1[1]; | |
const length = math.sqrt(dx * dx + dy * dy); | |
const sag = @max(length / max_sag, max_sag); | |
const midpoint: [2]f32 = .{ | |
(p1[0] + p2[0]) / 2, |
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
// | |
// MicroW8: https://exoticorn.github.io/microw8/docs/ | |
// ┌───────────────────────────────────────────────────────────────────────────┐ | |
// │ │ | |
// │ Platform Constants │ | |
// │ │ | |
// └───────────────────────────────────────────────────────────────────────────┘ | |
pub const SCREEN_WIDTH: u32 = 320; |
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
const std = @import("std"); | |
pub fn build(b: *std.Build) void { | |
const exe = b.addExecutable(.{ | |
.name = "cart", | |
.root_source_file = .{ .path = "src/main.zig" }, | |
.target = .{ | |
.cpu_arch = .wasm32, | |
.os_tag = .freestanding, | |
.cpu_features_add = std.Target.wasm.featureSet(&.{.nontrapping_fptoint}), |
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
package main | |
import ( | |
"context" | |
"crypto/rand" | |
"encoding/hex" | |
"fmt" | |
"html/template" | |
"net/http" | |
"os" |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"os" | |
"strings" | |
_ "embed" |
NewerOlder