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 | |
| parent | 6c9e96debca1e1ed28ed8d5ce5bd99bb9c32213b (diff) | |
pke-editor: print player controls actions
| -rw-r--r-- | editor/editor.cpp | 59 | ||||
| -rw-r--r-- | src/player-input.cpp | 2 |
2 files changed, 60 insertions, 1 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(); } } diff --git a/src/player-input.cpp b/src/player-input.cpp index 29297ab..7687b89 100644 --- a/src/player-input.cpp +++ b/src/player-input.cpp @@ -466,7 +466,7 @@ void pke_input_query_by_mask(pke_input_event_mask mask, pke_input_event &ev) { /* no-op */ break; default: - fprintf(stderr, "[pke_input_query_by_mask] unhandled input type: %i", pke_input_event_hash_T(type)); + fprintf(stderr, "[pke_input_query_by_mask] unhandled input type: %i\n", pke_input_event_hash_T(type)); break; } return; |
