Esempio n. 1
0
        public void CreateBoxStatus(Vector2 BoxPos, Game_Player Player)
        {
            if (Player.PlyHealth < 0)
            {
                Player.PlyHealth = 0;
            }

            int PosX  = (int)BoxPos.X;
            int PosXP = (int)BoxPos.X + BoxStatusTx[0].Width;
            int PoxY  = (int)BoxPos.Y + 25;
            int Healt = Player.PlyHealth / 5;
            int Popul = Player.Popularity / 5;

            TextTitle = Player.PlyName;
            Color ColorHBar    = new Color(new Vector4(255, 0, 0, 10));
            Color ColorHPolBar = new Color(new Vector4(255, 255, 255, 10));

            UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY, BoxStatusTx[0].Width, BoxStatusTx[0].Height), BoxStatusTx[0], ColorHBar);
            UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY + 20, BoxStatusTx[0].Width, BoxStatusTx[0].Height), BoxStatusTx[0], ColorHPolBar);

            PosX += BoxStatusTx[0].Width;
            UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY, BoxStatusTx[1].Width * Healt, BoxStatusTx[1].Height), BoxStatusTx[1], ColorHBar);
            //UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY + 20, BoxStatusTx[1].Width * Popul, BoxStatusTx[1].Height), BoxStatusTx[1], ColorHPolBar);

            PosX  += BoxStatusTx[1].Width * Healt;
            PosXP += BoxStatusTx[1].Width * Popul;
            UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY, BoxStatusTx[2].Width, BoxStatusTx[2].Height), BoxStatusTx[2], ColorHBar);
            //UI2DRenderer.FillRectangle(new Rectangle(PosXP, PoxY + 20, BoxStatusTx[2].Width, BoxStatusTx[2].Height), BoxStatusTx[2], ColorHPolBar);

            UI2DRenderer.WriteText(BoxPos, TextTitle, Color.DarkGray, CalibriFont, new Vector2(0.5f, 0.5f));
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        public void CreateHistory()
        {
            int Idx = GameLogic.CharHistory;

            TextTitle = GameLogic.CharacterNames[Idx];

            //Animation
            if (TxtTitleCol == Color.Red)
            {
                TxtTitleCol = Color.Yellow;
            }
            else
            {
                TxtTitleCol = Color.Red;
            }

            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);
            UI2DRenderer.FillRectangle(new Rectangle(50, 190, MenuHistory[Idx].Width, MenuHistory[Idx].Height), MenuHistory[Idx], Color.White);

            UI2DRenderer.FillRectangle(new Rectangle(255, 220, FrameW, FrameH), CarsTextures[Idx], Color.White);
            UI2DRenderer.FillRectangle(new Rectangle(255 - 15, 220 - 15, FrameW + 30, FrameH + 30), Marco, Color.White);

            UI2DRenderer.FillRectangle(new Rectangle(600, 140, 440, 535), null, new Color(0, 0, 0, 255));

            UI2DRenderer.WriteText(new Vector2(610, 155), GameLogic.HistoryPers[Idx], Color.LawnGreen,
                                   CasioFont, new Vector2(0.75f, 0.75f));

            // Draw a 2D text string at the center of the screen
            UI2DRenderer.WriteText(new Vector2(0, 50), TextTitle, Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);

            UI2DRenderer.WriteText(new Vector2(450, 670), "Continue", TxtTitleCol,
                                   BladeFont, new Vector2(1.0f, 1.0f));
        }
Esempio n. 4
0
        protected override void PaintComponent()
        {
            if (!visible)
            {
                return;
            }

            UI2DRenderer.FillRectangle(rect, null, backgroundColor);
        }
Esempio n. 5
0
        public void CreateLoading()
        {
            //TextTitle = "PAUSE GAME";

            UI2DRenderer.FillRectangle(new Rectangle(540, 200, Loading.Width, Loading.Height), Loading, Color.White);

            // Draw a 2D text string at the center of the screen
            //UI2DRenderer.WriteText(Vector2.Zero, TextTitle, TxtTitleCol,
            //    PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.Top);
        }
