Example #1
0
        private void _gameTimer_Draw(object sender, GameTimerEventArgs e)
        {
            BackgroundRenderer.Render();

            foreach (LocationsVM.Location l in myVM.SelectedNearbyLocations)
            {
                l.PlacemarkPresenter.Renderer.Render();
            }

            _device.Clear(Color.Black);

            _spriteBatch.Begin();
            _spriteBatch.Draw(BackgroundRenderer.Texture, Vector2.Zero, Color.White);
            _spriteBatch.End();

            foreach (LocationsVM.Location l in myVM.SelectedNearbyLocations)
            {
                l.PlacemarkPresenter.Object3D.shapeTexture = l.PlacemarkPresenter.Renderer.Texture;

                foreach (EffectPass pass in l.Object3dEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    l.Object3dEffect.Texture = l.PlacemarkPresenter.Object3D.shapeTexture;
                    l.PlacemarkPresenter.Object3D.RenderShape(_device);
                }
            }
        }
Example #2
0
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            // Render the page to a texture. We do this before clearing as it changes render targets and
            // as such will cause issues if we do it in the middle of our actual drawing.
            uiRenderer.Render();

            // Update the frame rate counter with the time
            frameRateCounter.OnDraw(e.ElapsedTime);

            // Clear the background
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);

            // Draw the current scene
            Renderer.Current.Draw();

            // Draw the UI texture with SpriteBatch
            spriteBatch.Begin();
            spriteBatch.Draw(uiRenderer.Texture, Vector2.Zero, Color.White * uiOpacity);

            // Optionally draw the frame rate counters
            if (Renderer.Current.State.ShowFrameRate)
            {
                spriteBatch.DrawString(font, frameRateCounter.UpdatesPerSecond, new Vector2(10f, 10f), Color.Red);
                spriteBatch.DrawString(font, frameRateCounter.FramesPerSecond, new Vector2(10f, 30f), Color.Red);
            }

            spriteBatch.End();
        }
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            scoreboardRenderer.Render();
            if (isPaused)
            {
                buttonRenderer.Render();
            }

            var device = SharedGraphicsDeviceManager.Current.GraphicsDevice;

            device.DepthStencilState = DepthStencilState.Default;
            device.RasterizerState   = RasterizerState.CullCounterClockwise;
            device.BlendState        = BlendState.AlphaBlend;
            device.Clear(Color.CornflowerBlue);
            gamePlay.Draw();
            input.Draw();

            spriteBatch.Begin();
            spriteBatch.Draw(scoreboardRenderer.Texture, scoreboardPosition, Color.White);
            if (isPaused)
            {
                spriteBatch.Draw(buttonRenderer.Texture, buttonPosition, Color.White);
            }
            spriteBatch.End();
        }
Example #4
0
        private void timer_Draw(object sender, GameTimerEventArgs e)
        {
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();
            spriteBatch.Draw(background, Vector2.Zero, Color.White);
            spriteBatch.End();

            // Set render states.
            SharedGraphicsDeviceManager.Current.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            SharedGraphicsDeviceManager.Current.GraphicsDevice.BlendState        = BlendState.Opaque;
            SharedGraphicsDeviceManager.Current.GraphicsDevice.RasterizerState   = RasterizerState.CullNone;
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SamplerStates[0]  = SamplerState.LinearWrap;

            // Draw the model
            model.Draw();

            // Update the Silverlight UI
            uiRenderer.Render();

            // Draw the sprite
            spriteBatch.Begin();
            spriteBatch.Draw(uiRenderer.Texture, Vector2.Zero, Color.White);
            spriteBatch.End();
        }
