Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Images/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 2 additions & 25 deletions Internal/Features/ExampleFeature/ExampleFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,11 @@ bool ExampleFeature::SetupMenu()
{ "EXAMPLE_COLORPICKER"Hashed, "Przykładowy próbnik kolorów" }
});

GuiSection->SetCallback([]() {
ImGuiContext* pContext = ImGui::GetCurrentContext();

ImVec2 vec2Size = (Framework::menu->m_stStyle.vec2Size / ImVec2{ 3.f, 2.f }) - pContext->Style.ItemSpacing;
ImVec2 vec2MaxSize = ImGui::GetContentRegionAvail();

if (vec2Size.x > vec2MaxSize.x)
vec2Size.x = vec2MaxSize.x;

if (vec2Size.y > vec2MaxSize.y)
vec2Size.y = vec2MaxSize.y;

return vec2Size;
});

GuiSection->AddElement(GuiCheckbox.get());
GuiCheckbox->AddElement(GuiEnabledText.get());
GuiCheckbox->AddElement(GuiEnabledSlider.get());
GuiSection->AddElement(GuiColorPickerLabel.get());
GuiSection->AddElement(GuiColorPicker.get());

return true;
}

void ExampleFeature::HandleMenu()
{
if (!GuiSection->HasParent())
Framework::menu->AddElement(GuiSection.get());

GuiCheckbox->SetChildrenVisible(GuiCheckbox->GetValue());
if (!m_pBodyGroup->HasParent())
Framework::menu->GetChild("HEADER_GROUP")->GetChild("BODY")->AddElement(m_pBodyGroup.get());
}
93 changes: 85 additions & 8 deletions Internal/Features/ExampleFeature/ExampleFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,94 @@
#include "pch.h"
#include "Includes.h"

class ExampleBodyGroup : public ElementBase
{
protected:
uint8_t m_iPageId;
uint8_t m_iSubPageId;

public:
ExampleBodyGroup(std::string sUnique, Style_t stStyle = {}, uint8_t iPageId = 0, uint8_t iSubPageId = 0)
{
m_sUnique = sUnique;
m_stStyle = stStyle;
m_iPageId = iPageId;
m_iSubPageId = iSubPageId;
};

constexpr EElementType GetType() const override
{
return EElementType::BodyGroup;
};

void Render() override
{
if (!m_stStyle.bVisible)
return;

if (m_iPageId != eCurrentPage || m_iSubPageId != eCurrentSubPage)
return;

float fGroupWidth = (ImGui::GetWindowWidth() - 10.0f - 10.0f * 2) / 2;
float fGroupHeight = (ImGui::GetWindowHeight() - 10.0f - 10.0f * 2) / 2;

ImGui::BeginGroup();
{
ImGui::BeginChild("group1", ImVec2(fGroupWidth, fGroupHeight), ImGuiChildFlags_Border);
{
ImGui::TextDisabled("GROUP1");

static bool bEnabled = true;
static bool bDisabled = false;
ImAdd::SmallCheckbox("Enabled", &bEnabled);
ImAdd::SmallCheckbox("Disabled", &bDisabled);

ImGui::SameLine(ImGui::GetWindowWidth() - 10.0f - ImGui::GetFontSize() * 2);
static ImVec4 v4Color = ImVec4(1, 1, 0, 0.5f);
ImAdd::ColorEdit4("##Color Picker", (float*)&v4Color);
}
ImGui::EndChild();
ImGui::BeginChild("group2", ImVec2(fGroupWidth, 0), ImGuiChildFlags_Border);
{
ImGui::TextDisabled("GROUP2");

static bool bEnabled = true;
static bool bDisabled = false;
ImAdd::Togglebutton("Enabled", &bEnabled);
ImAdd::Togglebutton("Disabled", &bDisabled);
}
ImGui::EndChild();
}
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginChild("group3", ImVec2(0, 0), ImGuiChildFlags_Border);
{
ImGui::TextDisabled("GROUP3");

static int iCombo = 0;
ImAdd::Combo("Combo", &iCombo, "Item 1\0Item 2\0Item 3\0", -0.1f);

static char inputText[32] = "";
ImAdd::InputText("Text Input", "Write something here...", inputText, IM_ARRAYSIZE(inputText), -0.1f);

static int iSlider = 8;
static float fSlider = 3;
ImAdd::SliderInt("Slider Int", &iSlider, 0, 10, -0.1f);
ImAdd::SliderFloat("Slider Float", &fSlider, 0, 10, -0.1f);

ImGui::Separator();

ImAdd::Button("Button", ImVec2(-0.1f, 0));
ImAdd::AcentButton("Acent button", ImVec2(-0.1f, 0));
}
ImGui::EndChild();
}
};

