Reimplementing DearImGui

This commit is contained in:
2025-03-22 01:04:15 +01:00
parent dfa5d1245f
commit 9a8ab7853a
8 changed files with 768 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
#import "dxgi";
#import "File";
#import "Windows";
#load "../imgui/imgui_dx11.jai";
Graphics_Backend :: D3D11_Backend;
Backend_Vertex_Input :: *ID3D11InputLayout;
@@ -77,7 +78,7 @@ create_backend :: (w: *Window) -> *D3D11_Backend {
return null;
}
//imgui_impldx11_init(backend.d3d_device, backend.d3d_context);
imgui_impldx11_init(backend.d3d_device, backend.d3d_context);
return backend;
}
@@ -1439,6 +1440,10 @@ render :: (backend: *D3D11_Backend, command_buffer: *Render_Command_Buffer) {
}
ID3D11DeviceContext_DrawIndexedInstanced(d3d_context, xx it.draw_indexed_instanced.index_count, xx it.draw_indexed_instanced.instance_count, xx it.draw_indexed_instanced.start_index, xx it.draw_indexed_instanced.base_vertex, 0);
case .RENDER_IMGUI; {
ImGui.Render();
imgui_impldx11_render_draw_data(ImGui.GetDrawData());
}
}
}
@@ -1515,5 +1520,4 @@ create_rasterizer_state :: (backend: *D3D11_Backend, fill: bool, cull_face: Cull
return *backend.rasterizer_states[backend.rasterizer_states.count-1];
}
//#load "imgui_dx11.jai";
//#import "shader_parsing";

View File

@@ -434,6 +434,8 @@ Render_Command_Type :: enum {
SET_DRAW_MODE;
SET_CULL_FACE;
SET_DEPTH_WRITE;
RENDER_IMGUI;
}
MAX_RENDER_TARGETS :: 8;
@@ -1108,6 +1110,12 @@ create_pipeline_state :: (using renderer: *Renderer, vs: Shader_Handle, ps: Shad
return xx pipeline_states.count;
}
push_cmd_render_imgui :: (using renderer: *Renderer) {
command : Render_Command;
command.type = .RENDER_IMGUI;
array_add(*engine.renderer.command_buffer.commands, command);
}
push_cmd_set_pipeline_state :: (using renderer: *Renderer, handle: Pipeline_State_Handle) {
assert(handle > 0);
@@ -1647,7 +1655,6 @@ render :: () {
// #load "ui_system.jai";
// #load "ui.jai";
//}
//ImGui :: #import "ImGui";
#scope_module
#load "dx11_renderer.jai";