Esempio n. 6
0
        public void CreateMenuPause()
        {
            int Idx = (int)GameLogic.Pause_State;

            TextTitle = "PAUSE GAME";

            UI2DRenderer.FillRectangle(new Rectangle(450, 200, MenuMPauseSprites[Idx].Width, MenuMPauseSprites[Idx].Height), MenuMPauseSprites[Idx], Color.White);

            // Draw a 2D text string at the center of the screen
            UI2DRenderer.WriteText(Vector2.Zero, TextTitle, TxtTitleCol,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.Top);
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        public void CreateMenuPlayMode()
        {
            int Idx = (int)GameLogic.MultiplayerMode;

            TextTitle = "Select the Multiplayer mode";

            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);

            UI2DRenderer.FillRectangle(new Rectangle(450, 170, MenuMPlaySprites[Idx].Width, MenuMPlaySprites[Idx].Height), MenuMPlaySprites[Idx], Color.White);

            // Draw a 2D text string at the center of the screen
            UI2DRenderer.WriteText(new Vector2(0, 90), TextTitle, Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);

            UI2DRenderer.WriteText(new Vector2(0, 55), TextRobert, Color.Gray,
                                   RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
        }
Esempio n. 9
0
        public void CreateRankingTour()
        {
            int Idx;

            Idx = (int)GameLogic.EndActionTour;

            TextTitle = "Tournament Ranking";

            //Animation
            if (TxtTitleCol == Color.Red)
            {
                TxtTitleCol = Color.Yellow;
            }
            else
            {
                TxtTitleCol = Color.Red;
            }

            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);
            UI2DRenderer.FillRectangle(new Rectangle(560, 560, MenuTourt[Idx].Width, MenuTourt[Idx].Height), MenuTourt[Idx], Color.White);

            for (Idx = 0; Idx < GameLogic.NumberPlayers; Idx++)
            {
                UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X, 220, FrameW, FrameH), CarsTextures[GameLogic.Players[Idx].PlySelect - 1], Color.White);
                UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X - 15, 220 - 15, FrameW + 30, FrameH + 30), Marco, Color.White);

                if (GameLogic.Players[Idx].IsDead == true)
                {
                    UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X - 15, 220 - 15, FrameW + 30, FrameH + 30), Muerte, Color.White);
                }
                else
                {
                    UI2DRenderer.WriteText(new Vector2((int)PosObjMenu[Idx].X - 5, 160), "Winner!", TxtTitleCol, PuntosFont);
                }

                UI2DRenderer.WriteText(new Vector2((int)PosObjMenu[Idx].X + 10, 425), "Deaths: " + GameLogic.Players[Idx].NumDeads, Color.Red, BladeFont);
                //UI2DRenderer.WriteText(new Vector2((int)PosObjMenu[Idx].X + 10, 460), "Kills: " + GameLogic.Players[Idx].NumKills, Color.Red, BladeFont);
            }

            // Draw a 2D text string at the center of the screen
            UI2DRenderer.WriteText(new Vector2(0, 50), TextTitle, Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
        }
Esempio n. 10
0
        public void CreateMenuSelLevel()
        {
            int Idx = (int)GameLogic.ActualLevel;

            TextTitle = "Select your level";

            UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170));

            UI2DRenderer.FillRectangle(new Rectangle(30, 180, MenuLevelsprites[Idx].Width, MenuLevelsprites[Idx].Height), MenuLevelsprites[Idx], Color.White);

            UI2DRenderer.FillRectangle(new Rectangle(450, 170, Levelsprites[Idx].Width, Levelsprites[Idx].Height), Levelsprites[Idx], Color.White);

            // Draw a 2D text string at the center of the screen
            UI2DRenderer.WriteText(new Vector2(0, 90), TextTitle, Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);

            UI2DRenderer.WriteText(new Vector2(0, 55), TextRobert, Color.Gray,
                                   RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
        }
