Example #1
0
        public override void Project(GameTime gameTime, int x, int y, IRender render)
        {
            render.Begin();

            int railAddX = Pointer.Width / 2;
            int railY    = y + (Pointer.Height / 2) - (RailEdge.Height / 2);

            render.DrawSprite(RailEdge, new Vector2(x + railAddX, railY), Color.White);
            render.DrawSprite(RailEdge, new Vector2(x + railAddX + Width - RailEdge.Width, railY), Color.White);

            render.DrawSprite(RailMiddle, new Rectangle(x + railAddX + RailEdge.Width, railY, Width - RailEdge.Width * 2 - railAddX * 2, RailMiddle.Height), Color.White);

            render.DrawSprite(Pointer, new Vector2(PointerX, y), Color.White);

            //Dras milestones
            double stepPixelWidth = Math.Max((Width - RailEdge.Width * 2 - railAddX) * (StepValue / MaxValue), 1F);
            double stepX          = x + railAddX;

            while (stepX < (x + Width - RailEdge.Width * 2 - railAddX))
            {
                render.DrawSprite(Milestone, new Vector2((int)Math.Round(stepX, 0), y + Pointer.Height + PointerMilestoneMargin), Color.White);
                stepX += stepPixelWidth;
            }

            render.End();
        }
Example #2
0
        public void DrawChar(char c, Point position, Vector2 origin, Color color, IRender render)
        {
            int addX = 0;
            int addY = 0;

            if (origin.X != 0 && origin.Y != 0)
            {
                addX = -(int)Math.Round(CharWidth * origin.X, 0);
                addY = -(int)Math.Round(CharHeight * origin.Y, 0);
            }

            Rectangle sourceRect = GetCharRect(c);

            if (sourceRect.IsEmpty)
            {
                return;
            }

            render.DrawSprite(FontSprite,
                              new Rectangle(position.X + addX,
                                            position.Y + addY,
                                            CharWidth,
                                            CharHeight),
                              sourceRect, color);
        }
Example #3
0
        public override void Project(GameTime gameTime, int x, int y, IRender render)
        {
            base.Project(gameTime, x, y, render);

            render.Begin();
            render.DrawSprite(iconInUse, new Vector2(x + (Width / 2) - iconInUse.Width / 2, y + (Height / 2) - iconInUse.Height / 2), Color.White);
            render.End();
        }
Example #4
0
        public override void Project(GameTime gameTime, int x, int y, IRender render)
        {
            render.Begin();

            render.DrawSprite(textureInUse, new Vector2(x, y), Color.White);

            render.End();
        }
