예제 #1
0
        protected override void PaintComponent()
        {
            CheckMouseHeldDown();

            textField.RenderWidget();

            // Render the up and down buttons
            Color c = (!enabled || upPressed) ? disabledColor : buttonColor;

            UI2DRenderer.FillRectangle(upArrowBound, null, c);
            c = (!enabled || downPressed) ? disabledColor : buttonColor;
            UI2DRenderer.FillRectangle(downArrowBound, null, c);

            // Render the border of the up and down button
            UI2DRenderer.DrawRectangle(upArrowBound, borderColor, 1);
            UI2DRenderer.DrawRectangle(downArrowBound, borderColor, 1);

            // Render the up and down arrows
            // First render the up arrow
            if (upArrowPoints.Count > 0)
            {
                UI2DRenderer.FillPolygon(upArrowPoints, arrowColor, Point.Zero, UI2DRenderer.PolygonShape.Convex);
                UI2DRenderer.FillPolygon(downArrowPoints, arrowColor, Point.Zero, UI2DRenderer.PolygonShape.Convex);
            }
        }
예제 #2
0
        protected override void PaintBorder()
        {
            if (!visible)
            {
                return;
            }

            UI2DRenderer.DrawRectangle(rect, borderColor, 1);
        }
예제 #3
0
        /// <summary>
        /// Paints dashed border when focused.
        /// </summary>
        protected override void PaintBorder()
        {
            if (!enabled || !focused)
            {
                return;
            }

            UI2DRenderer.DrawRectangle(paintBounds, Color.Yellow, 1);
        }
예제 #4
0
        public void CreateMenuPly()
        {
            int    Idx;
            string NumberPly;

            TextTitle = "Select Your Player";

            UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170));
            UI2DRenderer.FillRectangle(new Rectangle(130, 250, Luna.Width, Luna.Height), Luna, Color.White);

            for (Idx = 0; Idx < 8; Idx++)
            {
                UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X, (int)PosObjMenu[Idx].Y, FrameW, FrameH), CarsTextures[Idx], Color.White);
                UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X - 15, (int)PosObjMenu[Idx].Y - 15, FrameW + 30, FrameH + 30), Marco, Color.White);
            }

            for (Idx = 0; Idx < GameLogic.NumberPlayers; Idx++)
            {
                UI2DRenderer.DrawRectangle(new Rectangle((int)PosObjMenu[GameLogic.Players[Idx].PlySelect - 1].X,
                                                         (int)PosObjMenu[GameLogic.Players[Idx].PlySelect - 1].Y,
                                                         FrameW,
                                                         FrameH),
                                           GameLogic.Players[Idx].PlayerColor, 5);

                if (!GameLogic.Players[Idx].IsPlyOK)
                {
                    NumberPly = (Idx + 1).ToString();
                }
                else
                {
                    NumberPly = "X";
                }
                //Player Number
                UI2DRenderer.WriteText(new Vector2(PosObjMenu[GameLogic.Players[Idx].PlySelect - 1].X + 8,
                                                   PosObjMenu[GameLogic.Players[Idx].PlySelect - 1].Y + 2),
                                       NumberPly,
                                       GameLogic.Players[Idx].PlayerColor,
                                       BladeFont);
            }

            /******** text For the Screen ********/
            UI2DRenderer.WriteText(new Vector2(0, 50), TextTitle, Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);

            UI2DRenderer.WriteText(new Vector2(1050, 680), TextIP, new Color(255, 10, 10, 255),
                                   CalibriFont, new Vector2(0.8f, 0.8f));

            UI2DRenderer.WriteText(new Vector2(0, 610), TextMsg, new Color(255, 10, 10, 255),
                                   BladeFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
        }
예제 #5
0
        protected override void PaintComponent()
        {
            base.PaintComponent();

            // Show the highlight when mouse is over
            if (focused)
            {
                UI2DRenderer.DrawRectangle(focusRect, focusedColor, 2);
            }

            if (label.Length > 0 && textFont != null)
            {
                UI2DRenderer.WriteText(textPos, label, textColor, textFont);
            }
        }
