예제 #1
0
        internal static bool Begin(string Title, LGuiRect Rect)
        {
            var ID = LGuiHash.CalculateID(Title);

            LGuiContext.SetPreviousControlID(ID);

            if (!LGuiMisc.CheckVisible(ref Rect))
            {
                return(false);
            }

            var IsOpen = LGuiContextCache.GetPopupOpen(Title);

            if (IsOpen)
            {
                if (LGuiContext.IO.IsMouseClick(LGuiMouseButtons.Left) && !LGuiMisc.Contains(ref Rect, ref LGuiContext.IO.MousePos))
                {
                    LGuiContextCache.SetPopupOpen(Title, false);
                    return(false);
                }

                LGuiGraphics.SetCurrentLevel(LGuiCommandLevel.Popup);
                LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Frame, true);
                LGuiFrame.Begin(Title, Rect, false);
            }

            return(IsOpen);
        }
예제 #2
0
        internal static void End()
        {
            LGuiGraphics.SetTargetCommandList(null);

            SortWindowList();
            if (SortedWindowID_.Count > 0)
            {
                SortedWindowID_.Sort((Left, Right) =>
                {
                    if (WindowList_[Left].Order < WindowList_[Right].Order)
                    {
                        return(-1);
                    }

                    if (WindowList_[Left].Order > WindowList_[Right].Order)
                    {
                        return(1);
                    }

                    return(0);
                });

                LGuiGraphics.SetCurrentLevel(LGuiCommandLevel.Window);

                foreach (var ID in SortedWindowID_)
                {
                    LGuiGraphics.AddCommandList(WindowList_[ID].DrawList);
                }

                LGuiGraphics.RestoreCurrentLevel();
            }
        }
예제 #3
0
        internal static bool Begin(LGuiVec2 Size)
        {
            if (!LGuiMisc.PreviousControlIsHovered())
            {
                return(false);
            }

            var Pos  = LGuiContext.IO.MousePos + new LGuiVec2(20, 5);
            var Rect = new LGuiRect(Pos, Size);

            LGuiGraphics.SetCurrentLevel(LGuiCommandLevel.Tips);
            LGuiGraphics.DrawRect(Rect, LGuiStyleColorIndex.Frame, true);
            LGuiFrame.Begin(LGuiSettings.DefaultToolTipsTitle, Rect, false);
            return(true);
        }