Beispiel #1
0
        /// <summary>
        /// Loads all components needed for the settings view.
        /// </summary>
        private void LoadSettings()
        {
            // Load textures
            Texture2D yellowButton = game.Content.Load<Texture2D>("Buttons\\YellowButton");
            Texture2D blueButton = game.Content.Load<Texture2D>("Buttons\\BlueButton");
            Texture2D redButton = game.Content.Load<Texture2D>("Buttons\\RedButton");

            // Load fonts
            SpriteFont menuFontBig = game.Content.Load<SpriteFont>("Fonts\\Pericles36");
            SpriteFont menuFontSmall = game.Content.Load<SpriteFont>("Fonts\\Pericles28");

            // Create sound label
            sound = new Label(game, spriteBatch, new Rectangle(103, 275, 275, 70), menuFontSmall, "Play with sound?");

            // Create buttons
            soundYes = new Button(game, spriteBatch, new Rectangle(103, 375, 122, 70), yellowButton, menuFontBig, "Yes");
            soundNo = new Button(game, spriteBatch, new Rectangle(255, 375, 122, 70), blueButton, menuFontBig, "No");
            reset = new Button(game, spriteBatch, new Rectangle(103, 575, 275, 70), redButton, menuFontSmall, "Reset Levels");
        }
Beispiel #2
0
        /// <summary>
        /// Creates the particle controller, loads textures needed, loads font and text needed as well.
        /// </summary>
        public override void Initialize()
        {
            // Create particle controller and load particle texture
            pc = new ParticleController(game, spriteBatch);
            particleTexture = game.Content.Load<Texture2D>("Particles\\Line");

            // Create congrats string
            string message = "Congragulations!#You have beaten#all the levels in#Block3r";
            message = message.Replace("#", System.Environment.NewLine);

            // Create congrats label
            SpriteFont font = game.Content.Load<SpriteFont>("Fonts\\Pericles28");
            congragulations = new Label(game, spriteBatch, new Rectangle(0, 0, 480, 800), font, message);

            base.Initialize();
        }
Beispiel #3
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  Initialized all textures needed, all fonts needed, all labels needed, 
        /// and all buttons needed.
        /// </summary>
        public override void Initialize()
        {
            // Load button textures
            Texture2D greenButton = game.Content.Load<Texture2D>("Buttons\\GreenButton");
            Texture2D redButton = game.Content.Load<Texture2D>("Buttons\\RedButton");

            // Load matter textures
            redMatterTexture = game.Content.Load<Texture2D>("Tiles\\Matter\\RedMatter\\RedMatter1");
            blueMatterTexture = game.Content.Load<Texture2D>("Tiles\\Matter\\BlueMatter\\BlueMatter1");

            // Load fonts for labels
            SpriteFont hudFont = game.Content.Load<SpriteFont>("Fonts\\Pericles28");
            SpriteFont hudFont2 = game.Content.Load<SpriteFont>("Fonts\\Pericles24");
            SpriteFont hudFont3 = game.Content.Load<SpriteFont>("Fonts\\Pericles18");

            // Create reset button
            resetButton = new Button(game, spriteBatch, new Rectangle(250, 10, 105, 60), greenButton, hudFont2, "Reset");

            // Create exit button
            exitButton = new Button(game, spriteBatch, new Rectangle(365, 10, 105, 60), redButton, hudFont, "Exit");

            // Create fuel label
            fuelLabel = new Label(game, spriteBatch, new Rectangle(10, 10, 115, 25), hudFont3, "Fuel: " + Convert.ToString(Fuel));
            fuelLabel.TextPosition = Label.LabelPosition.Left;

            // Create level label
            levelLabel = new Label(game, spriteBatch, new Rectangle(125, 10, 115, 25), hudFont3, "Level: " + Convert.ToString(Level));
            levelLabel.TextPosition = Label.LabelPosition.Left;

            // Create matter labels
            blueMatterLabel = new Label(game, spriteBatch, new Rectangle(25, 45, 40, 25), hudFont3, "0");
            redMatterLabel = new Label(game, spriteBatch, new Rectangle(98, 45, 40, 25), hudFont3, "0");

            base.Initialize();
        }