class ExampleFeature : public BaseFeature
{
private:
std::unique_ptr<Child> GuiSection = std::make_unique<Child>("EXAMPLE_FEATURE", "EXAMPLE_FEATURE"Hashed, ElementBase::Style_t{
.iFlags = ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY }, ImGuiWindowFlags_HorizontalScrollbar);
std::unique_ptr<Checkbox> GuiCheckbox = std::make_unique<Checkbox>("CHECKBOX", "EXAMPLE_FEATURE"Hashed);
std::unique_ptr<Text> GuiEnabledText = std::make_unique<Text>("CHECKBOX_ENABLED_TEXT", "EXAMPLE_FEATURE_HW"Hashed);
std::unique_ptr<SliderInt> GuiEnabledSlider = std::make_unique<SliderInt>("CHECKBOX_ENABLED_SLIDER", "EXAMPLE_FEATURE_SLIDER"Hashed);
std::unique_ptr<Text> GuiColorPickerLabel = std::make_unique<Text>("EXAMPLE_COLORPICKER_LABEL", "EXAMPLE_COLORPICKER"Hashed);
std::unique_ptr<ColorPicker> GuiColorPicker = std::make_unique<ColorPicker>("EXAMPLE_COLORPICKER", "EXAMPLE_COLORPICKER"Hashed, ElementBase::Style_t{
.iFlags = ImGuiColorEditFlags_NoInputs});
std::unique_ptr<ExampleBodyGroup> m_pBodyGroup = std::make_unique<ExampleBodyGroup>("EXAMPLE_BODY_GROUP", ElementBase::Style_t(), ElementBase::EPage::Developer, 0);

public:
bool SetupMenu();
Expand Down
3 changes: 3 additions & 0 deletions Internal/GUI/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ void GUI::Render()
GuiSidebar->AddElement(GuiStyle.get());
GuiSidebar->AddElement(GuiSettings.get());
GuiSidebar->AddElement(GuiConfig.get());

GuiHeaderGroup->AddElement(GuiBody.get());
});

