Added global Alpha in ImGuiStyle + commented ImGuiStyle fields in .h
This commit is contained in:
parent
926f7bfcc5
commit
76a39ad224
21
imgui.cpp
21
imgui.cpp
@ -210,18 +210,19 @@ static void SetClipboardTextFn_DefaultImpl(const char* text, const char* text_
|
||||
|
||||
ImGuiStyle::ImGuiStyle()
|
||||
{
|
||||
Alpha = 1.0f; // Global alpha applies to everything in ImGui
|
||||
WindowPadding = ImVec2(8,8); // Padding within a window
|
||||
WindowMinSize = ImVec2(48,48); // Minimum window size
|
||||
FramePadding = ImVec2(5,4); // Padding within a framed rectangle (used by most widgets)
|
||||
ItemSpacing = ImVec2(10,5); // Horizontal and vertical spacing between widgets
|
||||
ItemSpacing = ImVec2(10,5); // Horizontal and vertical spacing between widgets/lines
|
||||
ItemInnerSpacing = ImVec2(5,5); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
||||
TouchExtraPadding = ImVec2(0,0); // Expand bounding box for touch-based system where touch position is not accurate enough (unnecessary for mouse inputs). Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget running. So dont grow this too much!
|
||||
AutoFitPadding = ImVec2(8,8); // Extra space after auto-fit (double-clicking on resize grip)
|
||||
WindowFillAlphaDefault = 0.70f;
|
||||
WindowRounding = 10.0f;
|
||||
TreeNodeSpacing = 22.0f;
|
||||
ColumnsMinSpacing = 6.0f; // Minimum space between two columns
|
||||
ScrollBarWidth = 16.0f;
|
||||
WindowFillAlphaDefault = 0.70f; // Default alpha of window background, if not specified in ImGui::Begin()
|
||||
WindowRounding = 10.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
||||
TreeNodeSpacing = 22.0f; // Horizontal spacing when entering a tree node
|
||||
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns
|
||||
ScrollBarWidth = 16.0f; // Width of the vertical scroll bar
|
||||
|
||||
Colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
|
||||
Colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
||||
@ -705,7 +706,8 @@ public:
|
||||
float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui.Style.FramePadding.y * 2.0f; }
|
||||
ImGuiAabb TitleBarAabb() const { return ImGuiAabb(Pos, Pos + ImVec2(SizeFull.x, TitleBarHeight())); }
|
||||
ImVec2 WindowPadding() const { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders)) ? ImVec2(1,1) : GImGui.Style.WindowPadding; }
|
||||
ImU32 Color(ImGuiCol idx, float a=1.f) const { ImVec4 c = GImGui.Style.Colors[idx]; c.w *= a; return ImConvertColorFloat4ToU32(c); }
|
||||
ImU32 Color(ImGuiCol idx, float a=1.f) const { ImVec4 c = GImGui.Style.Colors[idx]; c.w *= GImGui.Style.Alpha * a; return ImConvertColorFloat4ToU32(c); }
|
||||
ImU32 Color(const ImVec4& col) const { ImVec4 c = col; c.w *= GImGui.Style.Alpha; return ImConvertColorFloat4ToU32(c); }
|
||||
};
|
||||
|
||||
static ImGuiWindow* GetCurrentWindow()
|
||||
@ -4215,9 +4217,7 @@ bool ColorButton(const ImVec4& col, bool small_height, bool outline_border)
|
||||
|
||||
const bool hovered = (g.HoveredWindow == window) && (g.HoveredId == 0) && IsMouseHoveringBox(bb);
|
||||
const bool pressed = hovered && g.IO.MouseClicked[0];
|
||||
|
||||
const ImU32 col32 = ImConvertColorFloat4ToU32(col);
|
||||
RenderFrame(bb.Min, bb.Max, col32, outline_border);
|
||||
RenderFrame(bb.Min, bb.Max, window->Color(col), outline_border);
|
||||
|
||||
if (hovered)
|
||||
{
|
||||
@ -5391,6 +5391,7 @@ void ShowStyleEditor(ImGuiStyle* ref)
|
||||
*ref = g.Style;
|
||||
}
|
||||
|
||||
ImGui::SliderFloat("Alpha", &style.Alpha, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI. But application code could have a toggle to switch between zero and non-zero.
|
||||
ImGui::SliderFloat("Rounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f");
|
||||
|
||||
static ImGuiColorEditMode edit_mode = ImGuiColorEditMode_RGB;
|
||||
|
26
imgui.h
26
imgui.h
@ -353,21 +353,21 @@ enum ImGuiColorEditMode_
|
||||
ImGuiColorEditMode_HEX = 2,
|
||||
};
|
||||
|
||||
// See constructor for comments of individual fields.
|
||||
struct ImGuiStyle
|
||||
{
|
||||
ImVec2 WindowPadding;
|
||||
ImVec2 WindowMinSize;
|
||||
ImVec2 FramePadding;
|
||||
ImVec2 ItemSpacing;
|
||||
ImVec2 ItemInnerSpacing;
|
||||
ImVec2 TouchExtraPadding;
|
||||
ImVec2 AutoFitPadding;
|
||||
float WindowFillAlphaDefault;
|
||||
float WindowRounding;
|
||||
float TreeNodeSpacing;
|
||||
float ColumnsMinSpacing;
|
||||
float ScrollBarWidth;
|
||||
float Alpha; // Global alpha applies to everything in ImGui
|
||||
ImVec2 WindowPadding; // Padding within a window
|
||||
ImVec2 WindowMinSize; // Minimum window size
|
||||
ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets)
|
||||
ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines
|
||||
ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
||||
ImVec2 TouchExtraPadding; // Expand bounding box for touch-based system where touch position is not accurate enough (unnecessary for mouse inputs). Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget running. So dont grow this too much!
|
||||
ImVec2 AutoFitPadding; // Extra space after auto-fit (double-clicking on resize grip)
|
||||
float WindowFillAlphaDefault; // Default alpha of window background, if not specified in ImGui::Begin()
|
||||
float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
||||
float TreeNodeSpacing; // Horizontal spacing when entering a tree node
|
||||
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns
|
||||
float ScrollBarWidth; // Width of the vertical scroll bar
|
||||
ImVec4 Colors[ImGuiCol_COUNT];
|
||||
|
||||
ImGuiStyle();
|
||||
|
Loading…
Reference in New Issue
Block a user