| 101 | } |
| 102 | |
| 103 | void ScriptSystem::ShowDebugWindow(bool* open) |
| 104 | { |
| 105 | if (!ImGui::Begin("Script System", open)) |
| 106 | { |
| 107 | ImGui::End(); |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | #if defined(TRMN_DEBUG) |
| 112 | ImGui::SeparatorText("Settings"); |
| 113 | |
| 114 | char dirBuf[256]; |
| 115 | char nameBuf[256]; |
| 116 | std::strncpy(dirBuf, m_GameCodeDir.c_str(), sizeof(dirBuf) - 1); |
| 117 | std::strncpy(nameBuf, m_AssemblyName.c_str(), sizeof(nameBuf) - 1); |
| 118 | |
| 119 | if (ImGui::InputText("Script Directory", dirBuf, sizeof(dirBuf))) |
| 120 | { |
| 121 | m_GameCodeDir = dirBuf; |
| 122 | RebuildWatches(); |
| 123 | } |
| 124 | if (ImGui::InputText("Assembly Name", nameBuf, sizeof(nameBuf))) |
| 125 | m_AssemblyName = nameBuf; |
| 126 | |
| 127 | ImGui::Spacing(); |
| 128 | ImGui::SeparatorText("Actions"); |
| 129 | |
| 130 | if (ImGui::Button("Build")) |
| 131 | Compile(); |
| 132 | ImGui::SameLine(); |
| 133 | if (ImGui::Button("Rebuild")) |
| 134 | Recompile(); |
| 135 | ImGui::SameLine(); |
| 136 | #endif |
| 137 | { |
| 138 | bool alreadyLoaded = ScriptModuleManager::Get().IsLoaded("Game"); |
| 139 | if (alreadyLoaded) |
| 140 | ImGui::BeginDisabled(); |
| 141 | if (ImGui::Button("Load")) |
| 142 | ScriptModuleManager::Get().Load("Game", GetLibName()); |
| 143 | if (alreadyLoaded) |
| 144 | ImGui::EndDisabled(); |
| 145 | } |
| 146 | ImGui::SameLine(); |
| 147 | if (ImGui::Button("Reload")) |
| 148 | { |
| 149 | World* world = Application::GetSystem<WorldSystem>()->GetCurrentWorld(); |
| 150 | ScriptModuleManager::Get().Reload("Game", world); |
| 151 | } |
| 152 | |
| 153 | ImGui::SeparatorText("Status"); |
| 154 | |
| 155 | ImGui::Text("Pending reload: %s", m_PendingReload ? "yes" : "no"); |
| 156 | ImGui::Text("Watched files: %zu", m_Watches.size()); |
| 157 | ImGui::Separator(); |
| 158 | |
| 159 | auto modules = ScriptModuleManager::Get().GetLoadedModules(); |
| 160 | ImGui::Text("Loaded modules: %zu", modules.size()); |
nothing calls this directly
no test coverage detected