diff --git a/src/port/ui/GameInfoWindow.cpp b/src/port/ui/GameInfoWindow.cpp deleted file mode 100644 index d7a9ecf2d..000000000 --- a/src/port/ui/GameInfoWindow.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "GameInfoWindow.h" -#include "UIWidgets.h" -#include "libultraship/src/Context.h" - -#include -#include -#include "spdlog/spdlog.h" -#include -#include - -extern "C" { -#include "../../../src/main.h" -#include "networking/networking.h" -} - -namespace GameInfo { -GameInfoWindow::~GameInfoWindow() { - SPDLOG_TRACE("destruct game info window"); -} - -void GameInfoWindow::InitElement() { -} - -static s32 sReadyUpBool = false; - -void GameInfoWindow::DrawElement() { - const float framerate = ImGui::GetIO().Framerate; - const float deltatime = ImGui::GetIO().DeltaTime; - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); - - static char username[NETWORK_USERNAME_LENGTH] = "TestUser"; - - ImGui::Text("Username:"); - ImGui::InputText("##edit", username, IM_ARRAYSIZE(username)); - - static char address[32] = "127.0.0.1:64010"; - static char addressCopy[32]; - strncpy(addressCopy, address, sizeof(addressCopy)); - addressCopy[sizeof(addressCopy) - 1] = '\0'; // Ensure null termination - - ImGui::Text("Host:"); - ImGui::InputText("##edit3", addressCopy, IM_ARRAYSIZE(addressCopy)); - - if (ImGui::Button("Connect!")) { - char* ip = NULL; - uint16_t port = 0; - - char* token = strtok(addressCopy, ":"); - ip = token; - - token = strtok(NULL, ":"); - if (token != NULL) { - port = (uint16_t) atoi(token); - } - - gNetwork.enabled = true; - ConnectToServer(ip, port, username); - } - - char buttonLabel[32]; - - if (sReadyUpBool) { - strcpy(buttonLabel, "Lets Go!"); - } else { - strcpy(buttonLabel, "Ready Up!"); - } - - if (ImGui::Button(buttonLabel)) { - sReadyUpBool = !sReadyUpBool; - networking_ready_up(sReadyUpBool); - } - - if (gGamestate == RACING) { - - ImGui::Text("Player %f, %f, %f", gPlayers[0].pos[0], gPlayers[0].pos[1], gPlayers[0].pos[2]); - - for (int i = 0; i < NUM_PLAYERS; i++) { - ImGui::Text("Player %d: type: %X, char: %d, rank: %d, hasAuthority: %d", i, gPlayers[i].type, - gPlayers[i].characterId, gPlayers[i].currentRank, gPlayers[i].nHasAuthority); - } - } - ImGui::PopStyleColor(); -} - -void GameInfoWindow::UpdateElement() { -} -} // namespace GameInfo diff --git a/src/port/ui/GameInfoWindow.h b/src/port/ui/GameInfoWindow.h deleted file mode 100644 index 384cbe507..000000000 --- a/src/port/ui/GameInfoWindow.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include - -namespace GameInfo { -class GameInfoWindow : public Ship::GuiWindow { - public: - using Ship::GuiWindow::GuiWindow; - ~GameInfoWindow(); - - private: - void InitElement() override; - void DrawElement() override; - void UpdateElement() override; -}; -} // namespace GameInfo diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 0047a0b2e..56a814de7 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -1,7 +1,6 @@ #include "ImguiUI.h" #include "UIWidgets.h" #include "ResolutionEditor.h" -#include "GameInfoWindow.h" #include "MultiplayerWindow.h" #include "FreecamWindow.h" #include "Tools.h" @@ -35,7 +34,6 @@ std::shared_ptr mConsoleWindow; std::shared_ptr mStatsWindow; std::shared_ptr mInputEditorWindow; std::shared_ptr mGfxDebuggerWindow; -std::shared_ptr mGameInfoWindow; std::shared_ptr mMultiplayerWindow; std::shared_ptr mToolsWindow; std::shared_ptr mSceneExplorerWindow; @@ -57,11 +55,6 @@ void SetupGuiElements() { SPDLOG_ERROR("Could not find multiplayer window"); } - mGameInfoWindow = gui->GetGuiWindow("GameInfo"); - if (mGameInfoWindow == nullptr) { - SPDLOG_ERROR("Could not find game info window"); - } - mStatsWindow = gui->GetGuiWindow("Stats"); if (mStatsWindow == nullptr) { SPDLOG_ERROR("Could not find stats window"); @@ -99,13 +92,9 @@ void SetupGuiElements() { mContentBrowserWindow = std::make_shared("gEditorEnabled", "Content Browser"); gui->AddGuiWindow(mContentBrowserWindow); - - mGameInfoWindow = std::make_shared("gGameInfoEnabled", "Game Info"); - gui->AddGuiWindow(mGameInfoWindow); } void Destroy() { - mGameInfoWindow = nullptr; mConsoleWindow = nullptr; mStatsWindow = nullptr; mInputEditorWindow = nullptr; diff --git a/src/port/ui/MultiplayerWindow.cpp b/src/port/ui/MultiplayerWindow.cpp index 51b6fbf11..a7552bcd3 100644 --- a/src/port/ui/MultiplayerWindow.cpp +++ b/src/port/ui/MultiplayerWindow.cpp @@ -152,13 +152,13 @@ void DrawColumn2(WidgetInfo& info) { } void RegisterMultiplayerWidgets() { - mPortMenu->AddSidebarEntry("Enhancements", "Multiplayer", 2); - WidgetPath path = { "Enhancements", "Multiplayer", SECTION_COLUMN_1 }; - mPortMenu->AddWidget(path, "Multi Custom 1", WIDGET_CUSTOM) - .CustomFunction(DrawColumn1); - path.column = SECTION_COLUMN_2; - mPortMenu->AddWidget(path, "Multi Custom 2", WIDGET_CUSTOM) - .CustomFunction(DrawColumn2); + // mPortMenu->AddSidebarEntry("Enhancements", "Multiplayer", 2); + // WidgetPath path = { "Enhancements", "Multiplayer", SECTION_COLUMN_1 }; + // mPortMenu->AddWidget(path, "Multi Custom 1", WIDGET_CUSTOM) + // .CustomFunction(DrawColumn1); + // path.column = SECTION_COLUMN_2; + // mPortMenu->AddWidget(path, "Multi Custom 2", WIDGET_CUSTOM) + // .CustomFunction(DrawColumn2); } static RegisterMenuInitFunc initFunc(RegisterMultiplayerWidgets); diff --git a/src/port/ui/PortMenu.cpp b/src/port/ui/PortMenu.cpp index b43837ed0..85df53cf8 100644 --- a/src/port/ui/PortMenu.cpp +++ b/src/port/ui/PortMenu.cpp @@ -240,21 +240,21 @@ void PortMenu::AddSettings() { .DefaultValue(1)); #endif - AddWidget(path, "Current FPS: %d", WIDGET_CVAR_SLIDER_INT) - .CVar("gInterpolationFPS") - .Callback([](WidgetInfo& info) { - int32_t defaultValue = std::static_pointer_cast(info.options)->defaultValue; - if (CVarGetInteger(info.cVar, defaultValue) == defaultValue) { - info.name = "Current FPS: Original (%d)"; - } else { - info.name = "Current FPS: %d"; - } - }) - .PreFunc([](WidgetInfo& info) { - if (mPortMenu->disabledMap.at(DISABLE_FOR_MATCH_REFRESH_RATE_ON).active) - info.activeDisables.push_back(DISABLE_FOR_MATCH_REFRESH_RATE_ON); - }) - .Options(IntSliderOptions().Tooltip(tooltip).Min(20).Max(maxFps).DefaultValue(20)); + // AddWidget(path, "Current FPS: %d", WIDGET_CVAR_SLIDER_INT) + // .CVar("gInterpolationFPS") + // .Callback([](WidgetInfo& info) { + // int32_t defaultValue = std::static_pointer_cast(info.options)->defaultValue; + // if (CVarGetInteger(info.cVar, defaultValue) == defaultValue) { + // info.name = "Current FPS: Original (%d)"; + // } else { + // info.name = "Current FPS: %d"; + // } + // }) + // .PreFunc([](WidgetInfo& info) { + // if (mPortMenu->disabledMap.at(DISABLE_FOR_MATCH_REFRESH_RATE_ON).active) + // info.activeDisables.push_back(DISABLE_FOR_MATCH_REFRESH_RATE_ON); + // }) + // .Options(IntSliderOptions().Tooltip(tooltip).Min(20).Max(maxFps).DefaultValue(20)); AddWidget(path, "Match Refresh Rate", WIDGET_BUTTON) .Callback([](WidgetInfo& info) { int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); @@ -400,14 +400,6 @@ void PortMenu::AddDevTools() { "Enables the Gfx Debugger window, allowing you to input commands. Type help for some examples")) .WindowName("GfxDebuggerWindow"); - path = { "Developer", "Game Info", SECTION_COLUMN_1 }; - AddSidebarEntry("Developer", "Game Info", 1); - AddWidget(path, "Popout Game Info", WIDGET_WINDOW_BUTTON) - .CVar("gGameInfoEnabled") - .Options(ButtonOptions().Tooltip( - "Shows the game info window, contains player and actor information")) - .WindowName("GameInfo"); - path = { "Developer", "Stats", SECTION_COLUMN_1 }; AddSidebarEntry("Developer", "Stats", 1); AddWidget(path, "Popout Stats", WIDGET_WINDOW_BUTTON) diff --git a/src/port/ui/ResolutionEditor.cpp b/src/port/ui/ResolutionEditor.cpp index c1fa6f263..8da2643ad 100644 --- a/src/port/ui/ResolutionEditor.cpp +++ b/src/port/ui/ResolutionEditor.cpp @@ -531,7 +531,7 @@ void UpdateResolutionVars() { bool IsDroppingFrames() { // a rather imprecise way of checking for frame drops. // but it's mostly there to inform the player of large drops. - const short targetFPS = CVarGetInteger("gInterpolationFPS", 20); + const short targetFPS = CVarGetInteger("gInterpolationFPS", 30); const float threshold = targetFPS / 20.0f + 4.1f; return ImGui::GetIO().Framerate < targetFPS - threshold; }