Compare commits
	
		
			9 Commits
		
	
	
		
			5b2b64a9de
			...
			70d7c0dc02
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 70d7c0dc02 | |||
| 55efe08bdf | |||
| 78922b64ea | |||
| b051d0c406 | |||
| 5432027535 | |||
| bcd0e8be1f | |||
| cd2b3923a4 | |||
| d9b80ff062 | |||
| 5e306e4dfa | 
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,2 +0,0 @@
 | 
			
		||||
/zig-cache
 | 
			
		||||
/zig-out
 | 
			
		||||
							
								
								
									
										23
									
								
								build.zig
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								build.zig
									
									
									
									
									
								
							@@ -105,30 +105,9 @@ pub fn package(
 | 
			
		||||
            zgui_c_cpp.linkSystemLibraryName("dwmapi");
 | 
			
		||||
        },
 | 
			
		||||
        .sdl2_opengl3 => {
 | 
			
		||||
            if (target.isWindows()) blk: {
 | 
			
		||||
                // 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;
 | 
			
		||||
 | 
			
		||||
                const vcpkg_triplet = zgui_c_cpp.target.vcpkgTriplet(b.allocator, if (args.options.shared) .Dynamic else .Static) catch |e| {
 | 
			
		||||
                    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" });
 | 
			
		||||
                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 ");
 | 
			
		||||
                const dll_path = std.fs.path.join(b.allocator, &.{ bin_path, "SDL2.dll" }) catch @panic("out of memory");
 | 
			
		||||
 | 
			
		||||
                std.fs.cwd().access(dll_path, .{}) catch break :blk;
 | 
			
		||||
                b.installBinFile(dll_path, "SDL2.dll");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            zgui_c_cpp.linkSystemLibrary("SDL2");
 | 
			
		||||
 | 
			
		||||
            zgui_c_cpp.addCSourceFile(thisDir() ++ "/libs/imgui/backends/imgui_impl_sdl.cpp", cflags);
 | 
			
		||||
            zgui_c_cpp.addCSourceFile(thisDir() ++ "/libs/imgui/backends/imgui_impl_opengl3.cpp", cflags);
 | 
			
		||||
            zgui_c_cpp.linkSystemLibrary("SDL2");
 | 
			
		||||
        },
 | 
			
		||||
        .no_backend => {},
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -67,8 +67,13 @@
 | 
			
		||||
#include "imgui_impl_sdl.h"
 | 
			
		||||
 | 
			
		||||
// SDL
 | 
			
		||||
#include <SDL.h>
 | 
			
		||||
#include <SDL_syswm.h>
 | 
			
		||||
#if defined(__WIN32__)
 | 
			
		||||
    #include <SDL2/SDL.h>
 | 
			
		||||
    #include <SDL2/SDL_syswm.h>
 | 
			
		||||
#else
 | 
			
		||||
    #include <SDL.h>
 | 
			
		||||
    #include <SDL_syswm.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(__APPLE__)
 | 
			
		||||
#include <TargetConditionals.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,9 +9,9 @@ pub const version = @import("std").SemanticVersion{ .major = 0, .minor = 9, .pat
 | 
			
		||||
pub usingnamespace @import("gui.zig");
 | 
			
		||||
pub const plot = @import("plot.zig");
 | 
			
		||||
pub const backend = switch (@import("zgui_options").backend) {
 | 
			
		||||
    .glfw_wgpu => @import("backend_glfw_wgpu.zig"),
 | 
			
		||||
    .glfw_opengl3 => @import("backend_glfw_opengl3.zig"),
 | 
			
		||||
    .sdl2_opengl3 => @import("backend_sdl2_opengl3.zig"),
 | 
			
		||||
    .glfw_wgpu => @import("backend_glfw_wgpu.zig"),
 | 
			
		||||
    .win32_dx12 => .{}, // TODO:
 | 
			
		||||
    .no_backend => .{},
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user