Bump LUS and implemented Menu Bar

This commit is contained in:
KiritoDv
2023-08-16 09:27:04 -06:00
parent 12d18ad122
commit b2c9791fb4
4 changed files with 32 additions and 5 deletions
+2 -2
View File
@@ -15,8 +15,8 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MT>)
#add_compile_options(-fsanitize=address)
#add_link_options(-fsanitize=address)
# add_compile_options(-fsanitize=address)
# add_link_options(-fsanitize=address)
# Add a custom module path to locate additional CMake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
+18 -1
View File
@@ -8,6 +8,7 @@
#include <Fast3D/gfx_pc.h>
namespace GameUI {
std::shared_ptr<GameMenuBar> mGameMenuBar;
std::shared_ptr<LUS::GuiWindow> mConsoleWindow;
std::shared_ptr<LUS::GuiWindow> mStatsWindow;
std::shared_ptr<LUS::GuiWindow> mInputEditorWindow;
@@ -15,6 +16,8 @@ std::shared_ptr<LUS::GuiWindow> mInputEditorWindow;
void SetupGuiElements() {
auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui();
mGameMenuBar = std::make_shared<GameMenuBar>("gOpenMenuBar", CVarGetInteger("gOpenMenuBar", 0));
gui->SetMenuBar(mGameMenuBar);
mStatsWindow = gui->GetGuiWindow("Stats");
if (mStatsWindow == nullptr) {
SPDLOG_ERROR("Could not find stats window");
@@ -30,7 +33,6 @@ void SetupGuiElements() {
SPDLOG_ERROR("Could not find input editor window");
return;
}
mInputEditorWindow->ToggleVisibility();
}
void Destroy() {
@@ -38,4 +40,19 @@ void Destroy() {
mStatsWindow = nullptr;
mInputEditorWindow = nullptr;
}
}
void GameMenuBar::DrawElement() {
if(ImGui::BeginMenuBar()){
if(ImGui::BeginMenu("Settings")){
if (GameUI::mInputEditorWindow) {
if (ImGui::Button("Controller Mapping", ImVec2 (-1.0f, 0.0f))) {
GameUI::mInputEditorWindow->ToggleVisibility();
}
}
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings();
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
}
+11 -1
View File
@@ -1,6 +1,16 @@
#pragma once
#include <libultraship/libultraship.h>
namespace GameUI {
void SetupGuiElements();
void Destroy();
}
}
class GameMenuBar : public LUS::GuiMenuBar {
public:
using LUS::GuiMenuBar::GuiMenuBar;
protected:
void DrawElement() override;
void InitElement() override {};
void UpdateElement() override {};
};