Example #5
0
        void DrawTab(int x, int y, IRender render, string text, int size, bool pressed)
        {
            render.DrawSprite(ButtonTopLeftCorner, new Vector2(x, y), Color.White);
            render.DrawSprite(ButtonTopRightCorner, new Vector2(x + size - ButtonTopRightCorner.Width, y), Color.White);
            render.DrawSprite(ButtonBottomLeftCorner, new Vector2(x, y + ButtonTopLeftCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);
            render.DrawSprite(ButtonBottomRightCorner, new Vector2(x + size - ButtonBottomLeftCorner.Width, y + ButtonTopRightCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);

            render.DrawSprite(ButtonTopBorder, new Rectangle(x + ButtonTopLeftCorner.Width, y, size - ButtonTopLeftCorner.Width - ButtonTopRightCorner.Width, ButtonTopBorder.Height), Color.White);
            render.DrawSprite(ButtonBottomBorder, new Rectangle(x + ButtonBottomLeftCorner.Width, y + ButtonTopLeftCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin, size - ButtonBottomLeftCorner.Width - ButtonBottomRightCorner.Width, ButtonBottomBorder.Height), Color.White);

            render.DrawSprite(ButtonLeftBorder, new Rectangle(x, y + ButtonTopLeftCorner.Height, ButtonLeftBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);
            render.DrawSprite(ButtonRightBorder, new Rectangle(x + size - ButtonRightBorder.Width, y + ButtonTopLeftCorner.Height, ButtonLeftBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);

            ISprite inside = pressed ? ButtonInsidePressed : ButtonInside;

            render.DrawSprite(inside, new Rectangle(x + ButtonTopLeftCorner.Width, y + ButtonTopBorder.Height, size - ButtonLeftBorder.Width - ButtonRightBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);

            Font.DrawString(text, new Point(x + ButtonTopLeftCorner.Width, y + HeaderSize / 2 - Font.CharHeight / 2), FontColor, render);
        }
Example #6
0
        public void DrawChar(char c, Point position, Color color, IRender render)
        {
            Rectangle sourceRect = GetCharRect(c);

            if (sourceRect.IsEmpty)
            {
                return;
            }

            render.DrawSprite(FontSprite,
                              new Rectangle(position.X,
                                            position.Y,
                                            CharWidth,
                                            CharHeight),
                              sourceRect, color);
        }
Example #7
0
        void DrawButton(int x, int y, IRender render, string text, int size, bool pressed)
        {
            render.DrawSprite(ButtonTopLeftCorner, new Vector2(x, y), Color.White);
            render.DrawSprite(ButtonTopRightCorner, new Vector2(x + size - ButtonTopRightCorner.Width, y), Color.White);
            render.DrawSprite(ButtonBottomLeftCorner, new Vector2(x, y + ButtonTopLeftCorner.Height + columnNameMargin + Font.CharHeight + columnNameMargin), Color.White);
            render.DrawSprite(ButtonBottomRightCorner, new Vector2(x + size - ButtonBottomLeftCorner.Width, y + ButtonTopRightCorner.Height + columnNameMargin + Font.CharHeight + columnNameMargin), Color.White);

            render.DrawSprite(ButtonTopBorder, new Rectangle(x + ButtonTopLeftCorner.Width, y, size - ButtonTopLeftCorner.Width - ButtonTopRightCorner.Width, ButtonTopBorder.Height), Color.White);
            render.DrawSprite(ButtonBottomBorder, new Rectangle(x + ButtonBottomLeftCorner.Width, y + ButtonTopLeftCorner.Height + columnNameMargin + Font.CharHeight + columnNameMargin, size - ButtonBottomLeftCorner.Width - ButtonBottomRightCorner.Width, ButtonBottomBorder.Height), Color.White);

            render.DrawSprite(ButtonLeftBorder, new Rectangle(x, y + ButtonTopLeftCorner.Height, ButtonLeftBorder.Width, columnNameMargin + Font.CharHeight + columnNameMargin), Color.White);
            render.DrawSprite(ButtonRightBorder, new Rectangle(x + size - ButtonRightBorder.Width, y + ButtonTopLeftCorner.Height, ButtonLeftBorder.Width, columnNameMargin + Font.CharHeight + columnNameMargin), Color.White);

            ISprite inside = pressed ? ButtonInsidePressed : ButtonInside;

            render.DrawSprite(inside, new Rectangle(x + ButtonTopLeftCorner.Width, y + ButtonTopBorder.Height, size - ButtonLeftBorder.Width - ButtonRightBorder.Width, columnNameMargin + Font.CharHeight + columnNameMargin), Color.White);

            int strX = x + ButtonTopLeftCorner.Width + (size - ButtonTopLeftCorner.Width - ButtonTopRightCorner.Width) / 2 - Font.MeasureString(text).X / 2;
            int strY = y + HeaderSize / 2 - Font.CharHeight / 2;

            Font.DrawString(text, new Point(strX, strY), Color.White, render);
        }
Example #8
0
        protected void DrawButtons(IRender render, int x, int y)
        {
            if (buttons.Count == 0)
            {
                return;
            }

            int startX = x + Width - topRightCornerInUse.Width;

            foreach (ISprite button in buttons)
            {
                startX -= button.Width + buttonMargin;
            }

            startX += buttonMargin;

            foreach (ISprite button in buttons)
            {
                render.DrawSprite(button, new Vector2(startX, y + (topLeftCornerInUse.Height / 2) - (button.Height / 2)), Color.White);
                startX += button.Width + buttonMargin;
            }
        }
            public void Draw(IRender render, Vector2 origin, SpriteEffects spriteEffect)
            {
                Vector2 pos;

                if (spriteEffect == SpriteEffects.FlipHorizontally)
                {
                    pos.X = origin.X - Position.X;
                }
                else
                {
                    pos.X = origin.X + Position.X;
                }
                if (spriteEffect == SpriteEffects.FlipVertically)
                {
                    pos.Y = origin.Y - Position.Y;
                }
                else
                {
                    pos.Y = origin.Y + Position.Y;
                }

                render.DrawSprite(Texture, pos, SourceRect, new Vector2(0, 0), spriteEffect, Color.White, 0f);
            }
Example #10
0
        public override void Project(GameTime gameTime, int x, int y, IRender render)
        {
            render.Begin();

            ISprite barButtonLeft  = leftButtonIsPressed ? BarButtonPressed : BarButton;
            ISprite barButtonRight = rightButtonIsPressed ? BarButtonPressed : BarButton;

            render.DrawSprite(barButtonLeft, new Vector2(x, y), Color.White);
            render.DrawSprite(BarInside,
                              new Rectangle(x + BarButton.Width, y, Width - BarButton.Width * 2, BarInside.Height), Color.White);
            render.DrawSprite(barButtonRight, new Vector2(x + Width - BarButton.Width, y), SpriteEffects.FlipHorizontally, Color.White);

            int scrollerX = (int)Math.Round(x + BarButton.Width + ScrollerPosition, 0);

            render.DrawSprite(ScrollerEdge, new Vector2(scrollerX, y), Color.White);
            render.DrawSprite(ScrollerInside,
                              new Rectangle(scrollerX + ScrollerEdge.Width, y, ScrollerSize - ScrollerEdge.Width * 2, ScrollerInside.Height), Color.White);
            render.DrawSprite(ScrollerEdge, new Vector2(scrollerX + ScrollerSize - ScrollerEdge.Width, y), SpriteEffects.FlipHorizontally, Color.White);
            render.DrawSprite(ScrollerCenter, new Vector2(scrollerX + ScrollerSize / 2 - ScrollerCenter.Width / 2, y), Color.White);

            render.End();
        }
Example #11
0
        public override void Project(GameTime gameTime, int x, int y, IRender render)
        {
            render.Begin();

            ISprite barButtonTop    = leftButtonIsPressed ? BarButtonPressed : BarButton;
            ISprite barButtonBottom = rightButtonIsPressed ? BarButtonPressed : BarButton;

            render.DrawSprite(barButtonTop, new Vector2(x, y), Color.White);
            render.DrawSprite(BarInside,
                              new Rectangle(x, y + barButtonTop.Height, Width, Height - barButtonTop.Height * 2), Color.White);
            render.DrawSprite(barButtonBottom, new Vector2(x, y + Height - barButtonBottom.Height), SpriteEffects.FlipVertically, Color.White);


            int scrollerY = (int)Math.Round(y + BarButton.Height + ScrollerPosition, 0);

            render.DrawSprite(ScrollerEdge, new Vector2(x, scrollerY), Color.White);
            render.DrawSprite(ScrollerInside,
                              new Rectangle(x, scrollerY + ScrollerEdge.Height, Width, ScrollerSize - ScrollerEdge.Height * 2), Color.White);
            render.DrawSprite(ScrollerEdge, new Vector2(x, scrollerY + ScrollerSize - ScrollerEdge.Height), SpriteEffects.FlipVertically, Color.White);
            render.DrawSprite(ScrollerCenter, new Vector2(x, scrollerY + ScrollerSize / 2 - ScrollerCenter.Height / 2), Color.White);

            render.End();
        }
Example #12
0
        public override void Project(GameTime gameTime, int x, int y, IRender render)
        {
            ViewRect orig = render.GetViewRect();

            render.Begin();

            ISprite iconUpSignInUse = UpIsPressed ? IconUpSignPressed : IconUpSign;
            ISprite iconInsideInUse = UpIsPressed ? IconInsidePressed : IconInside;

            //	/-------\
            //  |  /|\  |
            //  | / | \ |
            //  |   |   |
            //  \-------/
            render.DrawSprite(IconTop, new Vector2(x, y), Color.White);
            render.DrawSprite(IconLeft, new Rectangle(x, y + IconTop.Height, IconLeft.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White);
            render.DrawSprite(IconRight, new Rectangle(x + IconTop.Width - IconRight.Width, y + IconTop.Height, IconRight.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White);
            render.DrawSprite(IconBottom, new Vector2(x, y + UpperFieldHeight - IconBottom.Height), Color.White);
            render.DrawSprite(iconInsideInUse, new Rectangle(x + IconLeft.Width, y + IconTop.Height, IconTop.Width - IconLeft.Width - IconRight.Width, UpperFieldHeight - IconTop.Height - IconBottom.Height), Color.White);
            render.DrawSprite(IconUpSign, new Vector2(x + IconLeft.Width + ((IconTop.Width - IconLeft.Width - IconRight.Width) / 2) - (IconUpSign.Width / 2), y + (UpperFieldHeight / 2) - (IconUpSign.Height / 2)), Color.White);

            //UPPER FIELD:
            //Top
            render.DrawSprite(TopBorder, new Rectangle(x + IconTop.Width, y, Width - IconTop.Width - TopRightCorner.Width, TopBorder.Height), Color.White);
            //TopRight
            render.DrawSprite(TopRightCorner, new Vector2(x + Width - TopRightCorner.Width, y), Color.White);
            //Right
            render.DrawSprite(RightBorder, new Rectangle(x + Width - RightBorder.Width, y + TopRightCorner.Height, RightBorder.Width, UpperFieldHeight - TopRightCorner.Height - UpperFieldBottomRightCorner.Height), Color.White);
            //BottomRight
            render.DrawSprite(UpperFieldBottomRightCorner, new Vector2(x + Width - UpperFieldBottomRightCorner.Width, y + UpperFieldHeight - UpperFieldBottomRightCorner.Height), Color.White);
            //Bottom
            render.DrawSprite(BottomBorder, new Rectangle(x + IconTop.Width, y + UpperFieldHeight - BottomBorder.Height, Width - IconTop.Width - TopRightCorner.Width, BottomBorder.Height), Color.White);
            //Inside
            render.DrawSprite(Inside, new Rectangle(x + IconTop.Width, y + TopBorder.Height, Width - IconTop.Width - RightBorder.Width, UpperFieldHeight - TopBorder.Height - BottomBorder.Height), Color.White);

            //LOWER FIELD:
            //Middle
            render.DrawSprite(MiddleBorder, new Rectangle(x + LeftBorder.Width, y + UpperFieldHeight, LowerFieldWidth - LeftBorder.Width - RightBorder.Width, MiddleBorder.Height), Color.White);
            //Right
            render.DrawSprite(RightBorder, new Rectangle(x + LowerFieldWidth - RightBorder.Width, y + UpperFieldHeight, RightBorder.Width, LowerFieldHeight - BottomRightCorner.Height), Color.White);
            //BottomRight
            render.DrawSprite(BottomRightCorner, new Vector2(x + LowerFieldWidth - BottomRightCorner.Width, y + UpperFieldHeight + LowerFieldHeight - BottomRightCorner.Height), Color.White);
            //Bottom
            render.DrawSprite(BottomBorder, new Rectangle(x + BottomLeftCorner.Width, y + UpperFieldHeight + LowerFieldHeight - BottomBorder.Height, LowerFieldWidth - BottomLeftCorner.Width - BottomRightCorner.Width, BottomBorder.Height), Color.White);
            //BottomLeft
            render.DrawSprite(BottomLeftCorner, new Vector2(x, y + UpperFieldHeight + LowerFieldHeight - BottomLeftCorner.Height), Color.White);
            //Left
            render.DrawSprite(LeftBorder, new Rectangle(x, y + UpperFieldHeight, LeftBorder.Width, LowerFieldHeight - BottomLeftCorner.Height), Color.White);
            //Inside
            render.DrawSprite(Inside, new Rectangle(x + LeftBorder.Width, y + UpperFieldHeight + MiddleBorder.Height, LowerFieldWidth - LeftBorder.Width - RightBorder.Width, LowerFieldHeight - MiddleBorder.Height - BottomBorder.Height), Color.White);

            render.End();

            render.SetViewRect(orig.AddGet(new ViewRect(RealX + IconTop.Width + TextMargin, RealY + TopBorder.Height + TextMargin, Width - IconTop.Width - RightBorder.Width - TextMargin * 2, UpperFieldHeight - TopBorder.Height - MiddleBorder.Height - TextMargin * 2)));
            render.Begin();

            string textToDraw = Text;

            if (HasFocus)
            {
                textToDraw = Text.Insert(CursorPosition, "|");
            }
            Font.DrawString(textToDraw, new Point(RealX + IconTop.Width + TextMargin, RealY + TopBorder.Height + TextMargin), FontColor, render);

            render.End();

            render.SetViewRect(orig.AddGet(new ViewRect(selectorX, selectorY, selectorWidth, selectorHeight)));
            render.Begin();

            int drawX = selectorX + textAreaOriginX;
            int drawY = selectorY + textAreaOriginY;

            //DrawSprite filedir
            Font.DrawString(CurrentDirectory.FullName, new Point(drawX, drawY), FontColor, render);
            drawY += TextMargin + Font.CharHeight;
            render.DrawLine(new Vector2(drawX, drawY), new Vector2(selectorX + selectorWidth, drawY), SeparatorColor);
            drawY += 1 + TextMargin;

            foreach (DirectoryInfo d in directoryList)
            {
                if (selectedDirectories.Contains(d))
                {
                    render.DrawRect(new Rectangle(selectorX, drawY, selectorWidth, Font.CharHeight + Font.VerticalSpace), SelectedColor);
                }

                render.DrawSprite(FolderSign, new Vector2(drawX, drawY), Color.White);

                Font.DrawString(d.Name, new Point(drawX + FolderSign.Width + TextMargin, drawY), FontColor, render);
                drawY += Font.CharHeight + Font.VerticalSpace;
            }

            foreach (FileInfo f in fileList)
            {
                if (selectedFiles.Contains(f))
                {
                    render.DrawRect(new Rectangle(selectorX, drawY, selectorWidth, Font.CharHeight + Font.VerticalSpace), SelectedColor);
                }

                Font.DrawString(f.Name, new Point(drawX, drawY), FontColor, render);
                drawY += Font.CharHeight + Font.VerticalSpace;
            }

            render.End();
        }
Example #13
0
        public override void Project(Microsoft.Xna.Framework.GameTime gameTime, int x, int y, IRender render)
        {
            render.Begin();

            int n     = 0;
            int drawX = x + textMargin;

            foreach (string name in columnNames)
            {
                bool pressed = n == pressedColumnButton;

                int size = columnSizes[n];

                bool quit = false;
                if (drawX + columnSizes[n] >= RealX + Width)
                {
                    size = RealX + Width - drawX;
                    quit = true;
                }

                DrawButton(drawX, y, render, name, size, pressed);

                if (quit)
                {
                    break;
                }

                drawX += columnSizes[n];

                n += 1;
            }

            y += HeaderSize;

            render.DrawSprite(TopLeftCorner, new Vector2(x, y), Color.White);
            render.DrawSprite(TopRightCorner, new Vector2(x + Width - TopRightCorner.Width, y), Color.White);
            render.DrawSprite(BottomLeftCorner, new Vector2(x, y + Height - HeaderSize - BottomLeftCorner.Height), Color.White);
            render.DrawSprite(BottomRightCorner, new Vector2(x + Width - BottomRightCorner.Width, y + Height - HeaderSize - BottomRightCorner.Height), Color.White);

            render.DrawSprite(TopBorder, new Rectangle(x + TopLeftCorner.Width, y, Width - TopLeftCorner.Width - TopRightCorner.Width, TopBorder.Height), Color.White);
            render.DrawSprite(BottomBorder, new Rectangle(x + BottomLeftCorner.Width, y + Height - HeaderSize - BottomBorder.Height, Width - BottomLeftCorner.Width - BottomRightCorner.Width, BottomBorder.Height), Color.White);
            render.DrawSprite(LeftBorder, new Rectangle(x, y + TopLeftCorner.Height, LeftBorder.Width, Height - HeaderSize - TopLeftCorner.Height - BottomLeftCorner.Height), Color.White);
            render.DrawSprite(RightBorder, new Rectangle(x + Width - RightBorder.Width, y + TopLeftCorner.Height, RightBorder.Width, Height - HeaderSize - TopRightCorner.Height - BottomRightCorner.Height), Color.White);

            render.DrawSprite(Inside, new Rectangle(x + TopLeftCorner.Width, y + TopLeftCorner.Height, Width - BottomLeftCorner.Width - BottomRightCorner.Width, Height - HeaderSize - TopLeftCorner.Height - BottomLeftCorner.Height), Color.White);

            render.End();

            //DrawSprite list items:

            render.AddViewRect(new ViewRect(RealX + TopLeftCorner.Width,
                                            RealY + TopLeftCorner.Height + HeaderSize,
                                            Width - TopLeftCorner.Width - TopRightCorner.Width,
                                            Height - HeaderSize - TopLeftCorner.Height - BottomLeftCorner.Height));

            render.Begin();

            int rowX      = RealX + TopLeftCorner.Width + textMargin;
            int rowY      = RealY + TopLeftCorner.Height + HeaderSize + textMargin;
            int rowNumber = 0;

            foreach (ListBoxRow row in Values)
            {
                if (rowNumber == rowUnderMouse)
                {
                    render.DrawRect(new Rectangle(rowX, rowY, Width - TopLeftCorner.Width - TopRightCorner.Width, Font.CharHeight + textMargin), ElementUnderMouseColor);
                }
                if (row == SelectedRow)
                {
                    render.DrawRect(new Rectangle(rowX, rowY, Width - TopLeftCorner.Width - TopRightCorner.Width, Font.CharHeight + textMargin), SelectedElementColor);
                }

                int index = 0;
                foreach (object val in row.Values)
                {
                    string valStr = val == null ? "NULL" : val.ToString();

                    Font.DrawString(valStr, new Point(rowX, rowY), ListElementColor, render);
                    rowX  += ColumnSizes[index];
                    index += 1;
                }

                rowX  = RealX + TopLeftCorner.Width + textMargin;
                rowY += Font.CharHeight + textMargin;

                rowNumber += 1;
            }

            render.End();
        }
Example #14
0
        public override void Project(GameTime gameTime, int x, int y, IRender render)
        {
            render.Begin();

            if (pages.Count == 0)
            {
                render.DrawSprite(ButtonTopLeftCorner, new Vector2(x, y), Color.White);
                render.DrawSprite(ButtonTopRightCorner, new Vector2(x + Width - ButtonTopRightCorner.Width, y), Color.White);
                render.DrawSprite(ButtonBottomLeftCorner, new Vector2(x, y + ButtonTopLeftCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);
                render.DrawSprite(ButtonBottomRightCorner, new Vector2(x + Width - ButtonBottomLeftCorner.Width, y + ButtonTopRightCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);

                render.DrawSprite(ButtonTopBorder, new Rectangle(x + ButtonTopLeftCorner.Width, y, Width - ButtonTopLeftCorner.Width - ButtonTopRightCorner.Width, ButtonTopBorder.Height), Color.White);
                render.DrawSprite(ButtonBottomBorder, new Rectangle(x + ButtonBottomLeftCorner.Width, y + ButtonTopLeftCorner.Height + pageNameMargin + Font.CharHeight + pageNameMargin, Width - ButtonBottomLeftCorner.Width - ButtonBottomRightCorner.Width, ButtonBottomBorder.Height), Color.White);

                render.DrawSprite(ButtonLeftBorder, new Rectangle(x, y + ButtonTopLeftCorner.Height, ButtonLeftBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);
                render.DrawSprite(ButtonRightBorder, new Rectangle(x + Width - ButtonRightBorder.Width, y + ButtonTopLeftCorner.Height, ButtonLeftBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);

                render.DrawSprite(ButtonInside, new Rectangle(x + ButtonTopLeftCorner.Width, y + ButtonTopBorder.Height, Width - ButtonLeftBorder.Width - ButtonRightBorder.Width, pageNameMargin + Font.CharHeight + pageNameMargin), Color.White);
            }
            else
            {
                int n     = 0;
                int drawX = x;

                foreach (TabPage page in pages)
                {
                    int size = Math.Min(Font.MeasureString(page.Name).X + ButtonLeftBorder.Width + ButtonRightBorder.Width, (int)Math.Round(Width * sizePercentages[n], 0));

                    bool pressed = n == pressedPage;

                    DrawTab(drawX, y, render, page.Name, size, pressed);

                    drawX += size;
                    n     += 1;
                }
            }

            y += HeaderSize;

            render.DrawSprite(TopLeftCorner, new Vector2(x, y), Color.White);
            render.DrawSprite(TopRightCorner, new Vector2(x + Width - TopRightCorner.Width, y), Color.White);
            render.DrawSprite(BottomLeftCorner, new Vector2(x, y + Height - HeaderSize - BottomLeftCorner.Height), Color.White);
            render.DrawSprite(BottomRightCorner, new Vector2(x + Width - BottomRightCorner.Width, y + Height - HeaderSize - BottomRightCorner.Height), Color.White);

            render.DrawSprite(TopBorder, new Rectangle(x + TopLeftCorner.Width, y, Width - TopLeftCorner.Width - TopRightCorner.Width, TopBorder.Height), Color.White);
            render.DrawSprite(BottomBorder, new Rectangle(x + BottomLeftCorner.Width, y + Height - HeaderSize - BottomBorder.Height, Width - BottomLeftCorner.Width - BottomRightCorner.Width, BottomBorder.Height), Color.White);
            render.DrawSprite(LeftBorder, new Rectangle(x, y + TopLeftCorner.Height, LeftBorder.Width, Height - HeaderSize - TopLeftCorner.Height - BottomLeftCorner.Height), Color.White);
            render.DrawSprite(RightBorder, new Rectangle(x + Width - RightBorder.Width, y + TopLeftCorner.Height, RightBorder.Width, Height - HeaderSize - TopRightCorner.Height - BottomRightCorner.Height), Color.White);

            render.End();
        }
Example #15
0
 public void DrawCursor(IRender render, float mouseX, float mouseY)
 {
     render.Begin();
     render.DrawSprite(cursorInUse, new Vector2(mouseX, mouseY), Color.White);
     render.End();
 }