Example #5
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);
            //draws the bases

            _uiRender.Render();
            spriteBatch.Begin();

            _line.Draw(spriteBatch);
            _missileManager.Draw(spriteBatch, SharedGraphicsDeviceManager.Current.GraphicsDevice);


            for (int i = 0; i < _buildings.Length; i++)
            {
                if (_buildings[i] != null)
                {
                    _buildings[i].Draw(spriteBatch);
                }
            }

            _leftBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, spriteBatch);
            _middleBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, spriteBatch);
            _rightBaseCoolDown.Draw(_leftBase.GetRectangle.Width + 40, spriteBatch);
            //draws the 3 bases
            _leftBase.Draw(spriteBatch);
            _rightBase.Draw(spriteBatch);
            _middleBase.Draw(spriteBatch);
            //draws overlay
            spriteBatch.Draw(_uiRender.Texture, Vector2.Zero, Color.White);
            spriteBatch.End();
            // TODO: Add your drawing code here
        }
Example #6
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            // Render the Silverlight controls using the UIElementRenderer
            elementRenderer.Render();

            if (engine.VideoBackground == null)
            {
                engine.VideoBackground = elementRenderer.Texture;
            }

            engine.Draw(e.ElapsedTime);
        }
Example #7
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            uiRenderer.Render();
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();
            hinhnen.Draw(spriteBatch);
            Update_mt.Draw(spriteBatch);

            spriteBatch.Draw(uiRenderer.Texture, Vector2.Zero, Color.White);
            spriteBatch.End();
            // TODO: Add your drawing code here
        }
Example #8
0
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
            //draws the bases

            _uiRender.Render();
            spriteBatch.Begin();
            _missileManager.Draw(spriteBatch, SharedGraphicsDeviceManager.Current.GraphicsDevice);
            _line.Draw(spriteBatch);
            spriteBatch.Draw(_uiRender.Texture, Vector2.Zero, Microsoft.Xna.Framework.Color.White);
            spriteBatch.End();
            // TODO: Add your drawing code here
        }
Example #9
0
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            // Render the Silverlight controls using the UIElementRenderer.
            elementRenderer.Render();

            scene.Draw();

            spriteBatch.Begin();

            // Using the texture from the UIElementRenderer,
            // draw the Silverlight controls to the screen.
            spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);

            spriteBatch.End();
        }
Example #10
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            //Renders your Silverlight content
            uiRenderer.Render();
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);

            //Draw your ui renderer onto a texture feed texture
            spriteBatch.Begin();
            spriteBatch.Draw(uiRenderer.Texture, Vector2.Zero, Microsoft.Xna.Framework.Color.White);
            spriteBatch.End();

            //Draw game
            try
            {
                GameState.getInstance().Draw();

                bool doesAPawnNeedPromotion = false;

                string color         = GameStateManager.getInstance().getCurrentPlayer().ToString().ToLower();
                bool   white_and_end = color == "white" && GameState.getInstance().getSelectedPiece() != null && GameState.getInstance().getSelectedPiece().getMasqueradeType() == "pawn" && GameState.getInstance().getSelectedPiece().getPosition().X == 7;
                bool   black_and_end = color == "black" && GameState.getInstance().getSelectedPiece() != null && GameState.getInstance().getSelectedPiece().getMasqueradeType() == "pawn" && GameState.getInstance().getSelectedPiece().getPosition().X == 0;

                doesAPawnNeedPromotion = (white_and_end || black_and_end);

                //check to see if pawn promotion is needed
                if (doesAPawnNeedPromotion && !alreadyCalledPromote)
                {
                    TeardownPage();
                    showPopup("Pawn Promote");
                    alreadyCalledPromote = true;
                }
            }
            catch (Exception ex)
            {
                handleError(ex.Message);
            }

            //we have made our move, now wait for the opponent to make theirs
            if (GameStateManager.getInstance().getShouldWait() && setupFinished && !alreadyCalledWait)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    waitForOpponent();
                });
                alreadyCalledWait = true;
            }
        }
Example #11
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            // Render the Silverlight controls using the UIElementRenderer
            elementRenderer.Render();

            // Clear the screen to a solid color
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);

            // Draw the teapot
            DrawTeapot(e);

            spriteBatch.Begin();
            // Using the texture from the UIElementRenderer,
            // draw the Silverlight controls to the screen
            spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);
            spriteBatch.End();
        }