Esempio n. 11
0
        public void CreateEndGame()
        {
            int Idx;

            TextTitle = "Congratulations!!!";

            //Animation
            if (TxtTitleCol == Color.Red)
            {
                TxtTitleCol = Color.Yellow;
            }
            else
            {
                TxtTitleCol = Color.Red;
            }

            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);
            UI2DRenderer.FillRectangle(new Rectangle(260, 440, Trofeo.Width, Trofeo.Height), Trofeo, Color.White);

            for (Idx = 0; Idx < GameLogic.NumberPlayers; Idx++)
            {
                if (GameLogic.Players[Idx].IsDead == false)
                {
                    UI2DRenderer.WriteText(new Vector2(210 - 5, 160), "Winner!", TxtTitleCol, PuntosFont);

                    UI2DRenderer.FillRectangle(new Rectangle(210, 220, FrameW, FrameH), CarsTextures[GameLogic.Players[Idx].PlySelect - 1], Color.White);
                    UI2DRenderer.FillRectangle(new Rectangle(210 - 15, 220 - 15, FrameW + 30, FrameH + 30), Marco, Color.White);

                    UI2DRenderer.FillRectangle(new Rectangle(600, 250, 600, 300), null, new Color(0, 0, 0, 255));

                    UI2DRenderer.WriteText(new Vector2(610, 255), GameLogic.HistoryEndgame[GameLogic.Players[Idx].PlySelect - 1], Color.LawnGreen,
                                           CasioFont, new Vector2(0.75f, 0.75f));
                }
            }

            // Draw a 2D text string at the center of the screen
            UI2DRenderer.WriteText(new Vector2(0, 50), TextTitle, Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);

            UI2DRenderer.WriteText(new Vector2(480, 620), "Continue", TxtTitleCol,
                                   BladeFont, new Vector2(1.0f, 1.0f));
        }
Esempio n. 12
0
        /// <summary>
        /// Implements how the component should be painted.
        /// </summary>
        /// <remarks>
        /// This base class method paints only the background
        /// </remarks>
        protected virtual void PaintComponent()
        {
            if (!drawBackground)
            {
                return;
            }

            // Draw normal background if no image is set
            if (backTexture == null)
            {
                Color color = (enabled) ? backgroundColor : disabledColor;
                // Draw the background
                UI2DRenderer.FillRectangle(paintBounds, State.BlankTexture, color);
            }
            else
            {
                // Draw the background
                UI2DRenderer.FillRectangle(paintBounds, backTexture, textureColor);
            }
        }
Esempio n. 13
0
        public void CreateCredits()
        {
            int Idx = (int)GameLogic.CreditScreen;

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

            UI2DRenderer.FillRectangle(new Rectangle(74, 200, Credits[Idx].Width, Credits[Idx].Height), Credits[Idx], Color.White);

            //Title 1
            UI2DRenderer.WriteText(new Vector2(0, 30), "Credits:", Color.Gray,
                                   RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
            //Title A
            UI2DRenderer.WriteText(new Vector2(0, 60), "ultimate demolition derby", Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
            //Title B
            UI2DRenderer.WriteText(new Vector2(0, 110), "on the moon", Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
        }
Esempio n. 14
0
        public void CreateMenuMode()
        {
            int Idx = (int)GameLogic.GameMode;

            TextTitle = "Select your game mode";

            //Velo
            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);
            UI2DRenderer.FillRectangle(new Rectangle(450, 200, MenusSprites[Idx].Width, MenusSprites[Idx].Height), MenusSprites[Idx], Color.White);

            // Draw a 2D text string at the center of the screen
            UI2DRenderer.WriteText(new Vector2(0, 80), TextTitle, Color.Red,
                                   PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);

            UI2DRenderer.WriteText(new Vector2(0, 55), TextRobert, Color.Gray,
                                   RoboCopFont, 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));
        }
Esempio n. 15
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);
            }
        }
Esempio n. 16
0
        public void CreateIntro()
        {
            TextTitle = "Press ENTER to continue";

            //Velo
            UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170));
            //Logo
            UI2DRenderer.FillRectangle(new Rectangle(440, 250, GameLogo.Width * 2, GameLogo.Height * 2), GameLogo, Color.White);
            //Titulo
            UI2DRenderer.FillRectangle(new Rectangle(190, 30, GameTitle.Width, GameTitle.Height), GameTitle, Color.White);

            //Animation
            if (TxtTitleCol == Color.Black)
            {
                TxtTitleCol = Color.White;
            }
            else
            {
                TxtTitleCol = Color.Black;
            }

            //Title 1
            //UI2DRenderer.WriteText(new Vector2(0, 30), "Robert Swanson Presents:", Color.Gray,
            //    RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
            //Title A
            //UI2DRenderer.WriteText(new Vector2(0, 60), "ultimate demolition derby", Color.Red,
            //    PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
            //Title B
            //UI2DRenderer.WriteText(new Vector2(0, 110), "on the moon", Color.Red,
            //    PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
            //info Text
            UI2DRenderer.WriteText(new Vector2(450, 670), TextTitle, TxtTitleCol,
                                   RoboCopFont, new Vector2(1.0f, 1.0f));

            UI2DRenderer.WriteText(new Vector2(1050, 680), TextIP, new Color(255, 10, 10, 255),
                                   CalibriFont, new Vector2(0.8f, 0.8f));
        }
