mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-28 22:18:25 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
1 changed files with 768360 additions and 0 deletions
32
brutal.imgui/Brutal.ImGui.Abstractions/ImGuiUtils.cs
Normal file
32
brutal.imgui/Brutal.ImGui.Abstractions/ImGuiUtils.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using Brutal.ImGuiApi;
|
||||
|
||||
namespace Brutal.ImGuiApi.Abstractions;
|
||||
|
||||
public static class ImGuiUtils
|
||||
{
|
||||
public static void SetLastFocusOnAppearing(bool force = false)
|
||||
{
|
||||
if (
|
||||
force
|
||||
|| ImGui.IsItemHovered()
|
||||
|| (ImGui.IsAnyItemFocused() && !ImGui.IsAnyItemActive() && !ImGui.IsMouseClicked(0))
|
||||
)
|
||||
ImGui.SetKeyboardFocusHere(-1); // Auto focus
|
||||
}
|
||||
|
||||
public static void TextShadow(ImString text, ImColor8 color)
|
||||
{
|
||||
if (text.IsEmpty)
|
||||
return;
|
||||
|
||||
var cursorPos = ImGui.GetCursorPos();
|
||||
ImGui.SetCursorPos(cursorPos - new float2(-1, -1));
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, 0);
|
||||
ImGui.Text(text);
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.SetCursorPos(cursorPos);
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, color);
|
||||
ImGui.Text(text);
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue