Exemplo n.º 1
0
        // Methods
        public static void Render()
        {
            // Render the debug screen
            // ================
            if (Settings.m_debug)
            {
                GraphicsHandler.StartDrawing();

                // Render debug sprites (collision boxes, etc.)
                foreach (Sprite s in m_sprites)
                {
                    GraphicsHandler.DrawSprite(s);
                }

                // Render debug text
                foreach (DebugText dt in m_text)
                {
                    GraphicsHandler.DrawText(dt);
                }

                GraphicsHandler.DrawText("Debug Screen", new Vector2(10.0f, 10.0f), Color.Red);
                GraphicsHandler.DrawText("Debug Screen", new Vector2(11.0f, 10.0f), Color.Red);

                GraphicsHandler.StopDrawing();
            }

            m_sprites.Clear();
            m_text.Clear();
        }
Exemplo n.º 2
0
        public override void Draw(GraphicsDevice graphicsDevice_)
        {
            // Render objects to the screen
            // ================

            // Clear the screen
            graphicsDevice_.Clear(Color.LawnGreen);

            // Render graphics
            GraphicsHandler.StartDrawing();

            // Draw sprites
            GraphicsHandler.DrawSprite(m_background);
            GraphicsHandler.DrawSprite(m_teamLogo);
            //GraphicsHandler.DrawSprite(m_gameLogo);

            // Draw buttons
            switch (m_currentScreen)
            {
            case MenuScreenState.MAIN_MENU:
                GraphicsHandler.DrawSprite(m_playButton.m_sprite);
                GraphicsHandler.DrawSprite(m_exitButton.m_sprite);
                GraphicsHandler.DrawSprite(m_creditsButton.m_sprite);
                GraphicsHandler.DrawSprite(m_controlsButton.m_sprite);
                break;

            case MenuScreenState.PLAYER_SELECT:
                GraphicsHandler.DrawText("Player Selection", new Vector2(Settings.m_screenWidth * 0.50f, Settings.m_screenHeight * 0.50f), Color.Black);
                GraphicsHandler.DrawText("Number of Players: " + Settings.m_numberOfPlayers.ToString(), new Vector2(Settings.m_screenWidth * 0.475f, Settings.m_screenHeight * 0.5625f), Color.Black);

                // Loop each player and render the relevant information
                foreach (PlayerSelectStruct pss in players)
                {
                    if (pss.m_playerState == PlayerState.NONE || pss.m_playerState == PlayerState.VEHICLE_SELECTED || pss.m_playerState == PlayerState.READY)
                    {
                        GraphicsHandler.DrawSprite(pss.m_actionButton.m_sprite);
                    }
                    if (pss.m_playerState == PlayerState.JOINED)
                    {
                        GraphicsHandler.DrawSprite(pss.m_choice1Button.m_sprite);
                        GraphicsHandler.DrawSprite(pss.m_choice2Button.m_sprite);
                        GraphicsHandler.DrawSprite(pss.m_choice3Button.m_sprite);
                        GraphicsHandler.DrawSprite(pss.m_choice4Button.m_sprite);
                    }
                    else if (pss.m_playerState == PlayerState.VEHICLE_SELECTED || pss.m_playerState == PlayerState.READY)
                    {
                        GraphicsHandler.DrawSprite(pss.m_vehicleChoice);
                    }
                }

                // TODO: Render "back" and "go" buttons
                GraphicsHandler.DrawSprite(m_playerBackButton.m_sprite);
                GraphicsHandler.DrawSprite(m_playerGoButton.m_sprite);



                break;

            case MenuScreenState.OPTIONS:
                // Insert buttons for options
                GraphicsHandler.DrawText("Options", new Vector2(Settings.m_screenWidth / 2, Settings.m_screenHeight / 2), Color.Black);
                GraphicsHandler.DrawSprite(m_MenuButton.m_sprite);
                break;

            case MenuScreenState.CONTROLS:
                // Insert control scheme layout
                GraphicsHandler.DrawText("Controls", new Vector2(Settings.m_screenWidth / 2, Settings.m_screenHeight / 2), Color.Black);
                GraphicsHandler.DrawSprite(m_control_scheme);
                GraphicsHandler.DrawSprite(m_MenuButton.m_sprite);
                break;

            case MenuScreenState.CREDITS:
                // Insert text for credits
                GraphicsHandler.DrawText("Team Leader: Dean Sinclair", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f), Color.Black);
                GraphicsHandler.DrawText("Producer: Dwyer McNally", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 25), Color.Black);
                GraphicsHandler.DrawText("Programmers:", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 50), Color.Black);
                GraphicsHandler.DrawText("            Daniel Divers", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 70), Color.Black);
                GraphicsHandler.DrawText("            Cameron Fleming:", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 90), Color.Black);
                GraphicsHandler.DrawText("            Nathan Headley", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 110), Color.Black);
                GraphicsHandler.DrawText("            Dean Sinclair", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 130), Color.Black);
                GraphicsHandler.DrawText("            Cemre Tekpinar", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 150), Color.Black);
                GraphicsHandler.DrawText("Game Design: Dwyer McNally", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 175), Color.Black);
                GraphicsHandler.DrawText("Art: Gillian Annandale", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 200), Color.Black);
                GraphicsHandler.DrawText("Audio: Russell Ferguson", new Vector2(Settings.m_screenWidth / 2 - 100, Settings.m_screenHeight * 0.4f + 225), Color.Black);
                GraphicsHandler.DrawSprite(m_MenuButton.m_sprite);
                break;
            }


            // Draw animated sprites
            foreach (AnimatedSprite anim_ in m_animatedSprites)
            {
                if (anim_.IsVisible())
                {
                    GraphicsHandler.DrawAnimatedSprite(anim_);
                }
            }

            // Draw particles
            foreach (Particle part_ in m_particles)
            {
                if (part_.GetLife() > 0)
                {
                    //GraphicsHandler.DrawParticle(/*texture,*/ part_.GetPosition(), Color.White);
                }
            }

            // Stop rendering
            GraphicsHandler.StopDrawing();
        }
