Something went wrong. Try again.
art software for the rest of us
drawing paint image sdl art
Something went wrong. Try again.
C++
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950#include "SettingsPanel.h"#include "../ManagementContext/StyleManagmentContext.h"#include "../ManagementContext/PanelManagementContext.h"
void SettingsPanel::OnActivate(){ state = OPEN;}void SettingsPanel::OnDeactivate(){ state = CLOSED;}
void SettingsPanel::OnRender(){ if (!state) { return; }
const ImGuiViewport* viewport = ImGui::GetMainViewport(); ImVec2 work_pos = viewport->WorkPos; ImVec2 work_size = viewport->WorkSize; ImVec2 window_pos;
window_pos.x = work_pos.x + (work_size.x / 2); window_pos.y = work_pos.y + (work_size.y / 2); ImGui::SetNextWindowPos(window_pos, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f)); ImGui::SetNextWindowSizeConstraints(ImVec2(352, 532), ImVec2(FLT_MAX, FLT_MAX));
ImGui::Begin("SettingWindow", (bool*)&state, ImGuiWindowFlags_NoTitleBar); ImGui::Text("Settings"); StyleManagmentContext::Push(BASECONTENTS); ImGui::SetNextWindowSize(ImGui::GetContentRegionAvail(), ImGuiCond_None); ImGui::BeginChild("SettingsEditor", ImVec2(0, 0), ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY | ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened); ImGui::PushItemWidth(-FLT_MIN); ImGui::SeparatorText("Other"); ImGui::Button("Licenses", ImVec2(-FLT_MIN, 0)); ImGui::PopItemWidth(); ImGui::EndChild(); StyleManagmentContext::Pop();
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && !ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows)) { PanelManagementContext::Close(this); } ImGui::End();}