diff --git a/Source/Core/Editor/GUI.cpp b/Source/Core/Editor/GUI.cpp index 35073335aa..1fa513b2c6 100644 --- a/Source/Core/Editor/GUI.cpp +++ b/Source/Core/Editor/GUI.cpp @@ -40,7 +40,7 @@ GUISystem::GUISystem(ERS_STRUCT_SystemUtils* SystemUtils, GLFWwindow* Window, Cu // Setup WindowManager Class WindowManager_ = std::make_unique(SystemUtils_); - WindowManager_->GenerateWindowStruct(ProjectUtils_, HIDUtils_, VisualRenderer_, ThemeManager_.get(), Cursors3D_, SceneManager_); + WindowManager_->GenerateWindowStruct(ProjectUtils_, HIDUtils_, VisualRenderer_, ThemeManager_.get(), FontManager_.get(), Cursors3D_, SceneManager_); // Initialize Windows diff --git a/Source/Core/Editor/Menus/GUI_Menu_View/GUI_Menu_View.cpp b/Source/Core/Editor/Menus/GUI_Menu_View/GUI_Menu_View.cpp index 91c9afdada..d556d3732a 100644 --- a/Source/Core/Editor/Menus/GUI_Menu_View/GUI_Menu_View.cpp +++ b/Source/Core/Editor/Menus/GUI_Menu_View/GUI_Menu_View.cpp @@ -33,7 +33,7 @@ void GUI_Menu_View::Draw() { } if (ImGui::MenuItem("System Font")) { - ShowFontPicker_ = true; + Windows_->GUI_Window_FontSelector_->Enabled_ = !Windows_->GUI_Window_FontSelector_->Enabled_; } ImGui::Separator(); @@ -47,7 +47,5 @@ void GUI_Menu_View::Draw() { } - // Draw Windows - FontManager_->FontSelectorWindow(&ShowFontPicker_); } \ No newline at end of file diff --git a/Source/Core/Editor/Utils/ERS_Editor_FontManager/ERS_Editor_FontManager.h b/Source/Core/Editor/Utils/ERS_Editor_FontManager/ERS_Editor_FontManager.h index 44d0d097b7..becc5fc886 100644 --- a/Source/Core/Editor/Utils/ERS_Editor_FontManager/ERS_Editor_FontManager.h +++ b/Source/Core/Editor/Utils/ERS_Editor_FontManager/ERS_Editor_FontManager.h @@ -33,16 +33,18 @@ class ERS_CLASS_FontManager { ERS_CLASS_LoggingSystem* Logger_; /** FontPathList_; /** FontNameList_; /**Logger_->Log("WindowManager Subsystem Setting Up Window Struct", 4); @@ -54,6 +54,7 @@ ERS_CLASS_ThemeManager* ThemeManager, Cursors3D* Gizmo, ERS_CLASS_SceneManager* Windows_->GUI_Window_SystemLog_ = std::make_unique(SystemUtils_); Windows_->GUI_Window_TestEditor_ = std::make_unique(SystemUtils_); Windows_->GUI_Window_ThemeSelector_ = std::make_unique(ThemeManager); + Windows_->GUI_Window_FontSelector_ = std::make_unique(FontManager); SystemUtils_->Logger_->Log("WindowManager Subsystem Finished Setting Up Window Struct", 3); SystemUtils_->Logger_->Log("WindowManager Subsystem Setting Up Window Index", 4); @@ -77,6 +78,7 @@ ERS_CLASS_ThemeManager* ThemeManager, Cursors3D* Gizmo, ERS_CLASS_SceneManager* WindowNames_.push_back("SystemLog"); WindowNames_.push_back("TestEditor"); WindowNames_.push_back("ThemeSelector"); + WindowNames_.push_back("FontSelector"); SystemUtils_->Logger_->Log("WindowManager Subsystem Finished Setting Up Window Index", 3); @@ -107,7 +109,8 @@ void ERS_CLASS_WindowManager::UpdateAllWindows() { Windows_->GUI_Window_SystemLog_->Draw(); Windows_->GUI_Window_TestEditor_->Draw(); Windows_->GUI_Window_ThemeSelector_->Draw(); - + Windows_->GUI_Window_FontSelector_->Draw(); + } bool ERS_CLASS_WindowManager::SetWindowStatus(std::string WindowName, bool Status) { @@ -171,6 +174,9 @@ bool ERS_CLASS_WindowManager::SetWindowStatus(std::string WindowName, bool Statu } else if (WindowName == "ThemeSelector") { Windows_->GUI_Window_ThemeSelector_->Enabled_ = Status; return true; + } else if (WindowName == "FontSelector") { + Windows_->GUI_Window_FontSelector_->Enabled_ = Status; + return true; } else { return false; } @@ -238,6 +244,9 @@ bool ERS_CLASS_WindowManager::GetWindowStatus(std::string WindowName, bool* Stat } else if (WindowName == "ThemeSelector") { *Status = Windows_->GUI_Window_ThemeSelector_->Enabled_; return true; + } else if (WindowName == "FontSelector") { + *Status = Windows_->GUI_Window_FontSelector_->Enabled_; + return true; } else { return false; } diff --git a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.h b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.h index 0df5bc4dde..60abf25cd4 100644 --- a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.h +++ b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_Editor_WindowManager.h @@ -19,6 +19,7 @@ #include #include +#include #include @@ -41,6 +42,7 @@ #include #include #include +#include @@ -81,7 +83,7 @@ class ERS_CLASS_WindowManager { * */ void GenerateWindowStruct(ERS_STRUCT_ProjectUtils* ProjectUtils, ERS_STRUCT_HumanInputDeviceUtils* HIDUtils, ERS_CLASS_VisualRenderer* VisualRenderer, - ERS_CLASS_ThemeManager* ThemeManager, Cursors3D* Gizmo, ERS_CLASS_SceneManager* SceneManager); + ERS_CLASS_ThemeManager* ThemeManager, ERS_CLASS_FontManager* FontManager, Cursors3D* Gizmo, ERS_CLASS_SceneManager* SceneManager); /** diff --git a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_STRUCT_Windows.h b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_STRUCT_Windows.h index bb26671fad..592f63ca17 100644 --- a/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_STRUCT_Windows.h +++ b/Source/Core/Editor/Utils/ERS_Editor_WindowManager/ERS_STRUCT_Windows.h @@ -29,6 +29,7 @@ #include #include #include +#include /** * @brief This structure holds unique pointers to all windows that are instantiated by the GUI. @@ -57,5 +58,6 @@ struct ERS_STRUCT_Windows { std::unique_ptr GUI_Window_SystemLog_; std::unique_ptr GUI_Window_TestEditor_; std::unique_ptr GUI_Window_ThemeSelector_; + std::unique_ptr GUI_Window_FontSelector_; }; \ No newline at end of file diff --git a/Source/Core/Editor/Windows/CMakeLists.txt b/Source/Core/Editor/Windows/CMakeLists.txt index 9f5b2646a8..9cebf42d01 100644 --- a/Source/Core/Editor/Windows/CMakeLists.txt +++ b/Source/Core/Editor/Windows/CMakeLists.txt @@ -10,7 +10,6 @@ # Add Window Subdirs add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ProjectSettings) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_SceneTree) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ThemeSelector) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ImportProgressBar) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_About) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_SystemLog) @@ -20,6 +19,10 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_TestEditor) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ShaderEditor) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ScriptEditor) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ThemeSelector) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_FontSelector) + + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_RAMGraph) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_ObjectProperties) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/GUI_Window_RenderingSettings) diff --git a/Source/Core/Editor/Windows/GUI_Window_FontSelector/CMakeLists.txt b/Source/Core/Editor/Windows/GUI_Window_FontSelector/CMakeLists.txt new file mode 100644 index 0000000000..9a43316bbd --- /dev/null +++ b/Source/Core/Editor/Windows/GUI_Window_FontSelector/CMakeLists.txt @@ -0,0 +1,30 @@ +######################################################################## +# This file is part of the BrainGenix-ERS Environment Rendering System # +######################################################################## + + + +# Create Library (Name Should Be Parent Dir Name) +add_library(GUI_Window_FontSelector + + # Add Source Files (.cpp) + "GUI_Window_FontSelector.cpp" + + # Add Header Files (.h) + "GUI_Window_FontSelector.h" + + + ${BACKWARD_ENABLE} + ) + +# Link 3rd Party Libs +target_link_libraries(GUI_Window_FontSelector + IMGUI + ) + +# Link Internal Libs +target_link_libraries(GUI_Window_FontSelector + ERS_Editor_FontManager + ) + +target_include_directories(GUI_Window_FontSelector PUBLIC ./) diff --git a/Source/Core/Editor/Windows/GUI_Window_FontSelector/GUI_Window_FontSelector.cpp b/Source/Core/Editor/Windows/GUI_Window_FontSelector/GUI_Window_FontSelector.cpp new file mode 100644 index 0000000000..b3d33ad938 --- /dev/null +++ b/Source/Core/Editor/Windows/GUI_Window_FontSelector/GUI_Window_FontSelector.cpp @@ -0,0 +1,61 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + + +#include + + +GUI_Window_FontSelector::GUI_Window_FontSelector(ERS_CLASS_FontManager* FontManager) { + + FontManager_ = FontManager; + +} + +GUI_Window_FontSelector::~GUI_Window_FontSelector() { + +} + + +void GUI_Window_FontSelector::Draw() { + + if (Enabled_) { + + ImGuiWindowFlags Flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse; + if (ImGui::Begin("Font Selector", &Enabled_, Flags)) { + ImGui::SetWindowSize(ImVec2(0,0)); + + ImGui::BeginChild("Font Radio Buttons", ImVec2(300, 400), true); + + for (int i = 0; (long)i < (long)FontManager_->FontNameList_.size(); i++) { + ImGui::RadioButton(FontManager_->FontNameList_[i].c_str(), &FontManager_->FontSelector_, i); + } + + ImGui::EndChild(); + + ImGui::Separator(); + + ImGui::SliderFloat("Font Size", &FontManager_->FontSize_, 5.0f, 30.0f); + + ImGui::Separator(); + + if (ImGui::Button("Reload")) { + FontManager_->IndexFonts(); + } + ImGui::SameLine(); + + if (ImGui::Button("Apply")) { + FontManager_->UpdateFont_ = true; + } + ImGui::SameLine(); + + if (ImGui::Button("Close")) { + Enabled_ = false; + } + + + ImGui::End(); + } + + } +} \ No newline at end of file diff --git a/Source/Core/Editor/Windows/GUI_Window_FontSelector/GUI_Window_FontSelector.h b/Source/Core/Editor/Windows/GUI_Window_FontSelector/GUI_Window_FontSelector.h new file mode 100644 index 0000000000..8c8d31b9a7 --- /dev/null +++ b/Source/Core/Editor/Windows/GUI_Window_FontSelector/GUI_Window_FontSelector.h @@ -0,0 +1,56 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#pragma once + + +// Standard Libraries (BG convention: use <> instead of "") + +// Third-Party Libraries (BG convention: use <> instead of "") +#include + +// Internal Libraries (BG convention: use <> instead of "") +#include + + +/** + * @brief This Class Provides The Font Selector Window. + * + */ +class GUI_Window_FontSelector { + +private: + + ERS_CLASS_FontManager* FontManager_; /**