예제 #6
0
        protected override void PaintComponent()
        {
            base.PaintComponent();

            // Draw the check box part
            if (mouseDown && enabled)
            {
                // Use disabled color to display pressed down action
                UI2DRenderer.FillRectangle(boxRect, null, disabledColor);
            }
            else if (selected)
            {
                Color c = (enabled) ? boxColor : disabledColor;
                UI2DRenderer.FillRectangle(boxRect, null, c);

                UI2DRenderer.FillRectangle(selectedRect, null, selectedColor);
            }
            else
            {
                Color c = (enabled) ? boxColor : disabledColor;
                UI2DRenderer.FillRectangle(boxRect, null, c);
            }

            // Draw the border of the check box part
            UI2DRenderer.DrawRectangle(boxRect, color, 1);

            // Show the highlight when mouse is over
            if (enabled && within && !mouseDown)
            {
                UI2DRenderer.DrawRectangle(highlightRect, highlightColor, 2);
            }

            if (label.Length > 0 && textFont != null)
            {
                // Draw the label part
                UI2DRenderer.WriteText(textPos, label, textColor, textFont);
            }
        }
예제 #7
0
        protected override void PaintComponent()
        {
            if ((mouseDown && enabled) || (focused && clickKeyPressed))
            {
                // Use disabled color to display pressed down action
                UI2DRenderer.FillRectangle(paintBounds, backTexture, disabledColor);
            }
            else
            {
                base.PaintComponent();
            }

            if (label.Length > 0)
            {
                if (textFont != null)
                {
                    UI2DRenderer.WriteText(textPos, label, textColor, textFont);
                }
            }

            Color color = ColorHelper.Empty;

            // Add highlight on the border if mouse is hovering
            if (enabled && within && !mouseDown)
            {
                color = highlightColor;
            }
            else if (focused)
            {
                color = focusedColor;
            }

            if (!color.Equals(ColorHelper.Empty))
            {
                UI2DRenderer.DrawRectangle(highlightBound, color, 2);
            }
        }
예제 #8
0
        protected override void PaintBorder()
        {
            switch (border)
            {
            case GoblinEnums.BorderFactory.EtchedBorder:
                UI2DRenderer.DrawRectangle(etchedBorderRect, etchWhiteColor, 1);
                UI2DRenderer.DrawRectangle(paintBounds, etchBlackColor, 1);
                break;

            case GoblinEnums.BorderFactory.LineBorder:
                base.PaintBorder();
                break;

                /*case GoblinEnums.BorderFactory.LoweredBevelBorder:
                 *
                 *  break;
                 *
                 * case GoblinEnums.BorderFactory.RaisedBevelBorder:
                 *  break;
                 *
                 * case GoblinEnums.BorderFactory.TitledBorder:
                 *  break;*/
            }
        }
