From 72117528469b5b4e0ef7db25faa399055c9d6e4a Mon Sep 17 00:00:00 2001 From: Fabio Arnold Date: Mon, 3 Jul 2023 20:58:05 +0200 Subject: [PATCH] Update to Zig master --- ProcessAssetsStep.zig | 11 ++++++----- src/Enemy.zig | 2 +- src/Entity.zig | 2 +- src/Player.zig | 4 ++-- src/Renderer.zig | 42 +++++++++++++++++++++--------------------- src/Room.zig | 26 +++++++++++++------------- src/Stage.zig | 2 +- src/Tile.zig | 2 +- src/keys.zig | 2 +- src/main.zig | 26 +++++++++++++------------- src/web.zig | 6 +++--- src/webgl.zig | 8 ++++---- webserver.zig | 4 ++-- 13 files changed, 69 insertions(+), 68 deletions(-) diff --git a/ProcessAssetsStep.zig b/ProcessAssetsStep.zig index 1c8522b..2cf3bc8 100644 --- a/ProcessAssetsStep.zig +++ b/ProcessAssetsStep.zig @@ -80,10 +80,9 @@ fn loadJson(comptime T: type, path: []const u8, allocator: std.mem.Allocator) !T const file = try std.fs.cwd().openFile(path, .{}); defer file.close(); const file_contents = try file.readToEndAlloc(allocator, max_file_size); - defer allocator.free(file_contents); - return std.json.parseFromSlice(T, allocator, file_contents, .{ + return (try std.json.parseFromSlice(T, allocator, file_contents, .{ .ignore_unknown_fields = true, - }); + })).value; } fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void { @@ -110,12 +109,14 @@ fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void { try writer.print("pub const {s} = Stage{{\n", .{stage.name}); try writer.writeAll(" .rooms = &[_]Room{\n"); + std.debug.print("Processing stage {s}\n", .{stage.path}); const world = try loadJson(WorldJson, stage.path, allocator); for (world.maps) |world_map| { const map_path = if (std.fs.path.dirname(stage.path)) |path| try std.fs.path.join(allocator, &.{ path, world_map.fileName }) else world_map.fileName; + std.debug.print("Processing map {s}\n", .{map_path}); const map = try loadJson(MapJson, map_path, allocator); try writer.writeAll(" Room{\n"); @@ -131,7 +132,7 @@ fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void { if (layer.data) |data| { try writer.writeAll(" .data = &[_]u8{"); for (data, 0..) |d, i| { - if (i % @intCast(usize, map.width) == 0) { + if (i % @as(usize, @intCast(map.width)) == 0) { try writer.writeAll("\n "); } try writer.print("{d}, ", .{d - 1}); @@ -179,7 +180,7 @@ fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void { } try writer.writeAll(" .attribs = &[_]Tile.Attrib{"); for (attribs, 0..) |a, i| { - if (i % @intCast(usize, tileset.columns) == 0) { + if (i % @as(usize, @intCast(tileset.columns)) == 0) { try writer.writeAll("\n "); } try writer.print(".{s}, ", .{a}); diff --git a/src/Enemy.zig b/src/Enemy.zig index a95c9fd..6c8dfac 100644 --- a/src/Enemy.zig +++ b/src/Enemy.zig @@ -64,7 +64,7 @@ const GopherState = enum(u8) { fn tickGopher(self: *Self, r: std.rand.Random, game: *GameData, attribs: []const Attrib) void { const room = game.getCurrentRoom(); - const state = @ptrCast(*GopherState, &self.state); + const state: *GopherState = @ptrCast(&self.state); switch (state.*) { .idle => { self.frame = 0; diff --git a/src/Entity.zig b/src/Entity.zig index c1bf8d1..713f31d 100644 --- a/src/Entity.zig +++ b/src/Entity.zig @@ -9,4 +9,4 @@ pub const Class = enum { }; class: Class, -box: Box, \ No newline at end of file +box: Box, diff --git a/src/Player.zig b/src/Player.zig index 167a5bb..9a35a77 100644 --- a/src/Player.zig +++ b/src/Player.zig @@ -145,9 +145,9 @@ pub fn draw(self: *Player) void { else => unreachable, }; src_rect.w = if (use_joys_sprite) 24 else 32; - src_rect.x = 48 + @intCast(i32, frame) * src_rect.w; + src_rect.x = 48 + @as(i32, @intCast(frame)) * src_rect.w; }, - .jumping => src_rect = if (use_joys_sprite) Rect.init(144 + @intCast(i32, (self.anim_time % 20) / 10) * 24, 0, 24, 32) else Rect.init(176, 0, 32, 32), + .jumping => src_rect = if (use_joys_sprite) Rect.init(144 + @as(i32, @intCast((self.anim_time % 20) / 10)) * 24, 0, 24, 32) else Rect.init(176, 0, 32, 32), .climbing => { src_rect = if (use_joys_sprite) Rect.init(216, 0, 24, 32) else Rect.init(240, 0, 16, 32); flip_x = @mod(self.box.y, 20) < 10; diff --git a/src/Renderer.zig b/src/Renderer.zig index 4d502c4..1f50808 100644 --- a/src/Renderer.zig +++ b/src/Renderer.zig @@ -110,7 +110,7 @@ pub const Texture = struct { pub const Sprite = struct { pub fn draw(sprite: Texture, x: i32, y: i32) void { - const src_rect = Rect.init(0, 0, @intCast(i32, sprite.width), @intCast(i32, sprite.height)); + const src_rect = Rect.init(0, 0, @intCast(sprite.width), @intCast(sprite.height)); const dst_rect = Rect.init(x, y, src_rect.w, src_rect.h); drawFromTo(sprite, src_rect, dst_rect); } @@ -121,10 +121,10 @@ pub const Sprite = struct { } pub fn drawFromTo(sprite: Texture, src_rect: Rect, dst_rect: Rect) void { - const x = @intToFloat(f32, dst_rect.x - scroll.x); - const y = @intToFloat(f32, dst_rect.y - scroll.y); - const w = @intToFloat(f32, dst_rect.w); - const h = @intToFloat(f32, dst_rect.h); + const x: f32 = @floatFromInt(dst_rect.x - scroll.x); + const y: f32 = @floatFromInt(dst_rect.y - scroll.y); + const w: f32 = @floatFromInt(dst_rect.w); + const h: f32 = @floatFromInt(dst_rect.h); const px: f32 = 2.0 / @as(f32, fb_width); const py: f32 = 2.0 / @as(f32, fb_height); const mvp = [16]f32{ @@ -136,13 +136,13 @@ pub const Sprite = struct { gl.glUseProgram(blit2d.program); gl.glUniformMatrix4fv(blit2d.mvp_loc, 1, gl.GL_FALSE, &mvp); - const sx = 1.0 / @intToFloat(f32, sprite.width); - const sy = 1.0 / @intToFloat(f32, sprite.height); + const sx = 1.0 / @as(f32, @floatFromInt(sprite.width)); + const sy = 1.0 / @as(f32, @floatFromInt(sprite.height)); const texmat = [16]f32{ - @intToFloat(f32, src_rect.w) * sx, 0, 0, 0, - 0, @intToFloat(f32, src_rect.h) * sy, 0, 0, - 0, 0, 1, 0, - @intToFloat(f32, src_rect.x) * sx, @intToFloat(f32, src_rect.y) * sy, 0, 1, + @as(f32, @floatFromInt(src_rect.w)) * sx, 0, 0, 0, + 0, @as(f32, @floatFromInt(src_rect.h)) * sy, 0, 0, + 0, 0, 1, 0, + @as(f32, @floatFromInt(src_rect.x)) * sx, @as(f32, @floatFromInt(src_rect.y)) * sy, 0, 1, }; gl.glUniformMatrix4fv(blit2d.texmat_loc, 1, gl.GL_FALSE, &texmat); gl.glBindTexture(gl.GL_TEXTURE_2D, sprite.handle); @@ -152,10 +152,10 @@ pub const Sprite = struct { pub const Tilemap = struct { pub fn draw(map: Texture, tiles: Texture, rect: Rect) void { - const x = @intToFloat(f32, rect.x - scroll.x); - const y = @intToFloat(f32, rect.y - scroll.y); - const w = @intToFloat(f32, rect.w); - const h = @intToFloat(f32, rect.h); + const x: f32 = @floatFromInt(rect.x - scroll.x); + const y: f32 = @floatFromInt(rect.y - scroll.y); + const w: f32 = @floatFromInt(rect.w); + const h: f32 = @floatFromInt(rect.h); const px = 2.0 / @as(f32, fb_width); const py: f32 = 2.0 / @as(f32, fb_height); const mvp = [16]f32{ @@ -168,9 +168,9 @@ pub const Tilemap = struct { gl.glUniformMatrix4fv(tiled.mvp_loc, 1, gl.GL_FALSE, &mvp); gl.glUniformMatrix4fv(tiled.texmat_loc, 1, gl.GL_FALSE, &identity_matrix); gl.glUniform1i(tiled.map_loc, 0); - gl.glUniform2f(tiled.map_size_loc, @intToFloat(f32, map.width), @intToFloat(f32, map.height)); + gl.glUniform2f(tiled.map_size_loc, @floatFromInt(map.width), @floatFromInt(map.height)); gl.glUniform1i(tiled.tiles_loc, 1); - gl.glUniform2f(tiled.tiles_size_loc, @intToFloat(f32, tiles.width), @intToFloat(f32, tiles.height)); + gl.glUniform2f(tiled.tiles_size_loc, @floatFromInt(tiles.width), @floatFromInt(tiles.height)); gl.glActiveTexture(gl.GL_TEXTURE1); gl.glBindTexture(gl.GL_TEXTURE_2D, tiles.handle); @@ -182,10 +182,10 @@ pub const Tilemap = struct { pub const Debug = struct { pub fn drawRect(rect: Rect, color: Color) void { - const x = @intToFloat(f32, rect.x - scroll.x); - const y = @intToFloat(f32, rect.y - scroll.y); - const w = @intToFloat(f32, rect.w); - const h = @intToFloat(f32, rect.h); + const x: f32 = @floatFromInt(rect.x - scroll.x); + const y: f32 = @floatFromInt(rect.y - scroll.y); + const w: f32 = @floatFromInt(rect.w); + const h: f32 = @floatFromInt(rect.h); const px = 2.0 / @as(f32, fb_width); const py: f32 = 2.0 / @as(f32, fb_height); const mvp = [16]f32{ diff --git a/src/Room.zig b/src/Room.zig index 9886930..228e7ed 100644 --- a/src/Room.zig +++ b/src/Room.zig @@ -35,10 +35,10 @@ pub fn clipX(self: Room, attribs: []const Tile.Attrib, mover: Box, amount: i32) else Box{ .x = box.x + clipped, .y = box.y, .w = -clipped, .h = box.h }; - const start_x = @intCast(u16, std.math.clamp(@divTrunc(area.x, Tile.size), 0, self.width - 1)); - const stop_x = @intCast(u16, std.math.clamp(@divTrunc(area.x + area.w - 1, Tile.size), 0, self.width - 1)); - const start_y = @intCast(u16, std.math.clamp(@divTrunc(area.y, Tile.size), 0, self.height - 1)); - const stop_y = @intCast(u16, std.math.clamp(@divTrunc(area.y + area.h - 1, Tile.size), 0, self.height - 1)); + const start_x: u16 = @intCast(std.math.clamp(@divTrunc(area.x, Tile.size), 0, self.width - 1)); + const stop_x: u16 = @intCast(std.math.clamp(@divTrunc(area.x + area.w - 1, Tile.size), 0, self.width - 1)); + const start_y: u16 = @intCast(std.math.clamp(@divTrunc(area.y, Tile.size), 0, self.height - 1)); + const stop_y: u16 = @intCast(std.math.clamp(@divTrunc(area.y + area.h - 1, Tile.size), 0, self.height - 1)); var y = start_y; while (y <= stop_y) : (y += 1) { @@ -69,10 +69,10 @@ pub fn clipY(self: Room, attribs: []const Tile.Attrib, mover: Box, amount: i32) else Box{ .x = box.x, .y = box.y + clipped, .w = box.w, .h = -clipped }; - const start_x = @intCast(u16, std.math.clamp(@divTrunc(area.x, Tile.size), 0, self.width - 1)); - const stop_x = @intCast(u16, std.math.clamp(@divTrunc(area.x + area.w - 1, Tile.size), 0, self.width - 1)); - const start_y = @intCast(u16, std.math.clamp(@divTrunc(area.y, Tile.size), 0, self.height - 1)); - const stop_y = @intCast(u16, std.math.clamp(@divTrunc(area.y + area.h - 1, Tile.size), 0, self.height - 1)); + const start_x: u16 = @intCast(std.math.clamp(@divTrunc(area.x, Tile.size), 0, self.width - 1)); + const stop_x: u16 = @intCast(std.math.clamp(@divTrunc(area.x + area.w - 1, Tile.size), 0, self.width - 1)); + const start_y: u16 = @intCast(std.math.clamp(@divTrunc(area.y, Tile.size), 0, self.height - 1)); + const stop_y: u16 = @intCast(std.math.clamp(@divTrunc(area.y + area.h - 1, Tile.size), 0, self.height - 1)); var y = start_y; while (y <= stop_y) : (y += 1) { @@ -99,10 +99,10 @@ pub fn overlap(self: Room, attribs: []const Tile.Attrib, mover: Box) bool { // move mover into room space const box = Box{ .x = mover.x - self.bounds.x, .y = mover.y - self.bounds.y, .w = mover.w, .h = mover.h }; - const start_x = @intCast(u16, std.math.clamp(@divTrunc(box.x, Tile.size), 0, self.width - 1)); - const stop_x = @intCast(u16, std.math.clamp(@divTrunc(box.x + box.w - 1, Tile.size), 0, self.width - 1)); - const start_y = @intCast(u16, std.math.clamp(@divTrunc(box.y, Tile.size), 0, self.height - 1)); - const stop_y = @intCast(u16, std.math.clamp(@divTrunc(box.y + box.h - 1, Tile.size), 0, self.height - 1)); + const start_x: u16 = @intCast(std.math.clamp(@divTrunc(box.x, Tile.size), 0, self.width - 1)); + const stop_x: u16 = @intCast(std.math.clamp(@divTrunc(box.x + box.w - 1, Tile.size), 0, self.width - 1)); + const start_y: u16 = @intCast(std.math.clamp(@divTrunc(box.y, Tile.size), 0, self.height - 1)); + const stop_y: u16 = @intCast(std.math.clamp(@divTrunc(box.y + box.h - 1, Tile.size), 0, self.height - 1)); var y = start_y; while (y <= stop_y) : (y += 1) { @@ -128,6 +128,6 @@ pub fn getTileAttribAtPixel(self: Room, attribs: []const Tile.Attrib, x: i32, y: fn getTileAttribAtTile(self: Room, attribs: []const Tile.Attrib, tx: i32, ty: i32) Tile.Attrib { if (tx < 0 or ty < 0 or tx >= self.width or ty >= self.height) return .none; - const ti = self.data[@intCast(usize, ty * self.width + tx)]; + const ti = self.data[@as(usize, @intCast(ty * self.width + tx))]; return attribs[ti]; } diff --git a/src/Stage.zig b/src/Stage.zig index 3ed7652..d79a4f3 100644 --- a/src/Stage.zig +++ b/src/Stage.zig @@ -2,4 +2,4 @@ const Tile = @import("Tile.zig"); const Room = @import("Room.zig"); rooms: []const Room, -attribs: []const Tile.Attrib, \ No newline at end of file +attribs: []const Tile.Attrib, diff --git a/src/Tile.zig b/src/Tile.zig index 7d24f3a..531fb00 100644 --- a/src/Tile.zig +++ b/src/Tile.zig @@ -4,4 +4,4 @@ pub const Attrib = enum(u8) { ladder, }; -pub const size = 16; \ No newline at end of file +pub const size = 16; diff --git a/src/keys.zig b/src/keys.zig index 0f6adc8..dd585de 100644 --- a/src/keys.zig +++ b/src/keys.zig @@ -96,4 +96,4 @@ pub const KEY_BACKQUOTE = 192; pub const KEY_BRACKET_LEFT = 219; pub const KEY_BACKSLASH = 220; pub const KEY_BRAKET_RIGHT = 221; -pub const KEY_QUOTE = 22; \ No newline at end of file +pub const KEY_QUOTE = 22; diff --git a/src/main.zig b/src/main.zig index b5eb877..7e9487c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -144,9 +144,9 @@ pub const GameData = struct { var fba = std.heap.FixedBufferAllocator.init(&buffer); const allocator = fba.allocator(); const value = web.LocalStorage.getString("snapshot"); - self.* = std.json.parseFromSlice(GameData, allocator, value, .{ + self.* = (std.json.parseFromSlice(GameData, allocator, value, .{ .ignore_unknown_fields = true, - }) catch unreachable; + }) catch return).value; uploadRoomTexture(&cur_room_tex, self.getCurrentRoom()); // FIXME } @@ -220,7 +220,7 @@ pub const GameData = struct { fn doLtrDoorTransition(self: *GameData) void { mode_frame += 1; if (mode_frame <= door_duration) { - self.door1_h = 4 - @intCast(u8, @divTrunc(4 * mode_frame, door_duration)); + self.door1_h = 4 - @as(u8, @intCast(@divTrunc(4 * mode_frame, door_duration))); } else if (mode_frame <= door_duration + 64) { self.player.tick(); const cur_room = cur_stage.rooms[self.cur_room_index]; @@ -228,7 +228,7 @@ pub const GameData = struct { self.scrollr.x = cur_room.bounds.x - screen_width + @divTrunc((mode_frame - door_duration) * screen_width, 64); self.player.box.x = cur_room.bounds.x - 2 * self.player.box.w + @divTrunc(3 * self.player.box.w * (mode_frame - door_duration), 64); } else if (mode_frame <= door_duration + 64 + door_duration) { - self.door1_h = @intCast(u8, @divTrunc(4 * (mode_frame - 64 - door_duration), door_duration)); + self.door1_h = @intCast(@divTrunc(4 * (mode_frame - 64 - door_duration), door_duration)); } if (mode_frame == door_duration + 64 + door_duration) { room_transition = .none; @@ -238,7 +238,7 @@ pub const GameData = struct { fn doRtlDoorTransition(self: *GameData) void { mode_frame += 1; if (mode_frame <= door_duration) { - self.door2_h = 4 - @intCast(u8, @divTrunc(4 * mode_frame, door_duration)); + self.door2_h = 4 - @as(u8, @intCast(@divTrunc(4 * mode_frame, door_duration))); } else if (mode_frame <= door_duration + 64) { self.player.tick(); // const cur_room = cur_stage.rooms[self.cur_room_index]; @@ -246,7 +246,7 @@ pub const GameData = struct { self.scrollr.x = prev_room.bounds.x - @divTrunc((mode_frame - door_duration) * screen_width, 64); self.player.box.x = prev_room.bounds.x + self.player.box.w - @divTrunc(3 * self.player.box.w * (mode_frame - door_duration), 64); } else if (mode_frame <= door_duration + 64 + door_duration) { - self.door2_h = @intCast(u8, @divTrunc(4 * (mode_frame - 64 - door_duration), door_duration)); + self.door2_h = @intCast(@divTrunc(4 * (mode_frame - 64 - door_duration), door_duration)); } if (mode_frame == door_duration + 64 + door_duration) { room_transition = .none; @@ -305,7 +305,7 @@ pub const GameData = struct { if (cur_room.door1_y != Room.no_door) { var door_box = Box{ .x = cur_room.bounds.x, - .y = cur_room.bounds.y + @intCast(i32, cur_room.door1_y) * Tile.size, + .y = cur_room.bounds.y + @as(i32, @intCast(cur_room.door1_y)) * Tile.size, .w = Tile.size, .h = 4 * Tile.size, }; @@ -323,7 +323,7 @@ pub const GameData = struct { if (cur_room.door2_y != Room.no_door) { var door_box = Box{ .x = cur_room.bounds.x + cur_room.bounds.w - Tile.size, - .y = cur_room.bounds.y + @intCast(i32, cur_room.door2_y) * Tile.size, + .y = cur_room.bounds.y + @as(i32, @intCast(cur_room.door2_y)) * Tile.size, .w = Tile.size, .h = 4 * Tile.size, }; @@ -462,15 +462,15 @@ fn setNextRoom(next_room_index: u8) void { var death_frame_counter: u32 = 0; fn drawDeathEffect(x: i32, y: i32) void { - const frame = @intCast(i32, (death_frame_counter / 3) % 6); + const frame = @as(i32, @intCast((death_frame_counter / 3) % 6)); const src_rect = Rect.init(frame * 24, 0, 24, 24); var i: usize = 0; while (i < 8) : (i += 1) { - const angle: f32 = std.math.pi * @intToFloat(f32, i) / 4.0; - const r: f32 = 2 * @intToFloat(f32, death_frame_counter); - const dx = x + @floatToInt(i32, r * @cos(angle)); - const dy = y + @floatToInt(i32, r * @sin(angle)); + const angle: f32 = std.math.pi * @as(f32, @floatFromInt(i)) / 4.0; + const r: f32 = 2 * @as(f32, @floatFromInt(death_frame_counter)); + const dx = x + @as(i32, @intFromFloat(r * @cos(angle))); + const dy = y + @as(i32, @intFromFloat(r * @sin(angle))); Sprite.drawFrame(effects_tex, src_rect, dx, dy); } diff --git a/src/web.zig b/src/web.zig index 6a0acd2..5b36140 100644 --- a/src/web.zig +++ b/src/web.zig @@ -19,7 +19,7 @@ pub fn log( }; const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): "; - const writer = std.io.Writer(void, error{}, writeLog){.context = {}}; + const writer = std.io.Writer(void, error{}, writeLog){ .context = {} }; writer.print(level_txt ++ prefix ++ format ++ "\n", args) catch return; jsLogFlush(); @@ -29,11 +29,11 @@ var sbuf: [4000]u8 = undefined; // FIXME pub const LocalStorage = struct { pub fn setString(key: []const u8, value: []const u8) void { - jsStorageSetString(@ptrToInt(key.ptr), key.len, @ptrToInt(value.ptr), value.len); + jsStorageSetString(@intFromPtr(key.ptr), key.len, @intFromPtr(value.ptr), value.len); } pub fn getString(key: []const u8) []const u8 { - const len = jsStorageGetString(@ptrToInt(key.ptr), key.len, @ptrToInt(&sbuf), sbuf.len); + const len = jsStorageGetString(@intFromPtr(key.ptr), key.len, @intFromPtr(&sbuf), sbuf.len); return sbuf[0..len]; } }; diff --git a/src/webgl.zig b/src/webgl.zig index cc30fdb..4017d5b 100644 --- a/src/webgl.zig +++ b/src/webgl.zig @@ -7,11 +7,11 @@ pub const GLfloat = f32; pub const GLclampf = f32; // Shaders -pub extern fn glInitShader(source: [*c]const u8 , len: usize, type: c_uint) c_uint; +pub extern fn glInitShader(source: [*c]const u8, len: usize, type: c_uint) c_uint; pub extern fn glLinkShaderProgram(vertexShaderId: c_uint, fragmentShaderId: c_uint) c_uint; // Textures -pub extern fn glTexImage2DUrl(texture: GLuint, url: [*]const u8 , len: usize) void; +pub extern fn glTexImage2DUrl(texture: GLuint, url: [*]const u8, len: usize) void; // GL pub extern fn glViewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei) void; @@ -52,7 +52,7 @@ pub extern fn glDeleteTextures(n: GLsizei, textures: [*c]const GLuint) void; pub extern fn glDeleteTexture(texture: GLuint) void; pub extern fn glBindTexture(target: GLenum, texture: GLuint) void; pub extern fn glTexImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, data: [*c]const u8, data_len: usize) void; -pub extern fn glTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset:GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, data: [*c]const u8) void; +pub extern fn glTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, data: [*c]const u8) void; pub extern fn glTexParameteri(target: GLenum, pname: GLenum, param: GLint) void; pub extern fn glActiveTexture(texture: GLenum) void; pub extern fn glGenFramebuffers(_: c_int, _: [*c]c_uint) void; @@ -99,4 +99,4 @@ pub const GL_STATIC_DRAW: c_uint = 35044; pub const GL_FRAGMENT_SHADER: c_uint = 35632; pub const GL_VERTEX_SHADER: c_uint = 35633; pub const GL_FRAMEBUFFER = 36160; -pub const GL_COLOR_ATTACHMENT0 = 36064; \ No newline at end of file +pub const GL_COLOR_ATTACHMENT0 = 36064; diff --git a/webserver.zig b/webserver.zig index bba2c3a..e7a9f0a 100644 --- a/webserver.zig +++ b/webserver.zig @@ -46,7 +46,7 @@ fn index(ctx: Context, response: *http.Response, request: http.Request) !void { defer arena.deinit(); const result = std.ChildProcess.exec(.{ .allocator = arena.allocator(), - .argv = &[_][]const u8 { + .argv = &[_][]const u8{ "zig", "build", "wasm", }, .cwd = ctx.repo_root, @@ -66,7 +66,7 @@ fn index(ctx: Context, response: *http.Response, request: http.Request) !void { \\{s}{s}{s} \\-------------------------------------------------------------------------------- \\ - , .{result.stdout, sep, result.stderr}); + , .{ result.stdout, sep, result.stderr }); return; } }