Esempio n. 17
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);
            }
        }
Esempio n. 18
0
        protected override void PaintComponent()
        {
            base.PaintComponent();

            // paint the progress bar
            if (indeterminate)
            {
                int x      = 0;
                int gap    = paintBounds.Width / 12;
                int bigGap = gap * 2;

                if (indeterminateCounter > 80)
                {
                    indeterminateCounter = 0;
                }

                if (indeterminateCounter > 40)
                {
                    UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X, paintBounds.Y + 1,
                                                             (int)((indeterminateCounter - 40) / 40f * gap), (paintBounds.Height - 2)),
                                               null, barColor);

                    int w = (int)((80 - indeterminateCounter) / 40f * gap);
                    UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X + paintBounds.Width - w,
                                                             paintBounds.Y + 1, w, (paintBounds.Height - 2)), null, barColor);
                }
                else
                {
                    x = (int)((indeterminateCounter / 80f + 5) * bigGap);
                    UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X + x, paintBounds.Y + 1,
                                                             gap, (paintBounds.Height - 2)), null, barColor);
                }

                for (int i = 0; i < 5; i++)
                {
                    x = (int)((indeterminateCounter / 80f + i) * bigGap);
                    UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X + x, paintBounds.Y + 1,
                                                             gap, (paintBounds.Height - 2)), null, barColor);
                }

                indeterminateCounter++;
            }
            else
            {
                UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X + 1, paintBounds.Y + 1,
                                                         (int)(PercentComplete / 100 * (paintBounds.Width - 2)), paintBounds.Height - 2),
                                           null, barColor);
            }

            // paint the percent complete
            if (!indeterminate && paintString && textFont != null)
            {
                String  msg        = (int)PercentComplete + "%";
                Vector2 pos        = new Vector2();
                Vector2 msgMeasure = textFont.MeasureString(msg);
                pos.X = paintBounds.X + (int)(paintBounds.Width - msgMeasure.X) / 2;
                pos.Y = paintBounds.Y + (int)(paintBounds.Height - msgMeasure.Y) / 2;

                UI2DRenderer.WriteText(pos, msg, stringColor, textFont);
            }
        }