Example #12
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);

            // Render the Silverlight controls using the UIElementRenderer
            elementRenderer.Render();

            // Draw the sprite
            spriteBatch.Begin();

            // Draw the rectangle in its new position
            spriteBatch.Draw(texture, spritePosition, Color.White);

            // Using the texture from the UIElementRenderer,
            // draw the Silverlight controls to the screen
            spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);

            spriteBatch.End();
        }
Example #13
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);

            // Render the Silverlight controls using the UIElementRenderer.
            elementRenderer.Render();

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            //Draw the gameboard
            gameBoard.Draw(spriteBatch);

            // Using the texture from the UIElementRenderer,
            // draw the Silverlight controls to the screen.
            spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);

            spriteBatch.End();
        }
Example #14
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            // Draw the Silverlight UI into the texture
            uiRenderer.Render();

            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.CornflowerBlue);

            spriteBatch.Begin();

            // Draw the center line of the game
            spriteBatch.Draw(blank, new Rectangle(398, 0, 4, 480), Color.White * .8f);

            // Draw our three game objects
            playerPaddle.Draw(spriteBatch);
            computerPaddle.Draw(spriteBatch);
            ball.Draw(spriteBatch);

            // Draw the UI on top of the scene
            spriteBatch.Draw(uiRenderer.Texture, Vector2.Zero, Color.White);
            spriteBatch.End();
        }
Example #15
0
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            if (isActive)
            {
                // Draw the Silverlight UI into the texture
                //if (elementRenderer != null)
                //    elementRenderer.Render();
                try
                {
                    if (elementRenderer != null)
                    {
                        // Draw the Silverlight UI into the texture
                        elementRenderer.Render();
                    }
                }
                catch (ObjectDisposedException)
                {
                    CreateUiElementRenderer();
                }


                //SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);
                SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);

                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);

                particleSystem.Draw(spriteBatch, 1, Vector2.Zero);

                spriteBatch.End();

                spriteBatch.Begin();

                // Using the texture from the UIElementRenderer,
                // draw the Silverlight controls to the screen.
                spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Microsoft.Xna.Framework.Color.White);

                spriteBatch.End();
            }
        }
Example #16
0
        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            try
            {
                if (elementRenderer != null)
                {
                    // Draw the Silverlight UI into the texture
                    elementRenderer.Render();
                }
            }
            catch (ObjectDisposedException)
            {
                CreateUiElementRenderer();
            }


            //SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);

            // TODO: Add your drawing code here
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);

            particleSystem.Draw(spriteBatch, 1, Vector2.Zero);

            spriteBatch.End();

            spriteBatch.Begin();

            if (isGameOver == false)
            {
                foreach (var laserBullet in bullets)
                {
                    laserBullet.Draw(spriteBatch);
                }

                foreach (var item in enemies)
                {
                    item.Draw(spriteBatch);
                }

                player.Draw(spriteBatch);

                // Using the texture from the UIElementRenderer,
                // draw the Silverlight controls to the screen.
                spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);

                Vector2 scorePosition = new Vector2(600, playerYposition + 20);
                spriteBatch.DrawString(font, score.ToString(), scorePosition, Color.Gray);
                scorePosition.Y += 2;
                spriteBatch.DrawString(font, score.ToString(), scorePosition, Color.Red);
            }
            else
            {
                Vector2 scorePosition = new Vector2(centerX - font.MeasureString(score.ToString()).X / 2, 260);
                spriteBatch.DrawString(font, score.ToString(), scorePosition, Color.Red);
                scorePosition.Y += 2;
                scorePosition.X += 1;
                spriteBatch.DrawString(font, score.ToString(), scorePosition, Color.WhiteSmoke);

                endGameScore.Draw(spriteBatch);
            }

            spriteBatch.End();
        }
        public override void prerender()
        {
            if (str.Length == 0)
            {
                return;
            }
            if (currentFont == null)
            {
                currentFont = new XNAFont();
            }
            int off = uirCache.IndexOf(this);
            if (off > -1)
            {
                uir = uirCache[off].uir;
                uirCache.RemoveAt(off);
                uirCache.Insert(0, this);
                return;
            }
            SilverlightImplementation.textBlockInstance.Text = str;
            SilverlightImplementation.textBlockInstance.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(col.A, col.R, col.G, col.B));
            currentFont.applyFont(SilverlightImplementation.textBlockInstance);
            SilverlightImplementation.textBlockInstance.Measure(new Size(10000, 10000));
            int dw = (int)SilverlightImplementation.textBlockInstance.DesiredSize.Width;
            int dh = (int)SilverlightImplementation.textBlockInstance.DesiredSize.Height;

            uir = new UIElementRenderer(SilverlightImplementation.textBlockInstance, dw, dh);
            uir.Render();
            uirCache.Insert(0, this);
            if (uirCache.Count > 50)
            {
                uirCache[50].uir.Dispose();
                uirCache.RemoveAt(50);
            }
        }
