diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-09-25 12:04:00 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-09-25 12:04:52 -0400 |
| commit | 0e6193c2195f4b24bafb6f2ff4012db383180ff9 (patch) | |
| tree | b78027eb7953006e87f1fa14b59e2272a37deb81 /editor | |
| parent | 6c9e96debca1e1ed28ed8d5ce5bd99bb9c32213b (diff) | |
pke-editor: print player controls actions
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/editor.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index 005892e..40c2596 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -1109,6 +1109,64 @@ void RecordImGuiAssets() { ImGui::End(); } +void RecordImGuiPlayerInput() { + uint32_t u; + int64_t i; + pke_input_set *set; + pke_input_action *action; + if (!ImGui::Begin("PlayerInput")) { + ImGui::End(); + return; + } + static ImGuiTableFlags tableFlags{ + ImGuiTableFlags_Borders | + ImGuiTableFlags_Resizable | + ImGuiTableFlags_RowBg + }; + + if (ImGui::BeginTable("Player Inputs", 9, tableFlags)) { + ImGui::TableSetupColumn("Set Index/Title"); + ImGui::TableSetupColumn("Set Flags"); + ImGui::TableSetupColumn("Action Name"); + ImGui::TableSetupColumn("0 Hash"); + ImGui::TableSetupColumn("0 Button"); + ImGui::TableSetupColumn("0 Mods"); + ImGui::TableSetupColumn("1 Hash"); + ImGui::TableSetupColumn("1 Button"); + ImGui::TableSetupColumn("1 Mods"); + ImGui::TableHeadersRow(); + + pk_arr_t<pke_input_set> input_sets = pke_input_get_input_sets(); + for (u = 0; u < input_sets.next; ++u) { + set = &input_sets[u]; + for (i = 0; i < set->actionCount; ++i) { + action = &set->actions[i]; + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("%hu: \"%s\"", u, set->title); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%hhu", static_cast<pke_input_action_set_flag_T>(set->flags)); + ImGui::TableSetColumnIndex(2); + ImGui::Text("\"%s\"", action->name); + ImGui::TableSetColumnIndex(3); + ImGui::Text("%hu", static_cast<pke_input_event_hash_T>(action->masks[0].computedHash)); + ImGui::TableSetColumnIndex(4); + ImGui::Text("%hu", action->masks[0].button); + ImGui::TableSetColumnIndex(5); + ImGui::Text("%hu", action->masks[0].mods); + ImGui::TableSetColumnIndex(6); + ImGui::Text("%hu", static_cast<pke_input_event_hash_T>(action->masks[1].computedHash)); + ImGui::TableSetColumnIndex(7); + ImGui::Text("%hu", action->masks[1].button); + ImGui::TableSetColumnIndex(8); + ImGui::Text("%hu", action->masks[1].mods); + } + } + ImGui::EndTable(); + } + ImGui::End(); +} + void RecordImGuiCameras() { bool b; pk_bkt_arr *bkt_arr_cams; @@ -2109,6 +2167,7 @@ void PkeEditor_RecordImGui() { RecordImGuiLevels(); RecordImGuiEntityTypes(); RecordImGuiAssets(); + RecordImGuiPlayerInput(); Game_RecordImGui(); } } |
