예제 #1
0
        public static void Init()
        {
            SystemFps = new TextLine
            {
                Text = "",
                X = 10.0f,
                Y = 10.0f,
                Xanchor = HorizontalAnchor.Right,
                Yanchor = VerticalAnchor.Bottom,
                FontID = FontType.Primary,
                StyleID = FontStyle.MenuTitle,
                Show = true
            };

            Gui.AddLine(SystemFps);
        }
예제 #2
0
        public static void RenderStringLine(TextLine line)
        {
            float realX = 0, realY = 0;

            if(Global.FontManager == null)
            {
                return;
            }

            var glFont = Global.FontManager.GetFont(line.FontID);
            var style = Global.FontManager.GetFontStyle(line.StyleID);

            if(glFont == null || style == null || !line.Show || style.Hidden)
            {
                return;
            }

            GLF.GetStringBB(glFont, line.Text, -1, ref line.Rect[0], ref line.Rect[1], ref line.Rect[2], ref line.Rect[3]);

            switch(line.Xanchor)
            {
                case HorizontalAnchor.Left:
                    realX = line.AbsXoffset; // Used with center and right alignments.
                    break;
                    case HorizontalAnchor.Right:
                    realX = Global.ScreenInfo.W - (line.Rect[2] - line.Rect[0]) - line.AbsXoffset;
                    break;
                    case HorizontalAnchor.Center:
                    realX = Global.ScreenInfo.W / 2.0f - (line.Rect[2] - line.Rect[0]) / 2.0f + line.AbsXoffset; // Absolute center
                    break;
            }

            switch (line.Yanchor)
            {
                case VerticalAnchor.Bottom:
                    realY = line.AbsYoffset; // Used with center and right alignments.
                    break;
                case VerticalAnchor.Top:
                    realY = Global.ScreenInfo.H - (line.Rect[3] - line.Rect[1]) - line.AbsYoffset;
                    break;
                case VerticalAnchor.Center:
                    realY = Global.ScreenInfo.H / 2.0f + (line.Rect[3] - line.Rect[1]) - line.AbsYoffset; // Absolute center
                    break;
            }

            if(style.Shadowed)
            {
                glFont.GLFontColor = new[] {0, 0, 0, style.Color[3] * FontShadowTransparency}; // derive alpha from base color
                GLF.RenderStr(glFont, realX + FontShadowHorizontalShift,
                    realY + FontShadowVerticalShift, line.Text);
            }

            glFont.GLFontColor = style.RealColor.ToArray();
            GLF.RenderStr(glFont, realX, realY, line.Text);
        }
예제 #3
0
        public static void DeleteLine(TextLine line)
        {
            if(line == GuiBaseLines)
            {
                GuiBaseLines = line.Next;
                if(GuiBaseLines != null)
                {
                    GuiBaseLines.Previous = null;
                }
                return;
            }

            line.Previous.Next = line.Next;
            if(line.Next != null)
            {
                line.Next.Previous = line.Previous;
            }
        }
예제 #4
0
        public static void AddLine(TextLine line)
        {
            if(GuiBaseLines == null)
            {
                GuiBaseLines = line;
                line.Next = null;
                line.Previous = null;
                return;
            }

            line.Previous = null;
            line.Next = GuiBaseLines;
            GuiBaseLines.Previous = line;
            GuiBaseLines = line;
        }
예제 #5
0
        public static void InitTempLines()
        {
            for (var i = 0; i < MaxTempLines; i++)
            {
                GuiTempLines[i] = new TextLine
                {
                    Text = "",
                    Show = false,

                    Next = null,
                    Previous = null,

                    FontID = FontType.Secondary,
                    StyleID = FontStyle.Generic
                };
            }
        }
예제 #6
0
        public InventoryManager()
        {
            CurrentState = InventoryState.Disabled;
            NextState = InventoryState.Disabled;
            currentItemsType = MenuItemType.System;
            currentItemsCount = 0;
            itemsOffset = 0;
            nextItemsCount = 0;

            ringRotatePeriod = 0.5f;
            ringTime = 0.0f;
            ringAngle = 0.0f;
            ringVerticalAngle = 0.0f;
            ringAngleStep = 0.0f;
            baseRingRadius = 600.0f;
            ringRadius = 600.0f;
            verticalOffset = 0.0f;

            itemRotatePeriod = 4.0f;
            itemTime = 0.0f;
            itemAngle = 0.0f;

            inventory = new List<InventoryNode>();

            LabelTitle = new TextLine();
            LabelTitle.X = 0.0f;
            LabelTitle.Y = 30.0f;
            LabelTitle.Xanchor = HorizontalAnchor.Center;
            LabelTitle.Yanchor = VerticalAnchor.Top;

            LabelTitle.FontID = FontType.Primary;
            LabelTitle.StyleID = FontStyle.MenuTitle;
            LabelTitle.Show = false;

            LabelItemName = new TextLine();
            LabelItemName.X = 0.0f;
            LabelItemName.Y = 50.0f;
            LabelItemName.Xanchor = HorizontalAnchor.Center;
            LabelItemName.Yanchor = VerticalAnchor.Bottom;
                 
            LabelItemName.FontID = FontType.Primary;
            LabelItemName.StyleID = FontStyle.MenuContent;
            LabelItemName.Show = false;

            Gui.AddLine(LabelItemName);
            Gui.AddLine(LabelTitle);
        }