/*
Expand All @@ -119,6 +121,7 @@ void GUI::Render()

if (!GuiSidebar->HasParent()) {
Framework::menu->AddElement(GuiSidebar.get());
Framework::menu->AddElement(GuiHeaderGroup.get());
}

for (auto& pFeature : Framework::g_vecFeatures)
Expand Down
10 changes: 10 additions & 0 deletions Internal/GUI/GUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ namespace GUI
.vec2Size = ImVec2(-0.1f, 0) }, ICON_FA_GEAR, ElementBase::EPage::Settings);
inline std::unique_ptr<RadioButtonIcon> GuiConfig = std::make_unique<RadioButtonIcon>(std::string("CONFIG_BUTTON"), "CONFIG_BUTTON"Hashed, ElementBase::Style_t{
.vec2Size = ImVec2(-0.1f, 0) }, ICON_FA_FLOPPY_DISK, ElementBase::EPage::Config);

inline std::vector<ElementBase::Header_t> HeaderGroupHeaders = {
{ ElementBase::EPage::Developer, { "MAIN"Hashed, "EXAMPLE"Hashed, "EXAMPLE2"Hashed } }
};
inline std::unique_ptr<HeaderGroup> GuiHeaderGroup = std::make_unique<HeaderGroup>(std::string("HEADER_GROUP"), "HEADER_GROUP"Hashed, ElementBase::Style_t{
.vec2Size = ImVec2(-0.1f, 0), }, HeaderGroupHeaders);

inline std::unique_ptr<Body> GuiBody = std::make_unique<Body>(std::string("BODY"), ElementBase::Style_t{
.vec2Size = ImVec2(-0.1f, 0), });

/*
inline std::unique_ptr<Child> GuiCheat = std::make_unique<Child>(std::string("CHEAT"), "CHEAT"Hashed, ElementBase::Style_t{
.iFlags = ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY }, ImGuiWindowFlags_HorizontalScrollbar);
Expand Down
127 changes: 124 additions & 3 deletions Internal/GUI/Menu/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class ElementBase
InputText,
Menu,
RadioButtonIcon,
HeaderGroup,
Body,
BodyGroup,
SliderFloat,
SliderInt,
SeperatorText,
Expand Down Expand Up @@ -53,6 +56,12 @@ class ElementBase
Config
};

typedef struct Header_t
{
uint8_t m_iParentPageID;
std::vector<size_t> m_ullLocalizedNameHashes;
} Header_t;

protected:
// used to display a custom or unlocalized name for elements like buttons
bool m_bUnlocalizedName = false;
Expand All @@ -65,6 +74,9 @@ class ElementBase
ElementBase* m_pParent = nullptr;
std::vector<ElementBase*> m_Children;

inline static uint8_t eCurrentPage = ElementBase::EPage::Developer;
inline static uint8_t eCurrentSubPage = 0;

inline void SameLine()
{
switch (m_stStyle.eSameLine)
Expand Down Expand Up @@ -277,8 +289,6 @@ class ElementBase
};
};

static uint8_t eCurrentPage = ElementBase::EPage::Developer;

template<typename T>
class ElementInput : public ElementBase
{
Expand Down Expand Up @@ -1246,6 +1256,117 @@ class RadioButtonIcon : public ElementBase

SameLine();

ImAdd::RadioButtonIcon(GetName().c_str(), m_sIcon, GetName().c_str(), &eCurrentPage, m_iPageId, m_stStyle.vec2Size);
if (ImAdd::RadioButtonIcon(GetName().c_str(), m_sIcon, GetName().c_str(), &eCurrentPage, m_iPageId, m_stStyle.vec2Size)) {
eCurrentPage = m_iPageId;
}
};
};

class HeaderGroup : public ElementBase
{
protected:
std::vector<Header_t> m_Headers;

public:
HeaderGroup(std::string sUnique, size_t ullLocalizedNameHash, Style_t stStyle = {}, std::vector<Header_t> Headers = {})
{
m_sUnique = sUnique;
m_ullLocalizedNameHash = ullLocalizedNameHash;
m_stStyle = stStyle;
m_Headers = Headers;
};

HeaderGroup(std::string sUnique, std::string sUnlocalizedName, Style_t stStyle = {}, std::vector<Header_t> Headers = {})
{
m_sUnique = sUnique;
m_bUnlocalizedName = true;
m_sUnlocalizedName = sUnlocalizedName;
m_stStyle = stStyle;
m_Headers = Headers;
};

constexpr EElementType GetType() const override
{
return EElementType::HeaderGroup;
};

void Render() override
{
if (!m_stStyle.bVisible)
return;

ImGui::SameLine(160);
ImGui::BeginChild(m_sUnique.c_str(), ImVec2(0, ImGui::GetFrameHeight() + 10.0f * 2), ImGuiChildFlags_Border, ImGuiWindowFlags_NoBackground);
{
for (auto Header : m_Headers)
{
if (Header.m_iParentPageID != eCurrentPage)
continue;

for (int i = 0; i < Header.m_ullLocalizedNameHashes.size(); i++) {
uint8_t test;
if (ImAdd::RadioButton(Localization::Get(Header.m_ullLocalizedNameHashes[i]).c_str(), &test, i)) {
eCurrentSubPage = i;
}
ImGui::SameLine();
}
}
ImGui::NewLine();

// Search bar
/*
ImGui::SameLine(ImGui::GetWindowWidth() - 160 - 10.0f - 10.0f - 1);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 6);
{
ImGui::BeginGroup();
{
if (1 > 0)
{
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(NULL, 3));
{
ImAdd::VSeparator(1);
}
ImGui::PopStyleVar();
ImGui::SameLine();
}
static char cSearch[32] = "";
ImAdd::InputText("##Search", "Search", cSearch, IM_ARRAYSIZE(cSearch), 160);
}
ImGui::EndGroup();
}
ImGui::PopStyleVar();
*/
}
ImGui::EndChild();
RenderChildren();
}
};

class Body : public ElementBase
{
public:
Body(std::string sUnique, Style_t stStyle = {})
{
m_sUnique = sUnique;
m_stStyle = stStyle;
};

constexpr EElementType GetType() const override
{
return EElementType::Body;
};

void Render() override
{
if (!m_stStyle.bVisible)
return;

ImGui::SetCursorPosX(160);
ImGui::SetCursorPosY(ImGui::GetFrameHeight() + 10.0f * 2);
ImGui::BeginChild(m_sUnique.c_str(), ImVec2(0, ImGui::GetWindowHeight() - ImGui::GetFrameHeight() - (ImGui::GetFrameHeight() + 10.0f * 2)), ImGuiChildFlags_Border, ImGuiWindowFlags_NoBackground);
{
RenderChildren();
}
ImGui::EndChild();
}
};
4 changes: 4 additions & 0 deletions Internal/Localization/Locales/English.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ Locale_t localeEnglish{
{ "STYLE_BUTTON"Hashed, "Style" },
{ "SETTINGS_BUTTON"Hashed, "Settings" },
{ "CONFIG_BUTTON"Hashed, "Config" },

{ "MAIN"Hashed, "Main" },
{ "EXAMPLE"Hashed, "Example" },
{ "EXAMPLE2"Hashed, "Example2" }
}),
};
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# IMPORTANT
The framework is in a weird spot right now so the menu builder is kinda fucked, while we are redesigning it it will be finished SoonTM
The menu overhall is nearing completion but it is still in a weird spot and is not as simple to implement as I would like it to be but it works!

# OmegaWare Cheat Framework
![Logo](Images/NewLogo.png)
<br><br>Menu Design:<br>
![Menu](Images/menu.png)
<br><br>Console Appearence:<br>
![Menu](Images/console.png)

<div align="center">

Expand Down