Exemplo n.º 3
0
        public override void Draw(GraphicsDevice graphicsDevice_)
        {
            // Render objects to the screen
            // ================

            // Clear the screen
            graphicsDevice_.Clear(Color.Beige);

            // Start rendering graphics
            GraphicsHandler.StartDrawing();

            // Render background
            GraphicsHandler.DrawSprite(m_grassbackground);
            GraphicsHandler.DrawSprite(m_background);

            // Render animated sprites
            foreach (AnimatedSprite anim_ in m_animatedSprites)
            {
                if (anim_.IsVisible())
                {
                    GraphicsHandler.DrawAnimatedSprite(anim_);
                }
            }

            // Render particles             TEMP
            foreach (Particle part_ in m_particles)
            {
                if (part_.GetLife() > 0)
                {
                    GraphicsHandler.DrawParticle(part_.GetPosition(), part_.GetColour(), part_.GetLife());
                }
            }

            h_trackHandler.Draw();

            // Render player vehicles
            foreach (Player p in m_players)
            {
                GraphicsHandler.DrawSprite(p.GetVehicle().m_vehicleBody.GetSprite());
                //GraphicsHandler.DrawSprite(p.GetCow());
                GraphicsHandler.DrawSprite(p.m_controlScheme.m_controlInterfaceSprite);
                GraphicsHandler.DrawSprite(p.m_controlScheme.m_steeringIndicatorSprite);

                if (!PlayersReady)
                {
                    GraphicsHandler.DrawSprite(p.m_ReadyButton.m_sprite);
                }
            }

            for (int i = 0; i < Settings.m_numberOfPlayers; i++)
            {
                //GraphicsHandler.DrawSprite(m_rankingSprites[i]);
            }

            // RENDER UI

            // Render ranking text
            if (m_rankings.Count != 0)
            {
                GraphicsHandler.DrawText("1st - Player " + m_rankings[0].ToString(), new Vector2(Settings.m_screenWidth / 2 - 450, Settings.m_screenHeight / 2 - 80), Color.Red, 0);

                if (m_rankings.Count > 1)
                {
                    GraphicsHandler.DrawText("2nd - Player " + m_rankings[1].ToString(), new Vector2(Settings.m_screenWidth / 2 - 350, Settings.m_screenHeight / 2 - 80), Color.Red, 0);
                    if (m_rankings.Count > 2)
                    {
                        GraphicsHandler.DrawText("3rd - Player " + m_rankings[2].ToString(), new Vector2(Settings.m_screenWidth / 2 - 250, Settings.m_screenHeight / 2 - 80), Color.Red, 0);
                        if (m_rankings.Count > 3)
                        {
                            GraphicsHandler.DrawText("4th - Player " + m_rankings[3].ToString(), new Vector2(Settings.m_screenWidth / 2 - 150, Settings.m_screenHeight / 2 - 80), Color.Red, 0);
                        }
                    }
                }
            }

            for (int i = 0; i < m_rankingSprites.Count; i++)
            {
                GraphicsHandler.DrawSprite(m_rankingSprites[i]);
            }



            /*if (m_rankings.Count != 0) {
             *  GraphicsHandler.DrawText(new DebugText("1st - Player " + m_players[0].GetRaceTime(), new Vector2(1000f, 440f)));
             *  if (m_rankings.Count > 1) {
             *      GraphicsHandler.DrawText(new DebugText("2nd - Player " + m_players[1].GetRaceTime(), new Vector2(1000f, 460f)));
             *      if (m_rankings.Count > 2) {
             *          GraphicsHandler.DrawText(new DebugText("3rd - Player " + m_players[2].GetRaceTime(), new Vector2(1000f, 480f)));
             *          if (m_rankings.Count > 3) {
             *              GraphicsHandler.DrawText(new DebugText("4th - Player " + m_players[3].GetRaceTime(), new Vector2(1000f, 500f)));
             *          }
             *      }
             *  }
             * }*/

            foreach (Player p in m_players)
            {
                Debug.AddSprite(p.GetVehicle().m_vehicleBody.GetSprite());
                foreach (Tyre t in p.GetVehicle().m_vehicleTyres)
                {
                    Debug.AddSprite(t.GetSprite());
                }
            }

            foreach (Player p in m_players)
            {
                Debug.AddSprite(p.GetVehicle().m_vehicleTyres[0].GetSprite());
                Debug.AddSprite(p.GetVehicle().m_vehicleTyres[1].GetSprite());
                Debug.AddSprite(p.GetVehicle().m_vehicleTyres[2].GetSprite());
                Debug.AddSprite(p.GetVehicle().m_vehicleTyres[3].GetSprite());
            }
            //GraphicsHandler.DrawSprite(bsv.m_vehicleBody.GetSprite());*/



            if (!startTimer.timerFinished)
            {
                GraphicsHandler.DrawText(((int)(startTimer.timeRemaining / 1000) + 1).ToString(), new Vector2(1000, 50), Color.Red, 3);
            }
            if (finished)
            {
                GraphicsHandler.DrawText("Player " + m_winner.ToString() + " is the winner", new Vector2(500, 500), Color.Red);
            }

            // Stop rendering graphics
            GraphicsHandler.StopDrawing();
        }