예제 #9
0
        protected override void PaintComponent()
        {
            // Render the track first since it appears on the background of everything
            if (paintTrack)
            {
                UI2DRenderer.DrawRectangle(trackBound, trackBorderColor, 1);

                UI2DRenderer.FillRectangle(trackBound, null, trackColor);
            }

            // Render the knob
            if (paintTicks)
            { // If ticks are painted, then the lower part of the knob will change to a pointing shape
                UI2DRenderer.FillPolygon(knobPoints, knobColor, knobBound.Location, UI2DRenderer.PolygonShape.Convex);

                Point p1 = new Point();
                Point p2 = new Point();
                for (int i = 0, j = 0; i < knobPoints.Count; i++)
                {
                    if (i == knobPoints.Count - 1)
                    {
                        j = 0;
                    }
                    else
                    {
                        j = i + 1;
                    }

                    p1.X = knobPoints[i].X + knobBound.Location.X;
                    p1.Y = knobPoints[i].Y + knobBound.Location.Y;

                    p2.X = knobPoints[j].X + knobBound.Location.X;
                    p2.Y = knobPoints[j].Y + knobBound.Location.Y;
                    UI2DRenderer.DrawLine(p1, p2, knobBorderColor, 1);
                }
            }
            else
            { // Otherwise, it's a simple rectangle
                Color c = (enabled) ? knobColor : disabledColor;
                // Render inside first
                UI2DRenderer.FillRectangle(knobBound, null, c);

                UI2DRenderer.DrawRectangle(knobBound, knobBorderColor, 1);
            }

            // Render the tickes
            if (paintTicks)
            {
                float nextLoc = 0;
                if (orientation == GoblinEnums.Orientation.Horizontal)
                {
                    nextLoc = tickBound.X + minorTickDelta;
                    // Render the minor ticks if minorTickSpacing is greater than 0
                    for (int i = 0; i < minorTickCount; i++)
                    {
                        UI2DRenderer.DrawLine((int)nextLoc, tickBound.Y, (int)nextLoc, tickBound.Y + 4,
                                              knobBorderColor, 1);
                        nextLoc += minorTickDelta;
                    }

                    nextLoc = tickBound.X;
                    // Render the major ticks if majorTickSpacing is greater than 0
                    for (int i = 0; i <= majorTickCount; i++)
                    {
                        UI2DRenderer.DrawLine((int)nextLoc, tickBound.Y, (int)nextLoc, tickBound.Y + 8,
                                              knobBorderColor, 1);
                        nextLoc += majorTickDelta;
                    }
                }
                else
                {
                    nextLoc = tickBound.Y + minorTickDelta;
                    // Render the minor ticks if minorTickSpacing is greater than 0
                    for (int i = 0; i < minorTickCount; i++)
                    {
                        UI2DRenderer.DrawLine(tickBound.X, (int)nextLoc, tickBound.X + 4, (int)nextLoc,
                                              knobBorderColor, 1);
                        nextLoc += minorTickDelta;
                    }

                    nextLoc = tickBound.Y;
                    // Render the major ticks if majorTickSpacing is greater than 0
                    for (int i = 0; i <= majorTickCount; i++)
                    {
                        UI2DRenderer.DrawLine(tickBound.X, (int)nextLoc, tickBound.X + 8, (int)nextLoc,
                                              knobBorderColor, 1);
                        nextLoc += majorTickDelta;
                    }
                }
            }

            // Render the labels
            if (paintLabels && textFont != null)
            {
                float   nextLoc = 0;
                Vector2 textPos = new Vector2();
                if (orientation == GoblinEnums.Orientation.Horizontal)
                {
                    nextLoc   = tickBound.X;
                    textPos.Y = labelBound.Y + 1;
                    // Render labels below major ticks only
                    for (int i = 0; i < tickLabels.Count; i++)
                    {
                        textPos.X = (int)nextLoc - labelShifts[i];
                        UI2DRenderer.WriteText(textPos, tickLabels[i], knobBorderColor, textFont);
                        nextLoc += majorTickDelta;
                    }
                }
                else
                {
                    nextLoc   = tickBound.Y;
                    textPos.X = labelBound.X + 1;
                    // Render labels next to major ticks only
                    for (int i = 0; i < tickLabels.Count; i++)
                    {
                        textPos.Y = (int)nextLoc - 5;
                        UI2DRenderer.WriteText(textPos, tickLabels[tickLabels.Count - i - 1], knobBorderColor, textFont);
                        nextLoc += majorTickDelta;
                    }
                }
            }
        }
예제 #10
0
 /// <summary>
 /// Implements how the border of the component should be painted.
 /// </summary>
 /// <remarks>
 /// This base class method paints only the outer-most border
 /// </remarks>
 protected virtual void PaintBorder()
 {
     UI2DRenderer.DrawRectangle(paintBounds, borderColor, 1);
 }