Skip to content
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install packages
run: |
sudo apt update
sudo apt install libglfw3 libglfw3-dev libatk1.0-0 libgtk-3-dev libglib2.0-dev
sudo apt install libgtk-3-dev libxcb-xkb-dev libxcb-render-util0-dev libxkbcommon-x11-dev
- name: Install Zig
uses: mlugg/setup-zig@v2
- name: Install Vulkan SDK
Expand Down
2 changes: 1 addition & 1 deletion assets/resources.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
GLFW_ICON ICON DISCARDABLE "icon.ico"
WINDY_ICON ICON DISCARDABLE "icon.ico"
11 changes: 6 additions & 5 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ fn buildClient(
const shared_dep = b.dependency("shared", .{ .target = target, .optimize = optimize });
const stbi_dep = b.dependency("stbi", .{ .target = target, .optimize = optimize });
const miniaudio_dep = b.dependency("miniaudio", .{ .target = target, .optimize = optimize });
const zd_dep = b.dependency("zig_dialog", .{ .target = target, .optimize = optimize });
const glfw_dep = b.dependency("glfw", .{ .target = target, .optimize = optimize });
const windy_dep = b.dependency("windy", .{
.target = target,
.optimize = optimize,
.vulkan_support = true,
});

inline for (.{ true, false }) |check| {
const exe = b.addExecutable(.{
Expand All @@ -89,10 +92,9 @@ fn buildClient(
.{ .name = "uv", .module = shared_dep.module("uv") },
.{ .name = "shared", .module = shared_dep.module("shared") },
.{ .name = "vulkan", .module = vulkan_dep.module("vulkan-zig") },
.{ .name = "glfw", .module = glfw_dep.module("root") },
.{ .name = "windy", .module = windy_dep.module("windy") },
.{ .name = "stbi", .module = stbi_dep.module("root") },
.{ .name = "miniaudio", .module = miniaudio_dep.module("root") },
.{ .name = "zd", .module = zd_dep.module("zig-dialog") },
.{
.name = "ziggy",
.module = b.dependency("ziggy", .{
Expand All @@ -114,7 +116,6 @@ fn buildClient(
exe.root_module.linkLibrary(shared_dep.artifact("libuv"));
exe.root_module.linkLibrary(stbi_dep.artifact("stbi"));
exe.root_module.linkLibrary(miniaudio_dep.artifact("miniaudio"));
exe.root_module.linkLibrary(glfw_dep.artifact("glfw"));

if (tracy)
addTracy(b, exe.root_module, shared_dep.path("src/tracy.zig"), target, optimize);
Expand Down
11 changes: 5 additions & 6 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@
// client deps
.miniaudio = .{ .path = "client/libs/miniaudio" },
.stbi = .{ .path = "client/libs/stbi" },
.glfw = .{ .path = "client/libs/glfw" },
.zig_dialog = .{
.url = "git+https://github.com/flut2/zig-dialog.git#b9bf10c89065a1df584513c1c77f3ed7b3e0e730",
.hash = "zig_dialog-0.1.0-XalyXbZiAACnOzEhJVyV07WbknFWxvBIHKqrRy367_Y3",
.windy = .{
.url = "git+https://github.com/flut2/windy.git#f82673f6dcbfc1d5c1e586d73613d1e7d332fdb1",
.hash = "windy-0.3.0-wLI1BB-3AQCF2OMnDCLDAUKfWt7bVY6BDtBH8jDroR9y",
},
.turbopack = .{
.url = "git+https://github.com/flut2/turbopack.git#d6995ce5a8f071bb759a274ac036dff65909905a",
.hash = "turbopack-1.0.0-rSxRjlofAAAoHGx7mg6pkzI3gEh-g9OQcnmF7_px6Sg7",
},
.vulkan_zig = .{
.url = "git+https://github.com/Snektron/vulkan-zig.git#93bc6f1ac3e13dd98d918e242dc892f179a0d0f5",
.hash = "vulkan-0.0.0-r7YtxwA_AwAU4rmOITZD_KJs11Kie1sv0t-pcMDQGIqw",
.url = "git+https://github.com/Snektron/vulkan-zig.git#1446b0b994c2362264cc24513d7c7ec31b469c50",
.hash = "vulkan-0.0.0-r7Ytx_VDAwAiMl0YSu2UOkVMIGJN7CeIQaxJR-hUSfD6",
},
.vma = .{
.url = "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/refs/tags/v3.3.0.tar.gz",
Expand Down
1 change: 1 addition & 0 deletions client/libs/windy
Submodule windy added at 039f79
8 changes: 4 additions & 4 deletions client/src/Settings.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const std = @import("std");
const builtin = @import("builtin");

const glfw = @import("glfw");
const windy = @import("windy");
const ziggy = @import("ziggy");

const assets = @import("assets.zig");
Expand All @@ -10,7 +10,7 @@ const main = @import("main.zig");
const Settings = @This();

pub const CursorType = enum { basic, royal, ranger, aztec, fiery, target_enemy, target_ally };
pub const Button = union(enum) { key: glfw.Key, mouse: glfw.MouseButton };
pub const Button = union(enum) { key: windy.Key, mouse: windy.MouseButton };

var arena: std.heap.ArenaAllocator = undefined;
pub var needs_char_id_dispose = false;
Expand All @@ -30,10 +30,10 @@ escape: Button = .{ .key = .tab },
chat_up: Button = .{ .key = .page_up },
chat_down: Button = .{ .key = .page_down },
walk: Button = .{ .key = .left_shift },
toggle_perf_stats: Button = .{ .key = .F3 },
toggle_perf_stats: Button = .{ .key = .f3 },
chat: Button = .{ .key = .enter },
chat_cmd: Button = .{ .key = .slash },
respond: Button = .{ .key = .F2 },
respond: Button = .{ .key = .f2 },
shoot: Button = .{ .mouse = .left },
sfx_volume: f32 = 0.33,
music_volume: f32 = 0.1,
Expand Down
70 changes: 37 additions & 33 deletions client/src/assets.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const std = @import("std");
const builtin = @import("builtin");

const glfw = @import("glfw");
const miniaudio = @import("miniaudio");
const pack = @import("turbopack");
const shared = @import("shared");
Expand All @@ -10,6 +9,7 @@ const utils = shared.utils;
const f32i = utils.f32i;
const RGBA = utils.RGBA;
const stbi = @import("stbi");
const windy = @import("windy");
const ziggy = @import("ziggy");

const main = @import("main.zig");
Expand Down Expand Up @@ -326,21 +326,21 @@ pub var medium_data: ParsedFontData = undefined;
pub var medium_italic_atlas: stbi.Image = undefined;
pub var medium_italic_data: ParsedFontData = undefined;

// horrible, but no other option since cursor is opaque
pub var default_cursor_pressed: *glfw.Cursor = undefined;
pub var default_cursor: *glfw.Cursor = undefined;
pub var royal_cursor_pressed: *glfw.Cursor = undefined;
pub var royal_cursor: *glfw.Cursor = undefined;
pub var ranger_cursor_pressed: *glfw.Cursor = undefined;
pub var ranger_cursor: *glfw.Cursor = undefined;
pub var aztec_cursor_pressed: *glfw.Cursor = undefined;
pub var aztec_cursor: *glfw.Cursor = undefined;
pub var fiery_cursor_pressed: *glfw.Cursor = undefined;
pub var fiery_cursor: *glfw.Cursor = undefined;
pub var target_enemy_cursor_pressed: *glfw.Cursor = undefined;
pub var target_enemy_cursor: *glfw.Cursor = undefined;
pub var target_ally_cursor_pressed: *glfw.Cursor = undefined;
pub var target_ally_cursor: *glfw.Cursor = undefined;
// TODO: clean this up now that we're on Windy
pub var default_cursor_pressed: windy.Cursor = undefined;
pub var default_cursor: windy.Cursor = undefined;
pub var royal_cursor_pressed: windy.Cursor = undefined;
pub var royal_cursor: windy.Cursor = undefined;
pub var ranger_cursor_pressed: windy.Cursor = undefined;
pub var ranger_cursor: windy.Cursor = undefined;
pub var aztec_cursor_pressed: windy.Cursor = undefined;
pub var aztec_cursor: windy.Cursor = undefined;
pub var fiery_cursor_pressed: windy.Cursor = undefined;
pub var fiery_cursor: windy.Cursor = undefined;
pub var target_enemy_cursor_pressed: windy.Cursor = undefined;
pub var target_enemy_cursor: windy.Cursor = undefined;
pub var target_ally_cursor_pressed: windy.Cursor = undefined;
pub var target_ally_cursor: windy.Cursor = undefined;

pub var sfx_copy_map: std.AutoHashMapUnmanaged(*miniaudio.Sound, std.ArrayList(*miniaudio.Sound)) = .empty;
pub var sfx_map: std.StringHashMapUnmanaged(*miniaudio.Sound) = .empty;
Expand Down Expand Up @@ -433,8 +433,12 @@ fn addCursors(comptime image_name: [:0]const u8, comptime cut_width: u32, compti
@memcpy(temp[target_idx .. target_idx + 4], img.data[src_idx .. src_idx + 4]);
}

const cursor = try glfw.Cursor.create(
.{ .w = cut_width, .h = cut_height, .pixels = temp.ptr },
for (0..temp.len / 4) |j| std.mem.swap(u8, &temp[j * 4], &temp[j * 4 + 2]);

const cursor: windy.Cursor = try .create(
temp,
cut_width,
cut_height,
cut_width / 2,
cut_height / 2,
);
Expand Down Expand Up @@ -1411,8 +1415,8 @@ fn populateKeyMap() void {
.{ Settings.Button{ .mouse = .left }, 46 },
.{ Settings.Button{ .mouse = .right }, 59 },
.{ Settings.Button{ .mouse = .middle }, 58 },
.{ Settings.Button{ .mouse = .four }, 108 },
.{ Settings.Button{ .mouse = .five }, 109 },
.{ Settings.Button{ .mouse = .m4 }, 108 },
.{ Settings.Button{ .mouse = .m5 }, 109 },
.{ Settings.Button{ .key = .zero }, 0 },
.{ Settings.Button{ .key = .one }, 4 },
.{ Settings.Button{ .key = .two }, 5 },
Expand All @@ -1433,18 +1437,18 @@ fn populateKeyMap() void {
.{ Settings.Button{ .key = .kp_7 }, 98 },
.{ Settings.Button{ .key = .kp_8 }, 99 },
.{ Settings.Button{ .key = .kp_9 }, 100 },
.{ Settings.Button{ .key = .F1 }, 68 },
.{ Settings.Button{ .key = .F2 }, 69 },
.{ Settings.Button{ .key = .F3 }, 70 },
.{ Settings.Button{ .key = .F4 }, 71 },
.{ Settings.Button{ .key = .F5 }, 72 },
.{ Settings.Button{ .key = .F6 }, 73 },
.{ Settings.Button{ .key = .F7 }, 74 },
.{ Settings.Button{ .key = .F8 }, 75 },
.{ Settings.Button{ .key = .F9 }, 76 },
.{ Settings.Button{ .key = .F10 }, 1 },
.{ Settings.Button{ .key = .F11 }, 2 },
.{ Settings.Button{ .key = .F12 }, 3 },
.{ Settings.Button{ .key = .f1 }, 68 },
.{ Settings.Button{ .key = .f2 }, 69 },
.{ Settings.Button{ .key = .f3 }, 70 },
.{ Settings.Button{ .key = .f4 }, 71 },
.{ Settings.Button{ .key = .f5 }, 72 },
.{ Settings.Button{ .key = .f6 }, 73 },
.{ Settings.Button{ .key = .f7 }, 74 },
.{ Settings.Button{ .key = .f8 }, 75 },
.{ Settings.Button{ .key = .f9 }, 76 },
.{ Settings.Button{ .key = .f10 }, 1 },
.{ Settings.Button{ .key = .f11 }, 2 },
.{ Settings.Button{ .key = .f12 }, 3 },
.{ Settings.Button{ .key = .a }, 20 },
.{ Settings.Button{ .key = .b }, 34 },
.{ Settings.Button{ .key = .c }, 39 },
Expand Down Expand Up @@ -1496,7 +1500,7 @@ fn populateKeyMap() void {
.{ Settings.Button{ .key = .enter }, 54 },
.{ Settings.Button{ .key = .delete }, 51 },
.{ Settings.Button{ .key = .end }, 53 },
.{ Settings.Button{ .key = .print_screen }, 44 },
.{ Settings.Button{ .key = .print }, 44 },
.{ Settings.Button{ .key = .insert }, 62 },
.{ Settings.Button{ .key = .escape }, 64 },
.{ Settings.Button{ .key = .home }, 87 },
Expand Down
Loading
Loading