예제 #1
0
 public void TrackSelectorScreenEvent(object obj, EventArgs e)
 {
     if (((TrackSelectorScreen)currentScreen).selectedIcon == 0)
         currentScreen = new TrackScreen(track1Back, new Vector2(250, 380), Content, new EventHandler(TrackScreenEvent));
     else if (((TrackSelectorScreen)currentScreen).selectedIcon == 1)
         currentScreen = new TrackScreen(track2Back, new Vector2(350, 110), Content, new EventHandler(TrackScreenEvent));
     else if (((TrackSelectorScreen)currentScreen).selectedIcon == 2)
         currentScreen = new TrackScreen(track3Back, new Vector2(480, 350), Content, new EventHandler(TrackScreenEvent));
 }
예제 #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                currentScreen = trackSelectorScreen;

            currentScreen.Update(gameTime);

            base.Update(gameTime);
        }
예제 #3
0
 public void TrackScreenEvent(object obj, EventArgs e)
 {
     currentScreen = trackSelectorScreen;
 }
예제 #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            trackSelectorScreen = new TrackSelectorScreen(Content, new EventHandler(TrackSelectorScreenEvent));
            track1Back = new Background(Content.Load<Texture2D>("Tracks//track1"));
            track2Back = new Background(Content.Load<Texture2D>("Tracks//track2"));
            track3Back = new Background(Content.Load<Texture2D>("Tracks//track3"));

            currentScreen = trackSelectorScreen;
        }