mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-11-04 12:51:48 +00:00
ImGui extension to push GlitchyEngine color types (and scoped push)
This commit is contained in:
@@ -178,7 +178,7 @@ namespace GlitchyEditor.EditWindows
|
||||
|
||||
float2 buttonSize = ImGui.GetTextLineHeight().XX;
|
||||
|
||||
ImGui.PushStyleColor(.Button, .(0, 0, 0, 0));
|
||||
ImGui.PushStyleColor(.Button, ColorRGBA(0, 0, 0, 0));
|
||||
|
||||
if (showComponentContextMenu != null)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ using GlitchyEngine;
|
||||
using GlitchyEditor.CodeEditors;
|
||||
using System.IO;
|
||||
using GlitchyEditor.Settings;
|
||||
using GlitchyEngine.Math;
|
||||
|
||||
namespace GlitchyEditor.EditWindows;
|
||||
|
||||
@@ -138,7 +139,7 @@ class LogWindow : EditorWindow
|
||||
if (_visibleMessageTypes.HasFlag(.Trace))
|
||||
ImGui.PushStyleColor(.Button, *col);
|
||||
else
|
||||
ImGui.PushStyleColor(.Button, .(0, 0, 0, 0));
|
||||
ImGui.PushStyleColor(.Button, ColorRGBA(0, 0, 0, 0));
|
||||
|
||||
if (ImGui.ImageButtonEx(1, s_TraceIcon, buttonSize, .Zero, .Ones))
|
||||
_visibleMessageTypes ^= .Trace;
|
||||
@@ -148,7 +149,7 @@ class LogWindow : EditorWindow
|
||||
if (_visibleMessageTypes.HasFlag(.Info))
|
||||
ImGui.PushStyleColor(.Button, *col);
|
||||
else
|
||||
ImGui.PushStyleColor(.Button, .(0, 0, 0, 0));
|
||||
ImGui.PushStyleColor(.Button, ColorRGBA(0, 0, 0, 0));
|
||||
|
||||
if (ImGui.ImageButtonEx(2, s_InfoIcon, buttonSize, .Zero, .Ones))
|
||||
_visibleMessageTypes ^= .Info;
|
||||
@@ -158,7 +159,7 @@ class LogWindow : EditorWindow
|
||||
if (_visibleMessageTypes.HasFlag(.Warning))
|
||||
ImGui.PushStyleColor(.Button, *col);
|
||||
else
|
||||
ImGui.PushStyleColor(.Button, .(0, 0, 0, 0));
|
||||
ImGui.PushStyleColor(.Button, ColorRGBA(0, 0, 0, 0));
|
||||
|
||||
if (ImGui.ImageButtonEx(3, s_WarningIcon, buttonSize, .Zero, .Ones))
|
||||
_visibleMessageTypes ^= .Warning;
|
||||
@@ -168,7 +169,7 @@ class LogWindow : EditorWindow
|
||||
if (_visibleMessageTypes.HasFlag(.Error))
|
||||
ImGui.PushStyleColor(.Button, *col);
|
||||
else
|
||||
ImGui.PushStyleColor(.Button, .(0, 0, 0, 0));
|
||||
ImGui.PushStyleColor(.Button, ColorRGBA(0, 0, 0, 0));
|
||||
|
||||
|
||||
if (ImGui.ImageButtonEx(4, s_ErrorIcon, buttonSize, .Zero, .Ones))
|
||||
|
||||
@@ -744,6 +744,43 @@ namespace ImGui
|
||||
}
|
||||
}
|
||||
|
||||
public static mixin PushScopedStyleColor(ImGui.Col idx, uint32 color)
|
||||
{
|
||||
PushStyleColor(idx, color);
|
||||
defer:mixin PopStyleColor();
|
||||
}
|
||||
|
||||
public static mixin PushScopedStyleColor(ImGui.Col idx, Vec4 color)
|
||||
{
|
||||
PushStyleColor(idx, color);
|
||||
defer:mixin PopStyleColor();
|
||||
}
|
||||
|
||||
public static mixin PushScopedStyleColor(ImGui.Col idx, GlitchyEngine.Math.Color color)
|
||||
{
|
||||
PushStyleColor(idx, color);
|
||||
defer:mixin PopStyleColor();
|
||||
}
|
||||
|
||||
public static void PushStyleColor(ImGui.Col idx, GlitchyEngine.Math.Color color)
|
||||
{
|
||||
#unwarn
|
||||
uint32 bitColor = *(uint32*)(void*)&color;
|
||||
|
||||
ImGui.PushStyleColor(.Text, bitColor);
|
||||
}
|
||||
|
||||
public static mixin PushScopedStyleColor(ImGui.Col idx, GlitchyEngine.Math.ColorRGBA color)
|
||||
{
|
||||
PushStyleColor(idx, color);
|
||||
defer:mixin PopStyleColor();
|
||||
}
|
||||
|
||||
public static void PushStyleColor(ImGui.Col idx, GlitchyEngine.Math.ColorRGBA color)
|
||||
{
|
||||
ImGui.PushStyleColor(.Text, ((Color)color).Value);
|
||||
}
|
||||
|
||||
public struct DisabledScope : IDisposable
|
||||
{
|
||||
public this(bool disabled = true)
|
||||
|
||||
Reference in New Issue
Block a user