Example #1
0
        /// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            // This game has a blue background. Why? Because!
            //ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.CornflowerBlue, 0, 0
            // Our player and enemy are both actually just text strings
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();
            spriteBatch.Draw(board, new Rectangle(50, 50, board.Width + 100, board.Height), Color.White);
            spriteBatch.Draw(soalTexture, new Rectangle(100, 150, 800, 250), Color.White);
            spriteBatch.DrawString(gameFont, time.ToString(@"hh\:mm\:ss"), new Vector2(400, 65), Color.White);

            foreach (TextureButton tb in buttons)
            {
                tb.Draw(spriteBatch);
            }

            spriteBatch.End();

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0 || pauseAlpha > 0)
            {
                float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);

                ScreenManager.FadeBackBufferToBlack(alpha);
            }
        }
Example #2
0
        /// <summary>
        /// Draws the message box.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            SpriteFont  font        = ScreenManager.Font;

            // Darken down any other screens that were drawn beneath the popup.
            ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);

            // Center the message text in the viewport.
            Viewport viewport     = ScreenManager.GraphicsDevice.Viewport;
            Vector2  viewportSize = new Vector2(viewport.Width, viewport.Height);
            Vector2  textSize     = font.MeasureString(message);
            Vector2  textPosition = (viewportSize - textSize) / 2;

            int hPad = 32;
            int vPad = 16;

            // The background includes a border somewhat larger than the text itself.
            //Console.WriteLine(dimension.X);
            if (Math.Abs(dimension.X) > 0.0001f)
            {
                //Console.WriteLine("executed");
                hPad = (int)dimension.X;
                vPad = (int)dimension.Y;
            }


            Rectangle backgroundRectangle = new Rectangle((int)textPosition.X - hPad,
                                                          (int)textPosition.Y - vPad,
                                                          (int)textSize.X + hPad * 2,
                                                          (int)textSize.Y + vPad * 2);

            // Fade the popup alpha during transitions.
            Color color = Color.White * TransitionAlpha;

            spriteBatch.Begin();

            // Draw the background rectangle.
            spriteBatch.Draw(gradientTexture, backgroundRectangle, color);

            // Draw the message box text.
            spriteBatch.DrawString(font, message, textPosition, color);

            spriteBatch.End();
        }
Example #3
0
        /// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            // This game has a blue background. Why? Because!
            //ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.CornflowerBlue, 0, 0);

            // Our player and enemy are both actually just text strings.
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();
            wheel.Draw(spriteBatch);
            spriteBatch.Draw(arrow, new Vector2(499 - arrow.Width / 2, -10), Color.White);
            foreach (TextureButton tb in tabButtons)
            {
                tb.Draw(spriteBatch);
            }

            foreach (TextureButton tb in buttons)
            {
                tb.Draw(spriteBatch);
            }

            /* Draw Score */
            spriteBatch.DrawString(font, "Skor Pemain 1:\n" + skorPlayer1.ToString(), new Vector2(10, 0), Color.White);
            spriteBatch.DrawString(font, "Skor Pemain 2:\n" + skorPlayer2.ToString(), new Vector2(10, 100), Color.White);
            spriteBatch.DrawString(font, "Skor Pemain 3:\n" + skorPlayer3.ToString(), new Vector2(10, 200), Color.White);

            spriteBatch.DrawString(font, wheel.choosenOption.ToString(), new Vector2(490, 0), Color.White);
            spriteBatch.End();

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0 || pauseAlpha > 0)
            {
                float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);

                ScreenManager.FadeBackBufferToBlack(alpha);
            }
        }