Example #18
0
 // This can be overriden for custom drawing.
 public virtual void RenderSubElement(UIRenderContext rctx, ref UIElementLayout myLayout, outki.UIElement element, UIElementRenderer renderer, ref UIElementLayout layout)
 {
     renderer.Render(rctx, ref layout);
 }
Example #19
0
        /// <summary>
        /// 允許頁面繪製自身。
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            if (PAPbgWhite)
            {
                SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.White);
            }
            else
            {
                SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);
            }
            if (LOCAL == "遊戲")
            {
                //閃電特效
                if (Thunder)
                {
                    SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.White);
                    Thunder = false;
                }
                else
                {
                    SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);
                }

                spriteBatch.Begin();
                R_BG.Draw(spriteBatch);         //背景
                R_MonsterThg.Draw(spriteBatch); //寶物
                R_LV.Draw(spriteBatch);
                R_MFired.Draw(spriteBatch);     //怪物攻擊球
                R_HERO.Draw(spriteBatch);
                R_BAR.Draw(spriteBatch);

                spriteBatch.End();
            }
            else if (LOCAL == "選單")
            {
                elementRenderer.Render();
                spriteBatch.Begin();
                spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);
                spriteBatch.End();
            }
            else if (LOCAL == "遊戲暫停")
            {
                elementRenderer.Render();
                spriteBatch.Begin();
                spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);
                spriteBatch.End();
            }
            else if (LOCAL == "死亡")
            {
                SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);
                spriteBatch.Begin();
                R_MENU_DEAD.Draw(spriteBatch);
                spriteBatch.End();
            }
            else if (LOCAL == "破關")
            {
                SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);
                spriteBatch.Begin();
                R_GAME_END.Draw(spriteBatch);
                spriteBatch.End();
            }
            else if (LOCAL == "新遊戲")
            {
                elementRenderer.Render();
                spriteBatch.Begin();
                spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Color.White);
                spriteBatch.End();
            }

            // TODO: 在此處加入繪圖程式碼
        }
