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

            render.Begin();

            render.DrawSprite(Top, new Rectangle(x, y, Width, Height - Bottom.Height), Color.White);
            render.DrawSprite(Bottom, new Rectangle(x, y + Height - Bottom.Height, Width, Bottom.Height), Color.White);

            int posX  = x + menuItemMarginX;
            int posY  = (y + Height / 2 - Font.CharHeight / 2);
            int count = 0;

            foreach (var item in MenuItems)
            {
                int strinW = Font.MeasureString(item.Name).X;

                if (count != SelectedMenuItem || !ItemIsOpen)
                {
                    Color color = count == SelectedMenuItem ? FontHighlightColor : FontColor;

                    if (count == SelectedMenuItem)
                    {
                        render.DrawHorizontalLine(new Point(posX, y + menuItemMarginY), strinW, HighlightBorder);
                        render.DrawHorizontalLine(new Point(posX, y + Height - menuItemMarginY - 1), strinW, HighlightBorder);
                        render.DrawVerticalLine(new Point(posX, y + menuItemMarginY), Height - menuItemMarginY * 2, HighlightBorder);
                        render.DrawVerticalLine(new Point(posX + strinW, y + menuItemMarginY), Height - menuItemMarginY * 2, HighlightBorder);

                        render.DrawRect(new Rectangle(posX + 1, y + menuItemMarginY + 1, strinW - 2, Height - menuItemMarginY * 2 - 3), HighlightBody);
                    }

                    Font.DrawString(item.Name, new Point(posX + 1, posY), color, render);
                }

                posX += strinW + menuItemMarginX;

                count += 1;
            }

            if (ItemIsOpen)
            {
                Parent.AddDrawDelegate(DrawMenu);
            }

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

            render.DrawBody(new Rectangle(x, y, TextFieldWidth, TextFieldHeight), Color.White,
                            TopBorder,
                            TopRightCorner,
                            RightBorder,
                            BottomRightCorner,
                            BottomBorder,
                            BottomLeftCorner,
                            LeftBorder,
                            TopLeftCorner,
                            Inside);

            Font.DrawString(CurrentLine, new Point(x + LeftBorder.Width + textMargin, y + TextFieldHeight / 2 - Font.CharHeight / 2), FontColor, render);

            render.End();

            if (Open)
            {
                Parent.AddDrawDelegate(DrawOpen);
            }
        }