#pragma once #include "Core.h" #include namespace XCEngine { namespace Editor { namespace UI { inline bool DrawFloat( const char* label, float& value, float columnWidth = DefaultControlLabelWidth(), float dragSpeed = 0.1f, float min = 0.0f, float max = 0.0f, const char* format = "%.2f" ) { return DrawControlRow(label, columnWidth, [&]() { return ImGui::DragFloat("##value", &value, dragSpeed, min, max, format); }); } inline bool DrawInt( const char* label, int& value, float columnWidth = DefaultControlLabelWidth(), int step = 1, int min = 0, int max = 0 ) { return DrawControlRow(label, columnWidth, [&]() { return ImGui::DragInt("##value", &value, static_cast(step), min, max); }); } inline bool DrawBool( const char* label, bool& value, float columnWidth = DefaultControlLabelWidth() ) { return DrawControlRow(label, columnWidth, [&]() { return ImGui::Checkbox("##value", &value); }); } inline bool DrawColor3( const char* label, float color[3], float columnWidth = DefaultControlLabelWidth() ) { return DrawControlRow(label, columnWidth, [&]() { return ImGui::ColorEdit3("##value", color, ImGuiColorEditFlags_NoInputs); }); } inline bool DrawColor4( const char* label, float color[4], float columnWidth = DefaultControlLabelWidth() ) { return DrawControlRow(label, columnWidth, [&]() { return ImGui::ColorEdit4("##value", color, ImGuiColorEditFlags_NoInputs); }); } inline bool DrawSliderFloat( const char* label, float& value, float min, float max, float columnWidth = DefaultControlLabelWidth(), const char* format = "%.2f" ) { return DrawControlRow(label, columnWidth, [&]() { return ImGui::SliderFloat("##value", &value, min, max, format); }); } inline bool DrawSliderInt( const char* label, int& value, int min, int max, float columnWidth = DefaultControlLabelWidth() ) { return DrawControlRow(label, columnWidth, [&]() { return ImGui::SliderInt("##value", &value, min, max); }); } inline int DrawCombo( const char* label, int currentItem, const char* const items[], int itemCount, float columnWidth = DefaultControlLabelWidth(), int heightInItems = -1 ) { int changedItem = currentItem; DrawControlRow(label, columnWidth, [&]() { ImGui::SetNextItemWidth(-1); if (ImGui::Combo("##value", ¤tItem, items, itemCount, heightInItems)) { changedItem = currentItem; } return false; }); return changedItem; } } } }