コード例 #1
0
ファイル: LGuiIO.cs プロジェクト: 529324416/LiteGui
        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;
            }
        }
コード例 #2
0
ファイル: LGuiLayout.cs プロジェクト: 529324416/LiteGui
        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);
        }
コード例 #3
0
ファイル: LGuiIO.cs プロジェクト: 529324416/LiteGui
        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;
        }
コード例 #4
0
ファイル: LGuiIO.cs プロジェクト: 529324416/LiteGui
        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;
        }
コード例 #5
0
ファイル: LGuiContext.cs プロジェクト: 529324416/LiteGui
        internal LGuiFrameContext(string Title, LGuiRect Rect)
        {
            this.Title    = Title;
            this.Rect     = Rect;
            this.Size     = Rect.Size;
            this.Visibled = true;

            this.GroupStack = new Stack <LGuiGroupContext>();
        }
コード例 #6
0
ファイル: LGuiMisc.cs プロジェクト: 529324416/LiteGui
        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);
        }
コード例 #7
0
ファイル: LGuiLayout.cs プロジェクト: 529324416/LiteGui
 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;
 }
コード例 #8
0
ファイル: LGuiContext.cs プロジェクト: 529324416/LiteGui
 internal static void SetFrameOffset(string Title, LGuiVec2 Offset)
 {
     if (FrameOffset.ContainsKey(Title))
     {
         FrameOffset[Title] = Offset;
     }
     else
     {
         FrameOffset.Add(Title, Offset);
     }
 }
コード例 #9
0
ファイル: LGuiContext.cs プロジェクト: 529324416/LiteGui
 internal static void SetFrameContextSize(string Title, LGuiVec2 Size)
 {
     if (FrameContextSize.ContainsKey(Title))
     {
         FrameContextSize[Title] = Size;
     }
     else
     {
         FrameContextSize.Add(Title, Size);
     }
 }
コード例 #10
0
ファイル: LGuiContext.cs プロジェクト: 529324416/LiteGui
 internal static void SetPopupPos(string Title, LGuiVec2 Pos)
 {
     if (PopupPos.ContainsKey(Title))
     {
         PopupPos[Title] = Pos;
     }
     else
     {
         PopupPos.Add(Title, Pos);
     }
 }
コード例 #11
0
 public static void Texture(int TextureID, LGuiRect SrcRect, LGuiVec2 DstSize)
 {
     LGuiTexture.OnProcess(TextureID, SrcRect, DstSize);
 }
コード例 #12
0
 public static void Texture(int TextureID, LGuiVec2 DstSize)
 {
     Texture(TextureID, LGuiRect.Zero, DstSize);
 }
コード例 #13
0
 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));
 }
コード例 #14
0
 public static bool ColorButton(string Title, LGuiColor Color, LGuiVec2 Size)
 {
     return(LGuiColorButton.OnProcess(Title, Color, Size));
 }
コード例 #15
0
 public static bool InvisibleButton(string Title, LGuiVec2 Size)
 {
     return(LGuiButton.OnProcess(Title, Size, LGuiButtonFlags.Invisible));
 }
コード例 #16
0
 public static bool Button(string Title, LGuiVec2 Size, LGuiButtonFlags Flags = LGuiButtonFlags.None)
 {
     return(LGuiButton.OnProcess(Title, Size, Flags));
 }
コード例 #17
0
ファイル: LGuiDefine.cs プロジェクト: 529324416/LiteGui
 public LGuiRect(float X, float Y, float Width, float Height)
 {
     this.Pos  = new LGuiVec2(X, Y);
     this.Size = new LGuiVec2(Width, Height);
 }
コード例 #18
0
 public static void BeginFrame(string Title, LGuiVec2 Size)
 {
     LGuiFrame.Begin(Title, Size);
 }
コード例 #19
0
 public static bool BeginToolTips(LGuiVec2 Size)
 {
     return(LGuiToolTips.Begin(Size));
 }
コード例 #20
0
ファイル: LGuiDefine.cs プロジェクト: 529324416/LiteGui
 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));
 }
コード例 #21
0
ファイル: LGuiLayout.cs プロジェクト: 529324416/LiteGui
 internal static void BeginLayout(LGuiLayoutMode LayoutMode, LGuiVec2 CursorPos, bool AutoMerge)
 {
     LayoutContextStack.Push(new LGuiLayoutContext(LayoutMode, CursorPos, AutoMerge));
 }
コード例 #22
0
 public static void Texture(string FilePath, LGuiVec2 DstSize)
 {
     Texture(FilePath, LGuiRect.Zero, DstSize);
 }
コード例 #23
0
 public static void Texture(string FilePath, LGuiRect SrcRect, LGuiVec2 DstSize)
 {
     LGuiTexture.OnProcess(FilePath, SrcRect, DstSize);
 }
コード例 #24
0
 public static bool BeginWindow(string Title, LGuiVec2 Size, LGuiWindowFlags Flags = LGuiWindowFlags.None)
 {
     return(LGuiWindow.BeginWindow(Title, Size, Flags));
 }
コード例 #25
0
 public static bool ListBox(string Title, ref int ItemIndex, string[] Items, LGuiVec2 Size)
 {
     return(LGuiListBox.OnProcess(Title, ref ItemIndex, Items, Size));
 }
コード例 #26
0
 public static bool BeginPopup(string Title, LGuiVec2 Size)
 {
     return(LGuiPopup.Begin(Title, Size));
 }
コード例 #27
0
 public static void OpenPopup(string Title, LGuiVec2 Pos)
 {
     LGuiPopup.Open(Title, Pos);
 }
コード例 #28
0
ファイル: LGuiDefine.cs プロジェクト: 529324416/LiteGui
 public LGuiRect(LGuiVec2 Pos, LGuiVec2 Size)
 {
     this.Pos  = Pos;
     this.Size = Size;
 }