public void SetMouseState(LGuiMouseButtons Btn, int X, int Y, bool IsMouseBtnDown, bool IsMouseMove) { var Index = (int)Btn; MouseButton = Btn; if (!IsMouseMove) { MousePreState[Index] = MouseCurState[Index]; MouseCurState[Index] = IsMouseBtnDown; MouseClickPos[Index] = new LGuiVec2(X, Y); MousePreDeltaPos = MouseCurDeltaPos; MouseCurDeltaPos = LGuiVec2.Zero; } else { if (MouseCurState[Index]) { MousePreDeltaPos = MouseCurDeltaPos; MouseCurDeltaPos.X = X - MouseClickPos[Index].X; MouseCurDeltaPos.Y = Y - MouseClickPos[Index].Y; } MousePos.X = X; MousePos.Y = Y; } }
internal static LGuiRect DoLayout(LGuiVec2 Size) { var Context = GetCurrentLayoutContext(); var Rect = new LGuiRect(Context.CursorPos, Size); switch (Context.LayoutMode) { case LGuiLayoutMode.None: break; case LGuiLayoutMode.Horizontal: Context.PreviousPos.X = Context.CursorPos.X; Context.PreviousPos.Y = Context.CursorPos.Y + Size.Y; Context.CursorPos.X += (Size.X + LGuiStyle.GetValue(LGuiStyleValueIndex.ControlSpacingX)); Context.CursorPos.Y = Context.BeginCursorPos.Y; Context.ChildSize.X = LGuiMisc.Max(Context.ChildSize.X, Context.CursorPos.X - Context.BeginCursorPos.X); Context.ChildSize.Y = LGuiMisc.Max(Context.ChildSize.Y, Context.PreviousPos.Y - Context.BeginCursorPos.Y); break; case LGuiLayoutMode.Vertical: Context.PreviousPos.X = Context.CursorPos.X + Size.X; Context.PreviousPos.Y = Context.CursorPos.Y; Context.CursorPos.X = Context.BeginCursorPos.X; Context.CursorPos.Y += (Size.Y + LGuiStyle.GetValue(LGuiStyleValueIndex.ControlSpacingY)); Context.ChildSize.X = LGuiMisc.Max(Context.ChildSize.X, Context.PreviousPos.X - Context.BeginCursorPos.X); Context.ChildSize.Y = LGuiMisc.Max(Context.ChildSize.Y, Context.CursorPos.Y - Context.BeginCursorPos.Y); break; default: break; } return(Rect); }
internal void End() { for (var Index = 0; Index < KeyCurState.Length; ++Index) { KeyPreState[Index] = KeyCurState[Index]; if (!KeyCurState[Index]) { KeyPressedTime[Index] = 0.0f; } } for (var Index = 0; Index < MouseCurState.Length; ++Index) { MousePreState[Index] = MouseCurState[Index]; if (!MouseCurState[Index]) { MousePressedTime[Index] = 0.0f; } } MousePreDeltaPos = MouseCurDeltaPos; MouseWheel = 0; }
internal void Clear() { for (var Index = 0; Index < KeyCurState.Length; ++Index) { KeyCurState[Index] = false; KeyPreState[Index] = false; KeyPressedTime[Index] = 0; } KeyCode = LGuiKeys.None; for (var Index = 0; Index < MouseCurState.Length; ++Index) { MouseCurState[Index] = false; MousePreState[Index] = false; MousePressedTime[Index] = 0; MouseClickPos[Index] = LGuiVec2.Zero; } MouseCurDeltaPos = LGuiVec2.Zero; MousePreDeltaPos = LGuiVec2.Zero; MouseButton = LGuiMouseButtons.None; MousePos = LGuiVec2.Zero; MouseWheel = 0; }
internal LGuiFrameContext(string Title, LGuiRect Rect) { this.Title = Title; this.Rect = Rect; this.Size = Rect.Size; this.Visibled = true; this.GroupStack = new Stack <LGuiGroupContext>(); }
internal static bool Contains(ref LGuiRect Rect, ref LGuiVec2 Value) { if (Value.X < Rect.Left || Value.X > Rect.Right || Value.Y < Rect.Top || Value.Y > Rect.Bottom) { return(false); } return(true); }
internal LGuiLayoutContext(LGuiLayoutMode LayoutMode, LGuiVec2 CursorPos, bool AutoMerge) { this.LayoutMode = LayoutMode; this.BeginCursorPos = CursorPos; this.CursorPos = CursorPos; this.ChildSize = LGuiVec2.Zero; this.PreviousPos = CursorPos; this.AutoMerge = AutoMerge; }
internal static void SetFrameOffset(string Title, LGuiVec2 Offset) { if (FrameOffset.ContainsKey(Title)) { FrameOffset[Title] = Offset; } else { FrameOffset.Add(Title, Offset); } }
internal static void SetFrameContextSize(string Title, LGuiVec2 Size) { if (FrameContextSize.ContainsKey(Title)) { FrameContextSize[Title] = Size; } else { FrameContextSize.Add(Title, Size); } }
internal static void SetPopupPos(string Title, LGuiVec2 Pos) { if (PopupPos.ContainsKey(Title)) { PopupPos[Title] = Pos; } else { PopupPos.Add(Title, Pos); } }
public static void Texture(int TextureID, LGuiRect SrcRect, LGuiVec2 DstSize) { LGuiTexture.OnProcess(TextureID, SrcRect, DstSize); }
public static void Texture(int TextureID, LGuiVec2 DstSize) { Texture(TextureID, LGuiRect.Zero, DstSize); }
public static bool InputText(string Title, ref string Value, uint MaxLength, LGuiVec2 Size, LGuiInputTextFlags Flags = LGuiInputTextFlags.None) { return(LGuiInputText.OnProcess(Title, ref Value, MaxLength, Size, Flags)); }
public static bool ColorButton(string Title, LGuiColor Color, LGuiVec2 Size) { return(LGuiColorButton.OnProcess(Title, Color, Size)); }
public static bool InvisibleButton(string Title, LGuiVec2 Size) { return(LGuiButton.OnProcess(Title, Size, LGuiButtonFlags.Invisible)); }
public static bool Button(string Title, LGuiVec2 Size, LGuiButtonFlags Flags = LGuiButtonFlags.None) { return(LGuiButton.OnProcess(Title, Size, Flags)); }
public LGuiRect(float X, float Y, float Width, float Height) { this.Pos = new LGuiVec2(X, Y); this.Size = new LGuiVec2(Width, Height); }
public static void BeginFrame(string Title, LGuiVec2 Size) { LGuiFrame.Begin(Title, Size); }
public static bool BeginToolTips(LGuiVec2 Size) { return(LGuiToolTips.Begin(Size)); }
public static LGuiRect CreateWithCenter(LGuiVec2 CenterPos, LGuiVec2 Size) { return(new LGuiRect(CenterPos.X - Size.X / 2.0f, CenterPos.Y - Size.Y / 2.0f, Size.X, Size.Y)); }
internal static void BeginLayout(LGuiLayoutMode LayoutMode, LGuiVec2 CursorPos, bool AutoMerge) { LayoutContextStack.Push(new LGuiLayoutContext(LayoutMode, CursorPos, AutoMerge)); }
public static void Texture(string FilePath, LGuiVec2 DstSize) { Texture(FilePath, LGuiRect.Zero, DstSize); }
public static void Texture(string FilePath, LGuiRect SrcRect, LGuiVec2 DstSize) { LGuiTexture.OnProcess(FilePath, SrcRect, DstSize); }
public static bool BeginWindow(string Title, LGuiVec2 Size, LGuiWindowFlags Flags = LGuiWindowFlags.None) { return(LGuiWindow.BeginWindow(Title, Size, Flags)); }
public static bool ListBox(string Title, ref int ItemIndex, string[] Items, LGuiVec2 Size) { return(LGuiListBox.OnProcess(Title, ref ItemIndex, Items, Size)); }
public static bool BeginPopup(string Title, LGuiVec2 Size) { return(LGuiPopup.Begin(Title, Size)); }
public static void OpenPopup(string Title, LGuiVec2 Pos) { LGuiPopup.Open(Title, Pos); }
public LGuiRect(LGuiVec2 Pos, LGuiVec2 Size) { this.Pos = Pos; this.Size = Size; }