Esempio n. 19
0
        public void Draw(GameTime gameTime)
        {
            // Count the time elapsed in the play mode if game is not over yet
            if (gameState.CurrentGameMode == GameState.GameMode.Play && !gameState.GameOver)
            {
                gameState.ElapsedSecond += gameTime.ElapsedGameTime.TotalSeconds;
                if (gameState.ElapsedSecond >= 60)
                {
                    gameState.ElapsedMinute++;
                    gameState.ElapsedSecond = 0;
                }
                // Update the time elapsed label with the new elapsed time
                modeStatusLabel = "Play: " + (int)gameState.ElapsedMinute + ":" + String.Format("{0:D2}",
                                                                                                (int)gameState.ElapsedSecond) + "  ";
            }

            // Prints out the help texts that shows the short-cut keys for each command
            if (enableHelp)
            {
                UI2DRenderer.WriteText(new Vector2(0, 50), "'A' -- Add Mode", Color.Red, uiFont,
                                       Vector2.One * 0.5f, GoblinEnums.HorizontalAlignment.Left, GoblinEnums.VerticalAlignment.None);
                UI2DRenderer.WriteText(new Vector2(0, 75), "'E' -- Edit Mode", Color.Red, uiFont,
                                       Vector2.One * 0.5f, GoblinEnums.HorizontalAlignment.Left, GoblinEnums.VerticalAlignment.None);
                UI2DRenderer.WriteText(new Vector2(0, 100), "'P' -- Play/Restart Game", Color.Red, uiFont,
                                       Vector2.One * 0.5f, GoblinEnums.HorizontalAlignment.Left, GoblinEnums.VerticalAlignment.None);
                UI2DRenderer.WriteText(new Vector2(0, 125), "'R' -- Reset Game", Color.Red, uiFont,
                                       Vector2.One * 0.5f, GoblinEnums.HorizontalAlignment.Left, GoblinEnums.VerticalAlignment.None);
                UI2DRenderer.WriteText(new Vector2(0, 150), "'S' -- Toggle Shadow", Color.Red, uiFont,
                                       Vector2.One * 0.5f, GoblinEnums.HorizontalAlignment.Left, GoblinEnums.VerticalAlignment.None);
                UI2DRenderer.WriteText(new Vector2(0, 175), "'G' -- Toggle GUI", Color.Red, uiFont,
                                       Vector2.One * 0.5f, GoblinEnums.HorizontalAlignment.Left, GoblinEnums.VerticalAlignment.None);
                if (gameState.CurrentGameMode == GameState.GameMode.Edit)
                {
                    UI2DRenderer.WriteText(new Vector2(0, 200), "'D' -- Delete Selected Dominos", Color.Red,
                                           uiFont, Vector2.One * 0.5f, GoblinEnums.HorizontalAlignment.Left,
                                           GoblinEnums.VerticalAlignment.None);
                }
                if (gameState.CurrentGameMode == GameState.GameMode.Play)
                {
                    UI2DRenderer.WriteText(new Vector2(0, 200), "'C' -- Toggle Center Cursor Mode", Color.Red,
                                           uiFont, Vector2.One * 0.5f, GoblinEnums.HorizontalAlignment.Left,
                                           GoblinEnums.VerticalAlignment.None);
                }
            }

            // Draws the cross hair mark to indicate the mouse position which is used for
            // ball shooting, domino addition, domino edition, and GUI interaction (if GUI is shown)
            UI2DRenderer.FillRectangle(new Rectangle(crossHairPoint.X - 10, crossHairPoint.Y,
                                                     23, 3), null, new Color(50, 205, 50, 150));
            UI2DRenderer.FillRectangle(new Rectangle(crossHairPoint.X, crossHairPoint.Y - 10,
                                                     3, 23), null, new Color(50, 205, 50, 150));

            UI2DRenderer.WriteText(Vector2.Zero, modeStatusLabel, Color.White, labelFont,
                                   GoblinEnums.HorizontalAlignment.Right, GoblinEnums.VerticalAlignment.Top);

            // Displays how many balls are used so far
            if (gameState.CurrentGameMode == GameState.GameMode.Play)
            {
                UI2DRenderer.WriteText(Vector2.Zero, "Balls Used: " + ballCount, Color.Red,
                                       labelFont, GoblinEnums.HorizontalAlignment.Right, GoblinEnums.VerticalAlignment.Bottom);
            }

            // Shows the victory texts as well as play the victory sound if won
            if (gameState.GameOver)
            {
                UI2DRenderer.WriteText(new Vector2(0, 130), "Victory!! You Won!!", Color.Red,
                                       victoryFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
                UI2DRenderer.WriteText(new Vector2(0, 180), "Time: " + (int)gameState.ElapsedMinute + ":"
                                       + String.Format("{0:D2}", (int)gameState.ElapsedSecond), Color.Red,
                                       victoryFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);
                UI2DRenderer.WriteText(new Vector2(0, 220), "Balls Used: " + ballCount, Color.Red,
                                       victoryFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None);

                Texture2D trophy = null;
                if (gameState.ElapsedMinute < 1 && gameState.ElapsedSecond <= 14)
                {
                    trophy = trophyGold;
                }
                else if (gameState.ElapsedMinute < 1 && gameState.ElapsedSecond <= 25)
                {
                    trophy = trophySilver;
                }
                else
                {
                    trophy = trophyBronze;
                }

                UI2DRenderer.FillRectangle(new Rectangle((State.Width - trophy.Width) / 2,
                                                         280, trophy.Width, trophy.Height), trophy, Color.White);
            }
        }
Esempio n. 20
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;
                    }
                }
            }
        }