Added Themes

This commit is contained in:
OusmBlueNinja 2024-12-25 22:00:13 -06:00
parent eab8d26783
commit d71876544a
9 changed files with 414 additions and 42 deletions

View File

@ -2,7 +2,7 @@
A 3D Game engine for Small to Medium-sized games with a LUA Scripting interface. written in C++ with a simple, Good looking interface.
## Screen Shots
## History Of Tesseract
### Note: These screenshots are sorted by version.

BIN
assets/textures/bricks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -4,7 +4,7 @@ Size=1920,1177
Collapsed=0
[Window][Debug##Default]
Pos=60,60
Pos=468,672
Size=400,400
Collapsed=0
@ -46,7 +46,7 @@ DockId=0x00000009,0
[Docking][Data]
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,27 Size=1904,1142 Split=X Selected=0xF7365A5A
DockNode ID=0x00000009 Parent=0x14621557 SizeRef=365,1142 Selected=0x3DC5AC3F
DockNode ID=0x00000009 Parent=0x14621557 SizeRef=365,1142 HiddenTabBar=1 Selected=0x3DC5AC3F
DockNode ID=0x0000000A Parent=0x14621557 SizeRef=1537,1142 Split=X
DockNode ID=0x00000007 Parent=0x0000000A SizeRef=357,1142 Selected=0x7737E8B2
DockNode ID=0x00000008 Parent=0x0000000A SizeRef=1545,1142 Split=X

View File

@ -0,0 +1,16 @@
#pragma once
#include <string>
//#include <yaml-cpp/yaml.h>
class Component
{
public:
virtual ~Component() {}
virtual const std::string& GetName() const = 0;
// Serialization methods
//virtual YAML::Node Serialize() = 0;
//virtual void Deserialize(const YAML::Node& node) = 0;
};

View File

@ -24,6 +24,9 @@
#include "Windows/SceneWindow.h"
#include "Engine/ThemeManager.h"
#define YAML_CPP_STATIC_DEFINE
#include <yaml-cpp/yaml.h>
@ -101,6 +104,7 @@ bool MyEngine::Init(int width, int height, const std::string& title)
// Style
ImGui::StyleColorsDark();
// Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(m_Window, true);
ImGui_ImplOpenGL3_Init("#version 330");
@ -135,7 +139,7 @@ void MyEngine::Run()
// Pseudocode:
GameObject cube;
cube.name = std::string("Cube");
cube.name = std::string("Default");
cube.transform.position = glm::vec3(0.f, 0.f, 0.f);
cube.transform.rotation = glm::vec3(0.f, 0.5f, 0.f);
cube.transform.scale = glm::vec3(1.f, 1.f, 1.f);
@ -152,6 +156,9 @@ void MyEngine::Run()
// Possibly create more GameObjects with different positions or textures
ThemeManager_ChangeTheme(2);
while (!glfwWindowShouldClose(m_Window) && m_Running)
{

View File

@ -0,0 +1,6 @@
#pragma once //
#include <GL/glew.h>
#include <cstdio>
void ThemeManager_ChangeTheme(int ThemeID);

View File

@ -0,0 +1,311 @@
#include "ThemeManager.h"
#include <stdio.h>
#include "Windows/LoggerWindow.h"
#include "imgui.h"
extern LoggerWindow *g_LoggerWindow;
void SetupImGuiStyle_Bootsrap()
{
// Bootstrap Dark style by Madam-Herta from ImThemes
ImGuiStyle& style = ImGui::GetStyle();
style.Alpha = 1.0f;
style.DisabledAlpha = 0.5f;
style.WindowPadding = ImVec2(11.69999980926514f, 6.0f);
style.WindowRounding = 3.299999952316284f;
style.WindowBorderSize = 0.0f;
style.WindowMinSize = ImVec2(20.0f, 20.0f);
style.WindowTitleAlign = ImVec2(0.0f, 0.5f);
style.WindowMenuButtonPosition = ImGuiDir_Left;
style.ChildRounding = 0.0f;
style.ChildBorderSize = 1.0f;
style.PopupRounding = 0.0f;
style.PopupBorderSize = 1.0f;
style.FramePadding = ImVec2(20.0f, 9.899999618530273f);
style.FrameRounding = 0.0f;
style.FrameBorderSize = 0.0f;
style.ItemSpacing = ImVec2(8.0f, 4.0f);
style.ItemInnerSpacing = ImVec2(4.0f, 4.0f);
style.CellPadding = ImVec2(4.0f, 2.0f);
style.IndentSpacing = 21.0f;
style.ColumnsMinSpacing = 6.0f;
style.ScrollbarSize = 14.0f;
style.ScrollbarRounding = 9.0f;
style.GrabMinSize = 10.0f;
style.GrabRounding = 0.0f;
style.TabRounding = 4.0f;
style.TabBorderSize = 0.0f;
style.TabMinWidthForCloseButton = 0.0f;
style.ColorButtonPosition = ImGuiDir_Right;
style.ButtonTextAlign = ImVec2(0.5f, 0.5f);
style.SelectableTextAlign = ImVec2(0.0f, 0.0f);
style.Colors[ImGuiCol_Text] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.5843137502670288f, 0.5960784554481506f, 0.615686297416687f, 1.0f);
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.062745101749897f, 0.06666667014360428f, 0.08627451211214066f, 1.0f);
style.Colors[ImGuiCol_ChildBg] = ImVec4(0.04313725605607033f, 0.0470588244497776f, 0.05882352963089943f, 1.0f);
style.Colors[ImGuiCol_PopupBg] = ImVec4(0.04313725605607033f, 0.0470588244497776f, 0.05882352963089943f, 1.0f);
style.Colors[ImGuiCol_Border] = ImVec4(0.1098039224743843f, 0.1137254908680916f, 0.1333333402872086f, 1.0f);
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.1098039224743843f, 0.1137254908680916f, 0.1333333402872086f, 1.0f);
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.062745101749897f, 0.06666667014360428f, 0.08627451211214066f, 1.0f);
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.05882352963089943f, 0.529411792755127f, 0.9764705896377563f, 1.0f);
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.05882352963089943f, 0.529411792755127f, 0.9764705896377563f, 0.0f);
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.0470588244497776f, 0.05098039284348488f, 0.062745101749897f, 1.0f);
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.04313725605607033f, 0.0470588244497776f, 0.05882352963089943f, 1.0f);
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.04313725605607033f, 0.0470588244497776f, 0.05882352963089943f, 1.0f);
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.04313725605607033f, 0.0470588244497776f, 0.05882352963089943f, 1.0f);
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.04313725605607033f, 0.0470588244497776f, 0.05882352963089943f, 1.0f);
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.1098039224743843f, 0.1137254908680916f, 0.1333333402872086f, 1.0f);
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.1450980454683304f, 0.1490196138620377f, 0.1843137294054031f, 1.0f);
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.4862745106220245f, 0.4862745106220245f, 0.4862745106220245f, 1.0f);
style.Colors[ImGuiCol_CheckMark] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
style.Colors[ImGuiCol_SliderGrab] = ImVec4(1.0f, 1.0f, 1.0f, 0.2274678349494934f);
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.8196078538894653f, 0.8196078538894653f, 0.8196078538894653f, 0.3304721117019653f);
style.Colors[ImGuiCol_Button] = ImVec4(0.2274509817361832f, 0.4431372582912445f, 0.7568627595901489f, 1.0f);
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.2078431397676468f, 0.4705882370471954f, 0.8509804010391235f, 1.0f);
style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.05882352963089943f, 0.529411792755127f, 0.9764705896377563f, 1.0f);
style.Colors[ImGuiCol_Header] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 0.3100000023841858f);
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 0.800000011920929f);
style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 1.0f);
style.Colors[ImGuiCol_Separator] = ImVec4(0.3882353007793427f, 0.3882353007793427f, 0.3882353007793427f, 0.6200000047683716f);
style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.1372549086809158f, 0.4392156898975372f, 0.800000011920929f, 0.7799999713897705f);
style.Colors[ImGuiCol_SeparatorActive] = ImVec4(0.1372549086809158f, 0.4392156898975372f, 0.800000011920929f, 1.0f);
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.3490196168422699f, 0.3490196168422699f, 0.3490196168422699f, 0.1700000017881393f);
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 1.0f);
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 0.949999988079071f);
style.Colors[ImGuiCol_Tab] = ImVec4(0.0f, 0.4745098054409027f, 1.0f, 0.9309999942779541f);
style.Colors[ImGuiCol_TabHovered] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 0.800000011920929f);
style.Colors[ImGuiCol_TabActive] = ImVec4(0.2078431397676468f, 0.2078431397676468f, 0.2078431397676468f, 1.0f);
style.Colors[ImGuiCol_TabUnfocused] = ImVec4(0.9176470637321472f, 0.9254902005195618f, 0.9333333373069763f, 0.9861999750137329f);
style.Colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.7411764860153198f, 0.8196078538894653f, 0.9137254953384399f, 1.0f);
style.Colors[ImGuiCol_PlotLines] = ImVec4(0.3882353007793427f, 0.3882353007793427f, 0.3882353007793427f, 1.0f);
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.0f, 0.4274509847164154f, 0.3490196168422699f, 1.0f);
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.8980392217636108f, 0.6980392336845398f, 0.0f, 1.0f);
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.0f, 0.4470588266849518f, 0.0f, 1.0f);
style.Colors[ImGuiCol_TableHeaderBg] = ImVec4(0.7764706015586853f, 0.8666666746139526f, 0.9764705896377563f, 1.0f);
style.Colors[ImGuiCol_TableBorderStrong] = ImVec4(0.5686274766921997f, 0.5686274766921997f, 0.6392157077789307f, 1.0f);
style.Colors[ImGuiCol_TableBorderLight] = ImVec4(0.6784313917160034f, 0.6784313917160034f, 0.7372549176216125f, 1.0f);
style.Colors[ImGuiCol_TableRowBg] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);
style.Colors[ImGuiCol_TableRowBgAlt] = ImVec4(0.2980392277240753f, 0.2980392277240753f, 0.2980392277240753f, 0.09000000357627869f);
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 0.3499999940395355f);
style.Colors[ImGuiCol_DragDropTarget] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 0.949999988079071f);
style.Colors[ImGuiCol_NavHighlight] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 0.800000011920929f);
style.Colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.6980392336845398f, 0.6980392336845398f, 0.6980392336845398f, 0.699999988079071f);
style.Colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.2000000029802322f, 0.2000000029802322f, 0.2000000029802322f, 0.2000000029802322f);
style.Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.2000000029802322f, 0.2000000029802322f, 0.2000000029802322f, 0.3499999940395355f);
}
void SetupImGuiStyle_Duck_Red()
{
// DUCK RED nope! is DARK RED style by for40255 from ImThemes
ImGuiStyle& style = ImGui::GetStyle();
style.Alpha = 1.0f;
style.DisabledAlpha = 0.6000000238418579f;
style.WindowPadding = ImVec2(8.0f, 8.0f);
style.WindowRounding = 0.0f;
style.WindowBorderSize = 1.0f;
style.WindowMinSize = ImVec2(32.0f, 32.0f);
style.WindowTitleAlign = ImVec2(0.5f, 0.5f);
style.WindowMenuButtonPosition = ImGuiDir_Left;
style.ChildRounding = 0.0f;
style.ChildBorderSize = 1.0f;
style.PopupRounding = 0.0f;
style.PopupBorderSize = 1.0f;
style.FramePadding = ImVec2(4.0f, 3.0f);
style.FrameRounding = 0.0f;
style.FrameBorderSize = 0.0f;
style.ItemSpacing = ImVec2(8.0f, 4.0f);
style.ItemInnerSpacing = ImVec2(4.0f, 4.0f);
style.CellPadding = ImVec2(4.0f, 2.0f);
style.IndentSpacing = 21.0f;
style.ColumnsMinSpacing = 6.0f;
style.ScrollbarSize = 14.0f;
style.ScrollbarRounding = 0.0f;
style.GrabMinSize = 10.0f;
style.GrabRounding = 0.0f;
style.TabRounding = 0.0f;
style.TabBorderSize = 0.0f;
style.TabMinWidthForCloseButton = 0.0f;
style.ColorButtonPosition = ImGuiDir_Right;
style.ButtonTextAlign = ImVec2(0.5f, 0.5f);
style.SelectableTextAlign = ImVec2(0.0f, 0.0f);
style.Colors[ImGuiCol_Text] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.4980392158031464f, 0.4980392158031464f, 0.4980392158031464f, 1.0f);
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.03921568766236305f, 0.03921568766236305f, 0.03921568766236305f, 1.0f);
style.Colors[ImGuiCol_ChildBg] = ImVec4(0.05490196123719215f, 0.05490196123719215f, 0.05490196123719215f, 1.0f);
style.Colors[ImGuiCol_PopupBg] = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_Border] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.1176470592617989f, 0.1176470592617989f, 0.1176470592617989f, 1.0f);
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(1.0f, 0.0f, 0.0f, 0.5647059082984924f);
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(1.0f, 0.0f, 0.0f, 0.5647059082984924f);
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.03921568766236305f, 0.03921568766236305f, 0.03921568766236305f, 1.0f);
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.0784313753247261f, 0.0784313753247261f, 0.0784313753247261f, 0.9411764740943909f);
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(1.0f, 0.0f, 0.0f, 0.5647059082984924f);
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(1.0f, 0.0f, 0.0f, 0.501960813999176f);
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_CheckMark] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_SliderGrab] = ImVec4(1.0f, 0.0f, 0.0f, 0.8154506683349609f);
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(1.0f, 0.0f, 0.0f, 0.8156862854957581f);
style.Colors[ImGuiCol_Button] = ImVec4(1.0f, 0.0f, 0.0f, 0.501960813999176f);
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(1.0f, 0.0f, 0.0f, 0.7450980544090271f);
style.Colors[ImGuiCol_ButtonActive] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_Header] = ImVec4(1.0f, 0.0f, 0.0f, 0.6566523313522339f);
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(1.0f, 0.0f, 0.0f, 0.8039215803146362f);
style.Colors[ImGuiCol_HeaderActive] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_Separator] = ImVec4(0.0784313753247261f, 0.0784313753247261f, 0.0784313753247261f, 0.501960813999176f);
style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.0784313753247261f, 0.0784313753247261f, 0.0784313753247261f, 0.6695278882980347f);
style.Colors[ImGuiCol_SeparatorActive] = ImVec4(0.0784313753247261f, 0.0784313753247261f, 0.0784313753247261f, 0.9570815563201904f);
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.1019607856869698f, 0.1137254908680916f, 0.1294117718935013f, 0.2000000029802322f);
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.2039215713739395f, 0.2078431397676468f, 0.2156862765550613f, 0.2000000029802322f);
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.3019607961177826f, 0.3019607961177826f, 0.3019607961177826f, 0.2000000029802322f);
style.Colors[ImGuiCol_Tab] = ImVec4(1.0f, 0.0f, 0.0f, 0.4392156898975372f);
style.Colors[ImGuiCol_TabHovered] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_TabActive] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_TabUnfocused] = ImVec4(0.06666667014360428f, 0.06666667014360428f, 0.06666667014360428f, 0.9725490212440491f);
style.Colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.06666667014360428f, 0.06666667014360428f, 0.06666667014360428f, 1.0f);
style.Colors[ImGuiCol_PlotLines] = ImVec4(0.6078431606292725f, 0.6078431606292725f, 0.6078431606292725f, 1.0f);
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.9490196108818054f, 0.3450980484485626f, 0.3450980484485626f, 1.0f);
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.9490196108818054f, 0.3450980484485626f, 0.3450980484485626f, 1.0f);
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.4274509847164154f, 0.3607843220233917f, 0.3607843220233917f, 1.0f);
style.Colors[ImGuiCol_TableHeaderBg] = ImVec4(1.0f, 0.0f, 0.0f, 0.7124463319778442f);
style.Colors[ImGuiCol_TableBorderStrong] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_TableBorderLight] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_TableRowBg] = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_TableRowBgAlt] = ImVec4(0.196078434586525f, 0.196078434586525f, 0.196078434586525f, 0.6274510025978088f);
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
style.Colors[ImGuiCol_DragDropTarget] = ImVec4(0.2588235437870026f, 0.2705882489681244f, 0.3803921639919281f, 1.0f);
style.Colors[ImGuiCol_NavHighlight] = ImVec4(0.1803921610116959f, 0.2274509817361832f, 0.2784313857555389f, 1.0f);
style.Colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.0f, 1.0f, 1.0f, 0.699999988079071f);
style.Colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.800000011920929f, 0.800000011920929f, 0.800000011920929f, 0.2000000029802322f);
style.Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.800000011920929f, 0.800000011920929f, 0.800000011920929f, 0.3499999940395355f);
}
void SetupImGuiStyle_Windark()
{
// Windark style by DestroyerDarkNess from ImThemes
ImGuiStyle& style = ImGui::GetStyle();
style.Alpha = 1.0f;
style.DisabledAlpha = 0.6000000238418579f;
style.WindowPadding = ImVec2(8.0f, 8.0f);
style.WindowRounding = 8.399999618530273f;
style.WindowBorderSize = 1.0f;
style.WindowMinSize = ImVec2(32.0f, 32.0f);
style.WindowTitleAlign = ImVec2(0.0f, 0.5f);
style.WindowMenuButtonPosition = ImGuiDir_Right;
style.ChildRounding = 3.0f;
style.ChildBorderSize = 1.0f;
style.PopupRounding = 3.0f;
style.PopupBorderSize = 1.0f;
style.FramePadding = ImVec2(4.0f, 3.0f);
style.FrameRounding = 3.0f;
style.FrameBorderSize = 1.0f;
style.ItemSpacing = ImVec2(8.0f, 4.0f);
style.ItemInnerSpacing = ImVec2(4.0f, 4.0f);
style.CellPadding = ImVec2(4.0f, 2.0f);
style.IndentSpacing = 21.0f;
style.ColumnsMinSpacing = 6.0f;
style.ScrollbarSize = 5.599999904632568f;
style.ScrollbarRounding = 18.0f;
style.GrabMinSize = 10.0f;
style.GrabRounding = 3.0f;
style.TabRounding = 3.0f;
style.TabBorderSize = 0.0f;
style.TabMinWidthForCloseButton = 0.0f;
style.ColorButtonPosition = ImGuiDir_Right;
style.ButtonTextAlign = ImVec2(0.5f, 0.5f);
style.SelectableTextAlign = ImVec2(0.0f, 0.0f);
style.Colors[ImGuiCol_Text] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.6000000238418579f, 0.6000000238418579f, 0.6000000238418579f, 1.0f);
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.125490203499794f, 0.125490203499794f, 0.125490203499794f, 1.0f);
style.Colors[ImGuiCol_ChildBg] = ImVec4(0.125490203499794f, 0.125490203499794f, 0.125490203499794f, 1.0f);
style.Colors[ImGuiCol_PopupBg] = ImVec4(0.168627455830574f, 0.168627455830574f, 0.168627455830574f, 1.0f);
style.Colors[ImGuiCol_Border] = ImVec4(0.250980406999588f, 0.250980406999588f, 0.250980406999588f, 1.0f);
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.168627455830574f, 0.168627455830574f, 0.168627455830574f, 1.0f);
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.2156862765550613f, 0.2156862765550613f, 0.2156862765550613f, 1.0f);
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.250980406999588f, 0.250980406999588f, 0.250980406999588f, 1.0f);
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.125490203499794f, 0.125490203499794f, 0.125490203499794f, 1.0f);
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.168627455830574f, 0.168627455830574f, 0.168627455830574f, 1.0f);
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.125490203499794f, 0.125490203499794f, 0.125490203499794f, 1.0f);
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.168627455830574f, 0.168627455830574f, 0.168627455830574f, 1.0f);
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.125490203499794f, 0.125490203499794f, 0.125490203499794f, 1.0f);
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.250980406999588f, 0.250980406999588f, 0.250980406999588f, 1.0f);
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.3019607961177826f, 0.3019607961177826f, 0.3019607961177826f, 1.0f);
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.3490196168422699f, 0.3490196168422699f, 0.3490196168422699f, 1.0f);
style.Colors[ImGuiCol_CheckMark] = ImVec4(0.0f, 0.4705882370471954f, 0.843137264251709f, 1.0f);
style.Colors[ImGuiCol_SliderGrab] = ImVec4(0.0f, 0.4705882370471954f, 0.843137264251709f, 1.0f);
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.0f, 0.3294117748737335f, 0.6000000238418579f, 1.0f);
style.Colors[ImGuiCol_Button] = ImVec4(0.168627455830574f, 0.168627455830574f, 0.168627455830574f, 1.0f);
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.2156862765550613f, 0.2156862765550613f, 0.2156862765550613f, 1.0f);
style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.250980406999588f, 0.250980406999588f, 0.250980406999588f, 1.0f);
style.Colors[ImGuiCol_Header] = ImVec4(0.2156862765550613f, 0.2156862765550613f, 0.2156862765550613f, 1.0f);
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.250980406999588f, 0.250980406999588f, 0.250980406999588f, 1.0f);
style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.3019607961177826f, 0.3019607961177826f, 0.3019607961177826f, 1.0f);
style.Colors[ImGuiCol_Separator] = ImVec4(0.2156862765550613f, 0.2156862765550613f, 0.2156862765550613f, 1.0f);
style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.250980406999588f, 0.250980406999588f, 0.250980406999588f, 1.0f);
style.Colors[ImGuiCol_SeparatorActive] = ImVec4(0.3019607961177826f, 0.3019607961177826f, 0.3019607961177826f, 1.0f);
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.2156862765550613f, 0.2156862765550613f, 0.2156862765550613f, 1.0f);
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.250980406999588f, 0.250980406999588f, 0.250980406999588f, 1.0f);
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.3019607961177826f, 0.3019607961177826f, 0.3019607961177826f, 1.0f);
style.Colors[ImGuiCol_Tab] = ImVec4(0.168627455830574f, 0.168627455830574f, 0.168627455830574f, 1.0f);
style.Colors[ImGuiCol_TabHovered] = ImVec4(0.2156862765550613f, 0.2156862765550613f, 0.2156862765550613f, 1.0f);
style.Colors[ImGuiCol_TabActive] = ImVec4(0.250980406999588f, 0.250980406999588f, 0.250980406999588f, 1.0f);
style.Colors[ImGuiCol_TabUnfocused] = ImVec4(0.168627455830574f, 0.168627455830574f, 0.168627455830574f, 1.0f);
style.Colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.2156862765550613f, 0.2156862765550613f, 0.2156862765550613f, 1.0f);
style.Colors[ImGuiCol_PlotLines] = ImVec4(0.0f, 0.4705882370471954f, 0.843137264251709f, 1.0f);
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.0f, 0.3294117748737335f, 0.6000000238418579f, 1.0f);
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.0f, 0.4705882370471954f, 0.843137264251709f, 1.0f);
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.0f, 0.3294117748737335f, 0.6000000238418579f, 1.0f);
style.Colors[ImGuiCol_TableHeaderBg] = ImVec4(0.1882352977991104f, 0.1882352977991104f, 0.2000000029802322f, 1.0f);
style.Colors[ImGuiCol_TableBorderStrong] = ImVec4(0.3098039329051971f, 0.3098039329051971f, 0.3490196168422699f, 1.0f);
style.Colors[ImGuiCol_TableBorderLight] = ImVec4(0.2274509817361832f, 0.2274509817361832f, 0.2470588237047195f, 1.0f);
style.Colors[ImGuiCol_TableRowBg] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);
style.Colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.0f, 1.0f, 1.0f, 0.05999999865889549f);
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.0f, 0.4705882370471954f, 0.843137264251709f, 1.0f);
style.Colors[ImGuiCol_DragDropTarget] = ImVec4(1.0f, 1.0f, 0.0f, 0.8999999761581421f);
style.Colors[ImGuiCol_NavHighlight] = ImVec4(0.2588235437870026f, 0.5882353186607361f, 0.9764705896377563f, 1.0f);
style.Colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.0f, 1.0f, 1.0f, 0.699999988079071f);
style.Colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.800000011920929f, 0.800000011920929f, 0.800000011920929f, 0.2000000029802322f);
style.Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.800000011920929f, 0.800000011920929f, 0.800000011920929f, 0.3499999940395355f);
}
void ThemeManager_ChangeTheme(int ThemeID)
{
g_LoggerWindow->AddLog("Changed Global Theme To: %d", ThemeID);
switch (ThemeID) {
case 0:
SetupImGuiStyle_Bootsrap();
// Add your logic for Option 1 here
break;
case 1:
SetupImGuiStyle_Duck_Red();
// Add your logic for Option 2 here
break;
case 2:
SetupImGuiStyle_Windark();
// Add your logic for Option 3 here
break;
default:
SetupImGuiStyle_Windark();
break;
}
}

View File

@ -1,25 +1,29 @@
#include "PerformanceWindow.h"
#include "imgui.h"
#include <algorithm> // for std::max_element, etc.
#include "Engine/ThemeManager.h"
extern int LoaddedAssets;
// Initialize static members
int PerformanceWindow::m_OpenGLCallCount = 0;
int PerformanceWindow::m_TriangleCount = 0;
int PerformanceWindow::m_TriangleCount = 0;
// We'll store up to 60 data points for each stat.
static float s_FpsHistory[60] = {0.0f};
static float s_MsHistory[60] = {0.0f};
static float s_CallsHistory[60] = {0.0f};
static float s_FpsHistory[60] = {0.0f};
static float s_MsHistory[60] = {0.0f};
static float s_CallsHistory[60] = {0.0f};
static float s_TriangleHistory[60] = {0.0f};
// Current dynamic max scale for FPS and ms
static float s_FpsScale = 120.0f; // default starting scale for FPS
static float s_MsScale = 25.0f; // default starting scale for ms
static float s_MsScale = 25.0f; // default starting scale for ms
// This function shifts the old values left and appends a new value at the end.
static void PushValueToHistory(float* historyArray, int historySize, float newValue)
static void PushValueToHistory(float *historyArray, int historySize, float newValue)
{
for (int i = 0; i < historySize - 1; i++)
historyArray[i] = historyArray[i + 1];
@ -36,13 +40,13 @@ static double s_LastScaleUpdate = 0.0;
void PerformanceWindow::UpdatePerformanceStats(int newCallCount, int newTriangleCount)
{
m_OpenGLCallCount = newCallCount;
m_TriangleCount = newTriangleCount;
m_TriangleCount = newTriangleCount;
}
void PerformanceWindow::Show(float fps, float ms)
{
// 1) Get current time from ImGui's internal clock
double currentTime = ImGui::GetTime();
double currentTime = ImGui::GetTime();
// 2) If at least 0.05s has passed, push new data (about 20 updates per second)
if ((currentTime - s_LastPushTime) >= 0.05)
@ -50,9 +54,9 @@ void PerformanceWindow::Show(float fps, float ms)
s_LastPushTime = currentTime;
// Push new values into our history arrays
PushValueToHistory(s_FpsHistory, 60, fps);
PushValueToHistory(s_MsHistory, 60, ms);
PushValueToHistory(s_CallsHistory, 60, (float)m_OpenGLCallCount);
PushValueToHistory(s_FpsHistory, 60, fps);
PushValueToHistory(s_MsHistory, 60, ms);
PushValueToHistory(s_CallsHistory, 60, (float)m_OpenGLCallCount);
PushValueToHistory(s_TriangleHistory, 60, (float)m_TriangleCount);
}
@ -70,7 +74,8 @@ void PerformanceWindow::Show(float fps, float ms)
}
// Scale it by +15%, ensure it's not below 1.0
maxFps *= 1.15f;
if (maxFps < 1.0f) maxFps = 1.0f;
if (maxFps < 1.0f)
maxFps = 1.0f;
s_FpsScale = maxFps;
// Find the maximum in s_MsHistory
@ -82,7 +87,8 @@ void PerformanceWindow::Show(float fps, float ms)
}
// Scale it by +15%, ensure it's not below 1.0
maxMs *= 1.15f;
if (maxMs < 1.0f) maxMs = 1.0f;
if (maxMs < 1.0f)
maxMs = 1.0f;
s_MsScale = maxMs;
}
@ -101,45 +107,45 @@ void PerformanceWindow::Show(float fps, float ms)
// Graphs for FPS + MS
// min = 0, max = s_FpsScale or s_MsScale
ImGui::PlotLines("FPS",
s_FpsHistory,
ImGui::PlotLines("FPS",
s_FpsHistory,
IM_ARRAYSIZE(s_FpsHistory),
0,
nullptr,
0.0f,
s_FpsScale,
0,
nullptr,
0.0f,
s_FpsScale,
ImVec2(0, 60));
ImGui::PlotHistogram("ms/frame",
s_MsHistory,
ImGui::PlotHistogram("ms/frame",
s_MsHistory,
IM_ARRAYSIZE(s_MsHistory),
0,
nullptr,
0.0f,
s_MsScale,
0,
nullptr,
0.0f,
s_MsScale,
ImVec2(0, 60));
ImGui::Separator();
// Show OpenGL calls + Triangles
ImGui::Text("OpenGL Calls: %d", m_OpenGLCallCount);
ImGui::PlotLines("GL Calls",
s_CallsHistory,
ImGui::PlotLines("GL Calls",
s_CallsHistory,
IM_ARRAYSIZE(s_CallsHistory),
0,
nullptr,
0.0f,
300.0f,
0,
nullptr,
0.0f,
300.0f,
ImVec2(0, 50));
ImGui::Text("Triangles: %d", m_TriangleCount);
ImGui::PlotHistogram("Triangles",
s_TriangleHistory,
ImGui::PlotHistogram("Triangles",
s_TriangleHistory,
IM_ARRAYSIZE(s_TriangleHistory),
0,
nullptr,
0.0f,
5000.0f,
0,
nullptr,
0.0f,
5000.0f,
ImVec2(0, 50));
ImGui::Separator();
@ -147,6 +153,32 @@ void PerformanceWindow::Show(float fps, float ms)
// Show asset count
ImGui::TextColored(ImVec4(0.4f, 1.0f, 0.4f, 1.0f), "Assets: %d", LoaddedAssets);
ImGui::Separator();
const char *options[] = {"Bootsrap", "Duck Red", "Windark"};
static int current_option = -1; // No selection initially
const char *preview_value = (current_option >= 0 && current_option < 3) ? options[current_option] : "Select an option";
if (ImGui::BeginCombo("Theme", preview_value))
{
for (int n = 0; n < IM_ARRAYSIZE(options); n++)
{
bool is_selected = (current_option == n);
if (ImGui::Selectable(options[n], is_selected))
{
current_option = n; // Update current option
ThemeManager_ChangeTheme(n); // Call the function with the selected option
}
// Set the initial focus when opening the combo (optional)
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
ImGui::End();
ImGui::PopStyleVar();
}