Example #20
0
        /// <summary>
        /// Consente alla pagina di disegnarsi.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            if (match.gameState == GamePageState.LOST || match.gameState == GamePageState.HAVETOEXIT)
            {
                silverlightRenderer.Render();
                SharedGraphicsDeviceManager.Current.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
                SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);
                spriteBatch.Begin();
                spriteBatch.Draw(silverlightRenderer.Texture, new Rectangle(0, 0, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height), Color.White);
                spriteBatch.End();
            }
            else
            {
                silverlightRenderer.Render();
                SharedGraphicsDeviceManager.Current.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
                SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);

                /*
                 * if (debug)
                 *  DebugShapeRenderer.Draw(new GameTime(e.TotalTime, e.ElapsedTime), Matrix.CreateLookAt(new Vector3(cameraPos.X + cameraShake.X, cameraPos.Y + cameraShake.Y, cameraPos.Z), cameraLook, Vector3.Up), Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f) + speedCurve.Evaluate(speedTime) / 1.5f, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.AspectRatio, 0.1f, 80.0f));
                 */

                //Draw modelli 3D
                foreach (Section section in match.sections)
                {
                    foreach (ScenicElement scenic in section.ScenicElements)
                    {
                        DrawModel(section, models[scenic.model], scenic.Position, scenic.Rotation, Vector3.One);
                    }

                    foreach (Enemy enemy in section.Enemies)
                    {
                        if (enemy.IsAlive)
                        {
                            DrawModel(section, models[enemy.Model], enemy.Position, Vector3.Zero, Vector3.One);
                            DrawModel(section, models[4], new Vector3(enemy.Position.X, 0.1f, enemy.Position.Z), Vector3.Zero, new Vector3((float)(1 - enemy.Position.Y / 5), 1, (float)(1 - enemy.Position.Y / 5)));
                        }
                    }

                    foreach (PowerUp power in section.PowerUps)
                    {
                        if (power.isAvailable)
                        {
                            DrawModel(section, models[power.Model], power.Position, power.Rotation, Vector3.One);
                            DrawModel(section, models[4], new Vector3(power.Position.X, 0, power.Position.Z), Vector3.Zero, new Vector3((float)(1 - power.Position.Y / 5), 1, (float)(1 - power.Position.Y / 5)));
                        }
                    }
                }

                //Draw flash per boost
                if (match.flashCounter > 0)
                {
                    spriteBatch.Begin(SpriteSortMode.Immediate, brightnessBlend);
                    spriteBatch.Draw(whiteTexture, new Rectangle(0, 0, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height), new Color(brightness, brightness, brightness, 255));
                    spriteBatch.End();

                    spriteBatch.Begin(SpriteSortMode.Immediate, contrastBlend);
                    int temp = (int)boostFlashCurve.Evaluate(match.flashCounter);
                    spriteBatch.Draw(whiteTexture, new Rectangle(0, 0, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height), new Color(temp, temp, temp, 255));
                    spriteBatch.End();
                    SharedGraphicsDeviceManager.Current.GraphicsDevice.BlendState = BlendState.Opaque;
                }

                //Draw GUI 2D
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
                int counter;
                for (counter = 0; counter < maxLife && match.lifepositions[counter] != heart.Height; counter++)
                {
                    Vector2 position = new Vector2(SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width / 2 - barra.Width / 2 + 10 + (counter * 35), SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height - heart.Height + match.lifepositions[counter]);
                    if (match.life <= 3)
                    {
                        position.X += UtilityClass.nextInt(-3, 3);
                        position.Y += UtilityClass.nextInt(-3, 3);
                    }
                    spriteBatch.Draw(heart, position, Color.White);
                }

                string  tempo       = match.matchTime.Hours + ":" + match.matchTime.Minutes + ":" + match.matchTime.Seconds + ":" + match.matchTime.Milliseconds;
                Vector2 timeBackPos = new Vector2(SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width / 2 + barraBack.Width / 2 - timeBack.Width - 10, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height - timeBack.Height);
                spriteBatch.Draw(timeBack, timeBackPos, Color.White);

                spriteBatch.DrawString(font, tempo, new Vector2((timeBackPos.X + timeBack.Width) - (timeBack.Width / 2) - (font.MeasureString(tempo).X / 2), timeBackPos.Y), Color.Black);
                spriteBatch.Draw(barraBack, new Rectangle(SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width / 2 - barraBack.Width / 2, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height - barraBack.Height, barraBack.Width, barraBack.Height), Color.White);
                spriteBatch.Draw(barra, new Rectangle(SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width / 2 - barra.Width / 2, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height - barra.Height, (int)(speedCurve.Evaluate(match.speedTime) * barra.Width / Constants.MAX_SPEED), barra.Height), new Rectangle(0, 0, (int)(speedCurve.Evaluate(match.speedTime) * barra.Width / Constants.MAX_SPEED), barra.Height), Color.White);

                if (match.gameState == GamePageState.LOSING)
                {
                    spriteBatch.Draw(blackTexture, new Rectangle(0, 0, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width, SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height), Color.White * match.fadeIndex);
                }

                spriteBatch.Draw(silverlightRenderer.Texture, Vector2.Zero, Color.White);
                spriteBatch.End();
                AdComponent.Current.Draw();
            }
        }