|
2 | 2 | #include "pch.h" |
3 | 3 | #include "Includes.h" |
4 | 4 |
|
| 5 | +class ExampleBodyGroup : public ElementBase |
| 6 | +{ |
| 7 | +protected: |
| 8 | + uint8_t m_iPageId; |
| 9 | + uint8_t m_iSubPageId; |
| 10 | + |
| 11 | +public: |
| 12 | + ExampleBodyGroup(std::string sUnique, Style_t stStyle = {}, uint8_t iPageId = 0, uint8_t iSubPageId = 0) |
| 13 | + { |
| 14 | + m_sUnique = sUnique; |
| 15 | + m_stStyle = stStyle; |
| 16 | + m_iPageId = iPageId; |
| 17 | + m_iSubPageId = iSubPageId; |
| 18 | + }; |
| 19 | + |
| 20 | + constexpr EElementType GetType() const override |
| 21 | + { |
| 22 | + return EElementType::BodyGroup; |
| 23 | + }; |
| 24 | + |
| 25 | + void Render() override |
| 26 | + { |
| 27 | + if (!m_stStyle.bVisible) |
| 28 | + return; |
| 29 | + |
| 30 | + if (m_iPageId != eCurrentPage || m_iSubPageId != eCurrentSubPage) |
| 31 | + return; |
| 32 | + |
| 33 | + float fGroupWidth = (ImGui::GetWindowWidth() - 10.0f - 10.0f * 2) / 2; |
| 34 | + float fGroupHeight = (ImGui::GetWindowHeight() - 10.0f - 10.0f * 2) / 2; |
| 35 | + |
| 36 | + ImGui::BeginGroup(); |
| 37 | + { |
| 38 | + ImGui::BeginChild("group1", ImVec2(fGroupWidth, fGroupHeight), ImGuiChildFlags_Border); |
| 39 | + { |
| 40 | + ImGui::TextDisabled("GROUP1"); |
| 41 | + |
| 42 | + static bool bEnabled = true; |
| 43 | + static bool bDisabled = false; |
| 44 | + ImAdd::SmallCheckbox("Enabled", &bEnabled); |
| 45 | + ImAdd::SmallCheckbox("Disabled", &bDisabled); |
| 46 | + |
| 47 | + ImGui::SameLine(ImGui::GetWindowWidth() - 10.0f - ImGui::GetFontSize() * 2); |
| 48 | + static ImVec4 v4Color = ImVec4(1, 1, 0, 0.5f); |
| 49 | + ImAdd::ColorEdit4("##Color Picker", (float*)&v4Color); |
| 50 | + } |
| 51 | + ImGui::EndChild(); |
| 52 | + ImGui::BeginChild("group2", ImVec2(fGroupWidth, 0), ImGuiChildFlags_Border); |
| 53 | + { |
| 54 | + ImGui::TextDisabled("GROUP2"); |
| 55 | + |
| 56 | + static bool bEnabled = true; |
| 57 | + static bool bDisabled = false; |
| 58 | + ImAdd::Togglebutton("Enabled", &bEnabled); |
| 59 | + ImAdd::Togglebutton("Disabled", &bDisabled); |
| 60 | + } |
| 61 | + ImGui::EndChild(); |
| 62 | + } |
| 63 | + ImGui::EndGroup(); |
| 64 | + ImGui::SameLine(); |
| 65 | + ImGui::BeginChild("group3", ImVec2(0, 0), ImGuiChildFlags_Border); |
| 66 | + { |
| 67 | + ImGui::TextDisabled("GROUP3"); |
| 68 | + |
| 69 | + static int iCombo = 0; |
| 70 | + ImAdd::Combo("Combo", &iCombo, "Item 1\0Item 2\0Item 3\0", -0.1f); |
| 71 | + |
| 72 | + static char inputText[32] = ""; |
| 73 | + ImAdd::InputText("Text Input", "Write something here...", inputText, IM_ARRAYSIZE(inputText), -0.1f); |
| 74 | + |
| 75 | + static int iSlider = 8; |
| 76 | + static float fSlider = 3; |
| 77 | + ImAdd::SliderInt("Slider Int", &iSlider, 0, 10, -0.1f); |
| 78 | + ImAdd::SliderFloat("Slider Float", &fSlider, 0, 10, -0.1f); |
| 79 | + |
| 80 | + ImGui::Separator(); |
| 81 | + |
| 82 | + ImAdd::Button("Button", ImVec2(-0.1f, 0)); |
| 83 | + ImAdd::AcentButton("Acent button", ImVec2(-0.1f, 0)); |
| 84 | + } |
| 85 | + ImGui::EndChild(); |
| 86 | + } |
| 87 | +}; |
| 88 | + |
5 | 89 | class ExampleFeature : public BaseFeature |
6 | 90 | { |
7 | 91 | private: |
8 | | - std::unique_ptr<Child> GuiSection = std::make_unique<Child>("EXAMPLE_FEATURE", "EXAMPLE_FEATURE"Hashed, ElementBase::Style_t{ |
9 | | - .iFlags = ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY }, ImGuiWindowFlags_HorizontalScrollbar); |
10 | | - std::unique_ptr<Checkbox> GuiCheckbox = std::make_unique<Checkbox>("CHECKBOX", "EXAMPLE_FEATURE"Hashed); |
11 | | - std::unique_ptr<Text> GuiEnabledText = std::make_unique<Text>("CHECKBOX_ENABLED_TEXT", "EXAMPLE_FEATURE_HW"Hashed); |
12 | | - std::unique_ptr<SliderInt> GuiEnabledSlider = std::make_unique<SliderInt>("CHECKBOX_ENABLED_SLIDER", "EXAMPLE_FEATURE_SLIDER"Hashed); |
13 | | - std::unique_ptr<Text> GuiColorPickerLabel = std::make_unique<Text>("EXAMPLE_COLORPICKER_LABEL", "EXAMPLE_COLORPICKER"Hashed); |
14 | | - std::unique_ptr<ColorPicker> GuiColorPicker = std::make_unique<ColorPicker>("EXAMPLE_COLORPICKER", "EXAMPLE_COLORPICKER"Hashed, ElementBase::Style_t{ |
15 | | - .iFlags = ImGuiColorEditFlags_NoInputs}); |
| 92 | + std::unique_ptr<ExampleBodyGroup> m_pBodyGroup = std::make_unique<ExampleBodyGroup>("EXAMPLE_BODY_GROUP", ElementBase::Style_t(), ElementBase::EPage::Developer, 0); |
16 | 93 |
|
17 | 94 | public: |
18 | 95 | bool SetupMenu(); |
|
0 commit comments