Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/backend_glfw_dx12.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ pub fn deinit() void {
backend_glfw.deinit();
}

pub fn newFrame(fb_width: u32, fb_height: u32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
backend_glfw.newFrame();
backend_dx12.newFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
Comment on lines +22 to 26
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

gui.newFrame();
}
Expand Down
4 changes: 2 additions & 2 deletions src/backend_glfw_opengl.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ pub fn deinit() void {
backend_glfw.deinit();
}

pub fn newFrame(fb_width: u32, fb_height: u32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
backend_glfw.newFrame();
ImGui_ImplOpenGL3_NewFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

Comment on lines +24 to 30
gui.newFrame();
}
Expand Down
7 changes: 2 additions & 5 deletions src/backend_glfw_vulkan.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ pub fn deinit() void {
backend_glfw.deinit();
}

pub fn newFrame(
fb_width: u32,
fb_height: u32,
) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
backend_glfw.newFrame();
backend_vulkan.newFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

Comment on lines +27 to 33
gui.newFrame();
}
Expand Down
4 changes: 2 additions & 2 deletions src/backend_glfw_wgpu.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ pub fn deinit() void {
backend_glfw.deinit();
}

pub fn newFrame(fb_width: u32, fb_height: u32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
ImGui_ImplWGPU_NewFrame();
backend_glfw.newFrame();

gui.io.setDisplaySize(@floatFromInt(fb_width), @floatFromInt(fb_height));
Comment on lines +33 to 37
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

gui.newFrame();
}
Expand Down
10 changes: 5 additions & 5 deletions src/backend_osx_metal.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ pub fn deinit() void {
pub fn newFrame(
fb_width: u32,
fb_height: u32,
fb_sx: f32,
fb_sy: f32,
view: *const anyopaque, // NSView*
render_pass_descriptor: *const anyopaque // MTL::RenderPassDescriptor*
render_pass_descriptor: *const anyopaque, // MTL::RenderPassDescriptor*
) void {
backend_osx.newFrame(view);
ImGui_ImplMetal_NewFrame(render_pass_descriptor);

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

Comment on lines 19 to 32
gui.newFrame();
}
Expand All @@ -43,6 +45,4 @@ pub fn draw(
extern fn ImGui_ImplMetal_Init(device: *const anyopaque) bool;
extern fn ImGui_ImplMetal_Shutdown() void;
extern fn ImGui_ImplMetal_NewFrame(renderPassDescriptor: *const anyopaque) void;
extern fn ImGui_ImplMetal_RenderDrawData(draw_data: *const anyopaque,
commandBuffer: *const anyopaque,
commandEncoder: *const anyopaque) void;
extern fn ImGui_ImplMetal_RenderDrawData(draw_data: *const anyopaque, commandBuffer: *const anyopaque, commandEncoder: *const anyopaque) void;
4 changes: 2 additions & 2 deletions src/backend_sdl2_opengl.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ pub fn deinit() void {
backend_sdl2.deinit();
}

pub fn newFrame(fb_width: u32, fb_height: u32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
backend_sdl2.newFrame();
ImGui_ImplOpenGL3_NewFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

Comment on lines +32 to 38
gui.newFrame();
}
Expand Down
9 changes: 4 additions & 5 deletions src/backend_sdl2_renderer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const backend_sdl2 = @import("backend_sdl2.zig");

pub fn init(
window: *const anyopaque, // SDL_Window
renderer: *const anyopaque, // SDL_Renderer
renderer: *const anyopaque, // SDL_Renderer
) void {
backend_sdl2.initRenderer(window, renderer);
if(!ImGui_ImplSDLRenderer2_Init(renderer)){
if (!ImGui_ImplSDLRenderer2_Init(renderer)) {
unreachable;
}
}
Expand All @@ -22,12 +22,12 @@ pub fn deinit() void {
backend_sdl2.deinit();
}

pub fn newFrame(fb_width: u32, fb_height: u32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
ImGui_ImplSDLRenderer2_NewFrame();
backend_sdl2.newFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

Comment on lines +25 to 31
gui.newFrame();
}
Expand All @@ -48,4 +48,3 @@ extern fn ImGui_ImplSDLRenderer2_RenderDrawData(draw_data: gui.DrawData, rendere
//TODO: extern fn ImGui_ImplSDLRenderer2_DestroyFontsTexture() void;
//TODO: extern fn ImGui_ImplSDLRenderer2_CreateDeviceObjects() bool;
//TODO: extern fn ImGui_ImplSDLRenderer2_DestroyDeviceObjects() void;

4 changes: 2 additions & 2 deletions src/backend_sdl3_gpu.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ pub fn processEvent(event: *const anyopaque) bool {
return backend_sdl3.processEvent(event);
}

pub fn newFrame(fb_width: u32, fb_height: u32, fb_scale: f32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
ImGui_ImplSDLGPU3_NewFrame();
backend_sdl3.newFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
Comment on lines +30 to 34
gui.io.setDisplayFramebufferScale(fb_scale, fb_scale);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

gui.newFrame();
}
Expand Down
4 changes: 2 additions & 2 deletions src/backend_sdl3_opengl.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ pub fn deinit() void {
backend_sdl3.deinit();
}

pub fn newFrame(fb_width: u32, fb_height: u32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
ImGui_ImplOpenGL3_NewFrame();
backend_sdl3.newFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
Comment on lines +32 to 36
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

gui.newFrame();
}
Expand Down
9 changes: 4 additions & 5 deletions src/backend_sdl3_renderer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ const backend_sdl3 = @import("backend_sdl3.zig");

pub fn init(
window: *const anyopaque, // SDL_Window
renderer: *const anyopaque, // SDL_Renderer
renderer: *const anyopaque, // SDL_Renderer
) void {
backend_sdl3.initRenderer(window, renderer);
if(!ImGui_ImplSDLRenderer3_Init(renderer)){
if (!ImGui_ImplSDLRenderer3_Init(renderer)) {
unreachable;
}
}
Expand All @@ -22,12 +22,12 @@ pub fn deinit() void {
backend_sdl3.deinit();
}

pub fn newFrame(fb_width: u32, fb_height: u32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
ImGui_ImplSDLRenderer3_NewFrame();
backend_sdl3.newFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

Comment on lines +25 to 31
gui.newFrame();
}
Expand All @@ -48,4 +48,3 @@ extern fn ImGui_ImplSDLRenderer3_RenderDrawData(draw_data: gui.DrawData, rendere
//TODO extern fn ImGui_ImplSDLRenderer3_DestroyFontsTexture() void;
//TODO extern fn ImGui_ImplSDLRenderer3_CreateDeviceObjects() bool;
//TODO extern fn ImGui_ImplSDLRenderer3_DestroyDeviceObjects() void;

22 changes: 8 additions & 14 deletions src/backend_sdl3_vulkan.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ pub const VkHandle = backend_vulkan.VkHandle;
pub const VkPipelineRenderingCreateInfo = backend_vulkan.VkPipelineRenderingCreateInfo;
pub const ImGui_ImplVulkan_InitInfo = backend_vulkan.ImGui_ImplVulkan_InitInfo;

pub fn init(
init_info: ImGui_ImplVulkan_InitInfo,
window: *const anyopaque
) void {
backend_sdl3.initVulkan(window);
pub fn init(init_info: ImGui_ImplVulkan_InitInfo, window: *const anyopaque) void {
backend_sdl3.initVulkan(window);
backend_vulkan.init(init_info);
}

Expand All @@ -19,15 +16,12 @@ pub fn deinit() void {
backend_sdl3.deinit();
}

pub fn newFrame(
fb_width: u32,
fb_height: u32,
) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
backend_vulkan.newFrame();
backend_sdl3.newFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
Comment on lines +19 to 23
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

gui.newFrame();
}
Expand All @@ -47,9 +41,9 @@ pub fn loadFunctions(
loader: fn (function_name: [*:0]const u8, user_data: ?*anyopaque) callconv(.c) ?*anyopaque,
user_data: ?*anyopaque,
) bool {
return backend_vulkan.loadFunctions(api_version, loader, user_data);
}
return backend_vulkan.loadFunctions(api_version, loader, user_data);
}

pub fn set_min_image_count(min_image_count: u32) void {
pub fn set_min_image_count(min_image_count: u32) void {
backend_vulkan.set_min_image_count(min_image_count);
}
}
4 changes: 2 additions & 2 deletions src/backend_win32_dx12.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ pub fn deinit() void {
ImGui_ImplWin32_Shutdown();
}

pub fn newFrame(fb_width: u32, fb_height: u32) void {
pub fn newFrame(fb_width: u32, fb_height: u32, fb_sx: f32, fb_sy: f32) void {
ImGui_ImplWin32_NewFrame();
backend_dx12.newFrame();

gui.io.setDisplaySize(@as(f32, @floatFromInt(fb_width)), @as(f32, @floatFromInt(fb_height)));
Comment on lines +23 to 27
gui.io.setDisplayFramebufferScale(1.0, 1.0);
gui.io.setDisplayFramebufferScale(fb_sx, fb_sy);

gui.newFrame();
}
Expand Down
Loading