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;
|
float2 buttonSize = ImGui.GetTextLineHeight().XX;
|
||||||
|
|
||||||
ImGui.PushStyleColor(.Button, .(0, 0, 0, 0));
|
ImGui.PushStyleColor(.Button, ColorRGBA(0, 0, 0, 0));
|
||||||
|
|
||||||
if (showComponentContextMenu != null)
|
if (showComponentContextMenu != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using GlitchyEngine;
|
|||||||
using GlitchyEditor.CodeEditors;
|
using GlitchyEditor.CodeEditors;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using GlitchyEditor.Settings;
|
using GlitchyEditor.Settings;
|
||||||
|
using GlitchyEngine.Math;
|
||||||
|
|
||||||
namespace GlitchyEditor.EditWindows;
|
namespace GlitchyEditor.EditWindows;
|
||||||
|
|
||||||
@@ -138,7 +139,7 @@ class LogWindow : EditorWindow
|
|||||||
if (_visibleMessageTypes.HasFlag(.Trace))
|
if (_visibleMessageTypes.HasFlag(.Trace))
|
||||||
ImGui.PushStyleColor(.Button, *col);
|
ImGui.PushStyleColor(.Button, *col);
|
||||||
else
|
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))
|
if (ImGui.ImageButtonEx(1, s_TraceIcon, buttonSize, .Zero, .Ones))
|
||||||
_visibleMessageTypes ^= .Trace;
|
_visibleMessageTypes ^= .Trace;
|
||||||
@@ -148,7 +149,7 @@ class LogWindow : EditorWindow
|
|||||||
if (_visibleMessageTypes.HasFlag(.Info))
|
if (_visibleMessageTypes.HasFlag(.Info))
|
||||||
ImGui.PushStyleColor(.Button, *col);
|
ImGui.PushStyleColor(.Button, *col);
|
||||||
else
|
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))
|
if (ImGui.ImageButtonEx(2, s_InfoIcon, buttonSize, .Zero, .Ones))
|
||||||
_visibleMessageTypes ^= .Info;
|
_visibleMessageTypes ^= .Info;
|
||||||
@@ -158,7 +159,7 @@ class LogWindow : EditorWindow
|
|||||||
if (_visibleMessageTypes.HasFlag(.Warning))
|
if (_visibleMessageTypes.HasFlag(.Warning))
|
||||||
ImGui.PushStyleColor(.Button, *col);
|
ImGui.PushStyleColor(.Button, *col);
|
||||||
else
|
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))
|
if (ImGui.ImageButtonEx(3, s_WarningIcon, buttonSize, .Zero, .Ones))
|
||||||
_visibleMessageTypes ^= .Warning;
|
_visibleMessageTypes ^= .Warning;
|
||||||
@@ -168,7 +169,7 @@ class LogWindow : EditorWindow
|
|||||||
if (_visibleMessageTypes.HasFlag(.Error))
|
if (_visibleMessageTypes.HasFlag(.Error))
|
||||||
ImGui.PushStyleColor(.Button, *col);
|
ImGui.PushStyleColor(.Button, *col);
|
||||||
else
|
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))
|
if (ImGui.ImageButtonEx(4, s_ErrorIcon, buttonSize, .Zero, .Ones))
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ namespace ImGui
|
|||||||
{
|
{
|
||||||
PushStyleVar(value);
|
PushStyleVar(value);
|
||||||
defer:mixin PopStyleVar();
|
defer:mixin PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PushStyleVar(TypedStyleVar value)
|
public static void PushStyleVar(TypedStyleVar value)
|
||||||
{
|
{
|
||||||
@@ -743,6 +743,43 @@ namespace ImGui
|
|||||||
PushStyleVar(.DockingSeparatorSize, Value);
|
PushStyleVar(.DockingSeparatorSize, Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 struct DisabledScope : IDisposable
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user