rntviewer/src/render.cpp

33 lines
1 KiB
C++
Raw Normal View History

MemoryEditor make_memory_editor()
{
MemoryEditor mem_edit;
// mem_edit.ReadOnly = true;
mem_edit.Cols = 32;
return mem_edit;
}
2024-07-10 17:38:16 +00:00
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 });
2024-07-10 18:11:42 +00:00
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);
2024-07-10 18:11:42 +00:00
// 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_file[i]);
text_buf[text_buf_size] = 0;
2024-07-10 18:11:42 +00:00
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_file, app.inspected_file_size);
2024-07-10 17:38:16 +00:00
ImGui::End();
}
}