Example #1
0
        public override void LoadContent()
        {
            ContentManager content = ScreenSystem.Content;

            font      = content.Load <SpriteFont>(@"Fonts/menu");
            smallfont = content.Load <SpriteFont>(@"Fonts/menusmall");

            inactiveButtonTexture = content.Load <Texture2D>("Textures\\Menu\\inactivebutton");
            activeButtonTexture   = content.Load <Texture2D>("Textures\\Menu\\activebutton");

            Selected = new Color(214, 232, 223);
            Normal   = new Color(104, 173, 178);

            mouse = new Mouse(content.Load <Texture2D>("Textures\\menu\\mouse"));

            musicBlock = new UIBlock(ScreenSystem.GraphicsDevice, new Rectangle(10, 110, ScreenSystem.Viewport.Width - 10, 100), Color.White);
            soundBlock = new UIBlock(ScreenSystem.GraphicsDevice, new Rectangle(10, 220, ScreenSystem.Viewport.Width - 10, 100), Color.White);


            Vector2 pos = new Vector2((int)(musicBlock.Dimensions.Left + inactiveButtonTexture.Width), (int)(musicBlock.Dimensions.Top + inactiveButtonTexture.Height));
            Button  b   = new Button(inactiveButtonTexture, pos,
                                     new Text(String.Format("Music:{0}%", (int)(Settings.MusicVolume * 100)), font, new Vector2(pos.X - (inactiveButtonTexture.Width / 2) + 10, pos.Y - (inactiveButtonTexture.Height / 2))), Normal, this);

            b.LeftClickEvent += new EventHandler(music_LeftClickEvent);
            musicBlock.Add("MusicButton", b);

            Text minstructions = new Text("Select the Music button to change settings", smallfont, new Vector2(b.Position.X + (b.Texture.Width / 2) + 10, b.ButtonText.Position.Y));

            musicBlock.Add("MusicInstructions", minstructions);

            pos = new Vector2((int)(soundBlock.Dimensions.Left + inactiveButtonTexture.Width), (int)(soundBlock.Dimensions.Top + inactiveButtonTexture.Height));
            b   = new Button(inactiveButtonTexture, pos,
                             new Text(String.Format("Sound:{0}%", (int)(Settings.SoundVolume * 100)), font, new Vector2(pos.X - (inactiveButtonTexture.Width / 2) + 10, pos.Y - (inactiveButtonTexture.Height / 2))), Normal, this);
            b.LeftClickEvent += new EventHandler(sound_LeftClickEvent);
            soundBlock.Add("SoundButton", b);

            minstructions = new Text("Select the Sound button to change settings", smallfont, new Vector2(b.Position.X + (b.Texture.Width / 2) + 10, b.ButtonText.Position.Y));
            soundBlock.Add("SoundInstructions", minstructions);

            backmessage = "Press Escape to go back";
        }