Compare commits

..

12 Commits

Author SHA1 Message Date
1dfff5e0b0 tmp: attempt 3 lol 2023-03-26 21:33:41 -05:00
3e1017d4fc tmp: remove special-case for win32 2023-03-26 21:08:24 -05:00
0b90028b52 chore: move thing 2023-03-26 20:58:24 -05:00
70d7c0dc02 Merge branch 'sdl2-opengl3-backend' into fork 2023-03-26 19:52:55 -05:00
55efe08bdf chore: explicitly link SDL2
TODO: What happens on Windows? macOS?
2023-03-26 19:38:50 -05:00
78922b64ea fix: vcpkg stores SDL.h under SDL2 folder
macOS and Linux seem to not, so in order to get CI working again I
should make use of the preprocessor.

FIXME: I think this makes vcpkg a **hard** requirement which perhaps
isn't ideal if I want ZBA to be as easy to build as possible. I should
try ensuring that building w/out vcpkg works as well
2023-03-26 19:35:02 -05:00
b051d0c406 feat: add sdl2-opengl3 backend impl 2023-03-26 19:35:02 -05:00
5432027535 chore: handle all cases of enum 2023-03-26 19:32:46 -05:00
bcd0e8be1f chore: combine render() and draw() in backend 2023-03-26 19:32:46 -05:00
cd2b3923a4 feat: add backend impl for glfw+opengl3 2023-03-26 19:32:46 -05:00
d9b80ff062 feat: add glfw+opengl3 backend option to build.zig 2023-03-26 19:29:19 -05:00
5e306e4dfa chore: add necessary imgui files for opengl3 2023-03-26 19:25:31 -05:00
3 changed files with 6 additions and 14 deletions

2
.gitignore vendored
View File

@@ -1,2 +0,0 @@
/zig-cache
/zig-out

View File

@@ -109,20 +109,14 @@ pub fn package(
// see: https://github.com/MasterQ32/SDL.zig/blob/37f4ba9e31bea895fa19ef8b90d1f51111e52e67/Sdk.zig#L182-L199 // see: https://github.com/MasterQ32/SDL.zig/blob/37f4ba9e31bea895fa19ef8b90d1f51111e52e67/Sdk.zig#L182-L199
zgui_c_cpp.addVcpkgPaths(if (args.options.shared) .dynamic else .static) catch break :blk; zgui_c_cpp.addVcpkgPaths(if (args.options.shared) .dynamic else .static) catch break :blk;
const path = zgui_c_cpp.vcpkg_bin_path orelse break :blk;
const vcpkg_triplet = zgui_c_cpp.target.vcpkgTriplet(b.allocator, if (args.options.shared) .Dynamic else .Static) catch |e| { const src_path = std.fs.path.join(b.allocator, &.{ path, "SDL2.dll" }) catch @panic("out of memory");
std.debug.panic("failed to determing vcpkg triplet: {}", .{e});
};
defer b.allocator.free(vcpkg_triplet);
const include_path = b.pathJoin(&.{ b.vcpkg_root.found, "installed", vcpkg_triplet, "include", "SDL2" }); std.fs.cwd().access(src_path, .{}) catch break :blk;
zgui_c_cpp.include_dirs.append(.{ .raw_path = include_path }) catch @panic("out of memory");
const bin_path = zgui_c_cpp.vcpkg_bin_path orelse @panic("vcpkg paths were found, so vcpkg_bin_path should be set "); // we found SDL2.dll
const dll_path = std.fs.path.join(b.allocator, &.{ bin_path, "SDL2.dll" }) catch @panic("out of memory"); b.installBinFile(src_path, "SDL2.dll");
std.fs.cwd().access(dll_path, .{}) catch break :blk;
b.installBinFile(dll_path, "SDL2.dll");
} }
zgui_c_cpp.linkSystemLibrary("SDL2"); zgui_c_cpp.linkSystemLibrary("SDL2");

View File

@@ -9,9 +9,9 @@ pub const version = @import("std").SemanticVersion{ .major = 0, .minor = 9, .pat
pub usingnamespace @import("gui.zig"); pub usingnamespace @import("gui.zig");
pub const plot = @import("plot.zig"); pub const plot = @import("plot.zig");
pub const backend = switch (@import("zgui_options").backend) { pub const backend = switch (@import("zgui_options").backend) {
.glfw_wgpu => @import("backend_glfw_wgpu.zig"),
.glfw_opengl3 => @import("backend_glfw_opengl3.zig"), .glfw_opengl3 => @import("backend_glfw_opengl3.zig"),
.sdl2_opengl3 => @import("backend_sdl2_opengl3.zig"), .sdl2_opengl3 => @import("backend_sdl2_opengl3.zig"),
.glfw_wgpu => @import("backend_glfw_wgpu.zig"),
.win32_dx12 => .{}, // TODO: .win32_dx12 => .{}, // TODO:
.no_backend => .{}, .no_backend => .{},
}; };