rntviewer/src/render.cpp
2024-07-10 22:30:49 +02:00

34 lines
1 KiB
C++

internal
MemoryEditor make_memory_editor()
{
MemoryEditor mem_edit;
// mem_edit.ReadOnly = true;
mem_edit.Cols = 32;
return mem_edit;
}
internal
void update_and_render(Arena *arena, App_State &app, f32 delta_time)
{
ImGui::SetNextWindowPos({ 0, 0 });
ImGui::SetNextWindowSize({ (f32)app.win_data.width, (f32)app.win_data.height });
Temp scratch = temp_begin(arena);
defer { temp_end(scratch); };
u64 text_buf_size = min(app.inspected_file_size * 2, 2048);
char *text_buf = arena_push_array_no_zero<char>(scratch.arena, text_buf_size + 1);
// TODO: convert file content to human readable
for (u64 i = 0; i < text_buf_size / 2; ++i)
sprintf(&text_buf[2 * i], "%02X", app.inspected_fmem[i]);
text_buf[text_buf_size] = 0;
if (ImGui::Begin("main")) {
// ImGui::SetNextWindowContentSize({ 500, 600 });
// ImGui::SetCursorX(30);
// ImGui::TextWrapped("%s", text_buf);
static MemoryEditor mem_edit = make_memory_editor();
mem_edit.DrawWindow("Hex View", app.inspected_fmem, app.inspected_file_size);
ImGui::End();
}
}