diff options
author | alaric <alaric@netmythos.org> | 2024-03-30 20:51:32 -0700 |
---|---|---|
committer | alaric <alaric@netmythos.org> | 2024-03-30 20:51:32 -0700 |
commit | 44707d7f05a1f219dc748d6bbb442e4f121664db (patch) | |
tree | ab5085b4142e6d3ed7e5e9cd783f91bb8b3388eb | |
parent | 71184c20f394ed447f878815bc9546490e3afec5 (diff) | |
download | colordots-44707d7f05a1f219dc748d6bbb442e4f121664db.tar.gz colordots-44707d7f05a1f219dc748d6bbb442e4f121664db.zip |
Ready to Upload I think
-rw-r--r-- | assets/awa.wav | bin | 90008 -> 0 bytes | |||
-rw-r--r-- | assets/jellybee.png | bin | 267623 -> 0 bytes | |||
-rw-r--r-- | assets/luminary.ogg | bin | 2590000 -> 0 bytes | |||
-rw-r--r-- | build.zig | 11 | ||||
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | src/shell.html | 23 | ||||
-rw-r--r-- | src/wasm_cdots.zig (renamed from src/wasm_ttd.zig) | 0 | ||||
-rw-r--r-- | src/webgl.js | 2 |
8 files changed, 20 insertions, 18 deletions
diff --git a/assets/awa.wav b/assets/awa.wav Binary files differdeleted file mode 100644 index dc1f088..0000000 --- a/assets/awa.wav +++ /dev/null diff --git a/assets/jellybee.png b/assets/jellybee.png Binary files differdeleted file mode 100644 index 1d1039f..0000000 --- a/assets/jellybee.png +++ /dev/null diff --git a/assets/luminary.ogg b/assets/luminary.ogg Binary files differdeleted file mode 100644 index 865fe9f..0000000 --- a/assets/luminary.ogg +++ /dev/null @@ -9,15 +9,10 @@ pub fn build(b: *std.Build) void { b.installFile("src/shell.html", "index.html"); b.installFile("src/webgl.js", "webgl.js"); - b.installDirectory(.{ - .source_dir = .{ .path = "assets" }, - .install_dir = .prefix, - .install_subdir = "assets", - }); const exe = b.addExecutable(.{ - .name = "tiny-td", - .root_source_file = .{ .path = "src/wasm_ttd.zig" }, + .name = "cdots", + .root_source_file = .{ .path = "src/wasm_cdots.zig" }, .target = target, .optimize = optimize, }); @@ -30,7 +25,7 @@ pub fn build(b: *std.Build) void { b.installArtifact(exe); const exe_unit_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/wasm_ttd.zig" }, + .root_source_file = .{ .path = "src/wasm_cdots.zig" }, .target = target, .optimize = optimize, }); @@ -1,5 +1,5 @@ { - description = "The flake for Tiny Tower Defense"; + description = "The flake for Color Dots"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; diff --git a/src/shell.html b/src/shell.html index 3013360..d4f5c85 100644 --- a/src/shell.html +++ b/src/shell.html @@ -3,23 +3,30 @@ <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <title>Tiny Tower Defense</title> + <title>Color Dots</title> <style> body { - margin: 32; overflow: hidden; + min-height: 720px; + min-width: 1280px; + display: flex; + flex-direction: column; + margin: 0; } - #ttd-canvas { - width: 1280px; - height: 720px; - border: solid 1px; + #app-canvas { + display: flex; + flex-grow: 1; + width: 100%; + height: 100%; } </style> </head> <body> - <canvas id="ttd-canvas" width="1280" height="720" tabindex="0"></canvas> + <canvas id="app-canvas" tabindex="0"></canvas> <script src="webgl.js"></script> <script> + canvas.width = canvas.clientWidth; + canvas.height = canvas.clientHeight; let memory = null; let last_frame_time = Date.now(); @@ -105,7 +112,7 @@ }, }; - WebAssembly.instantiateStreaming(fetch("bin/tiny-td.wasm"), importObject).then( + WebAssembly.instantiateStreaming(fetch("bin/cdots.wasm"), importObject).then( (obj) => { memory = obj.instance.exports.memory; obj.instance.exports.init(); diff --git a/src/wasm_ttd.zig b/src/wasm_cdots.zig index 967bb7c..967bb7c 100644 --- a/src/wasm_ttd.zig +++ b/src/wasm_cdots.zig diff --git a/src/webgl.js b/src/webgl.js index 5c55de0..572773c 100644 --- a/src/webgl.js +++ b/src/webgl.js @@ -1,4 +1,4 @@ -const canvas = document.getElementById("ttd-canvas"); +const canvas = document.getElementById("app-canvas"); const gfx_ctx = canvas.getContext("webgl2"); if (gfx_ctx === null) { alert("There was a problem initializing WebGL. Your browser or machine may not support it."); |