Exemplo n.º 4
0
        public override void Draw(GraphicsDevice graphicsDevice_)
        {
            // Render objects to the screen
            // ================

            // Clear the screen
            graphicsDevice_.Clear(Color.LawnGreen);

            // Render graphics
            GraphicsHandler.StartDrawing();

            // Draw all sprites to the screen
            GraphicsHandler.DrawSprite(m_background);
            GraphicsHandler.DrawSprite(m_leaderboard);
            GraphicsHandler.DrawSprite(m_goldTrophy);
            GraphicsHandler.DrawSprite(m_playerFirst);
            GraphicsHandler.DrawText("1st", new Vector2(150, 200), Color.Black);
            if (m_rankings.Count != 0)
            {
                GraphicsHandler.DrawText("Player " + m_rankings[0].ToString(), new Vector2(475, 200), Color.Black);
            }
            int time = m_players[m_rankings[0] - 1].GetRaceTime() / 1000;
            int mins = time / 60;
            int sec  = time - (mins * 60);

            if (sec < 10)
            {
                GraphicsHandler.DrawText(mins + ":" + "0" + sec, new Vector2(825, 200), Color.Black);
            }
            else
            {
                GraphicsHandler.DrawText(mins + ":" + sec, new Vector2(825, 200), Color.Black);
            }
            if (Settings.m_numberOfPlayers > 1)
            {
                time = m_players[m_rankings[1] - 1].GetRaceTime() / 1000;
                mins = time / 60;
                sec  = time - (mins * 60);
                GraphicsHandler.DrawSprite(m_silverTrophy);
                GraphicsHandler.DrawSprite(m_playerSecond);
                GraphicsHandler.DrawText("2nd", new Vector2(150, 275), Color.Black);
                GraphicsHandler.DrawText("Player " + m_rankings[1].ToString(), new Vector2(475, 275), Color.Black);
                if (sec < 10)
                {
                    GraphicsHandler.DrawText(mins + ":" + "0" + sec, new Vector2(825, 275), Color.Black);
                }
                else
                {
                    GraphicsHandler.DrawText(mins + ":" + sec, new Vector2(825, 275), Color.Black);
                }
            }
            if (Settings.m_numberOfPlayers > 2)
            {
                time = m_players[m_rankings[2] - 1].GetRaceTime() / 1000;
                mins = time / 60;
                sec  = time - (mins * 60);
                GraphicsHandler.DrawSprite(m_bronzeTrophy);
                GraphicsHandler.DrawSprite(m_playerThird);
                GraphicsHandler.DrawText("3rd", new Vector2(150, 375), Color.Black);
                GraphicsHandler.DrawText("Player " + m_rankings[2].ToString(), new Vector2(475, 375), Color.Black);
                if (sec < 10)
                {
                    GraphicsHandler.DrawText(mins + ":" + "0" + sec, new Vector2(825, 375), Color.Black);
                }
                else
                {
                    GraphicsHandler.DrawText(mins + ":" + sec, new Vector2(825, 375), Color.Black);
                }
            }
            if (Settings.m_numberOfPlayers > 3)
            {
                time = m_players[m_rankings[3] - 1].GetRaceTime() / 1000;
                mins = time / 60;
                sec  = time - (mins * 60);
                GraphicsHandler.DrawText("4th", new Vector2(150, 450), Color.Black);
                GraphicsHandler.DrawText("Player " + m_rankings[3].ToString(), new Vector2(475, 450), Color.Black);
                if (sec < 10)
                {
                    GraphicsHandler.DrawText(mins + ":" + "0" + sec, new Vector2(825, 450), Color.Black);
                }
                else
                {
                    GraphicsHandler.DrawText(mins + ":" + sec, new Vector2(825, 450), Color.Black);
                }
            }
            GraphicsHandler.DrawSprite(m_Race_Again_Button.m_sprite);
            GraphicsHandler.DrawSprite(m_Main_Menu_Button.m_sprite);

            foreach (AnimatedSprite anim_ in m_animatedSprites)
            {
                if (anim_.IsVisible())
                {
                    GraphicsHandler.DrawAnimatedSprite(anim_);
                }
            }
            foreach (Particle part_ in m_particles)
            {
                if (part_.GetLife() > 0)
                {
                    //graphicsHandler_.DrawParticle(/*texture,*/ part_.GetPosition(), Color.White);
                }
            }
            GraphicsHandler.DrawText("POSITION", new Vector2(125.0f, 75.0f), Color.Black);
            GraphicsHandler.DrawText("PLAYER", new Vector2(450.0f, 75.0f), Color.Black);
            GraphicsHandler.DrawText("TIME", new Vector2(800.0f, 75.0f), Color.Black);

            GraphicsHandler.StopDrawing();
        }