Exemplo n.º 1
0
        /// <summary>
        ///     Loads the content.
        /// </summary>
        public override void OnLoadContent()
        {
            _animatedBackground = new AnimatedBackground(Content.Load <Texture2D>("background.png"));
            _instructions       = new Instructions(Content.Load <Texture2D>("instructions.png"))
            {
                Visible = true
            };
            _player       = new Player(Content.Load <Texture2D>("bird_sprite.png"), Content.Load <Texture2D>("bird_erased.png"));
            _receivedCoin = new SoundEffect(Content.Load <Sound>("score.wav"))
            {
                Volume = 0.2f
            };
            _die = new SoundEffect(Content.Load <Sound>("dead.wav"))
            {
                Volume = 0.2f
            };
            _scoreboard  = new Scoreboard();
            _pipeManager = new PipeManager(Content.Load <Texture2D>("pipe_body.png"),
                                           Content.Load <Texture2D>("pipe_bottom.png"), Content.Load <Texture2D>("pipe_top.png"));
            _swing = new SoundEffect(Content.Load <Sound>("swing.wav"))
            {
                Volume = 0.2f
            };
            _pipeManager.ScoreChanged += _pipeManager_ScoreChanged;
            _font = new Font("Segoe UI", 9, TypefaceStyle.Regular);
            _deviceHintPosition = new Vector2(0, 0);

            int x = Convert.ToInt32(_resolution.Split('x')[0]);
            int y = Convert.ToInt32(_resolution.Split('x')[1]);

            SGL.Components.Get <RenderTarget>().Window.Size          = new Vector2(x, y);
            SGL.Components.Get <GraphicsDevice>().BackBuffer.Scaling = true;
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Loads the content.
        /// </summary>
        public override void OnLoadContent()
        {
            _animatedBackground = new AnimatedBackground(Content.Load<Texture2D>("background.png"));
            _instructions = new Instructions(Content.Load<Texture2D>("instructions.png")) {Visible = true};
            _player = new Player(Content.Load<Texture2D>("bird_sprite.png"), Content.Load<Texture2D>("bird_erased.png"));
            _receivedCoin = new SoundEffect(Content.Load<Sound>("score.wav")) { Volume = 0.2f };
            _die = new SoundEffect(Content.Load<Sound>("dead.wav")) { Volume = 0.2f };
            _scoreboard = new Scoreboard();
            _pipeManager = new PipeManager(Content.Load<Texture2D>("pipe_body.png"),
                Content.Load<Texture2D>("pipe_bottom.png"), Content.Load<Texture2D>("pipe_top.png"));
            _swing = new SoundEffect(Content.Load<Sound>("swing.wav")){Volume = 0.2f};
            _pipeManager.ScoreChanged += _pipeManager_ScoreChanged;
            _font = new Font("Segoe UI", 9, TypefaceStyle.Regular);
            _deviceHintPosition = new Vector2(0, 0);

            int x = Convert.ToInt32(_resolution.Split('x')[0]);
            int y = Convert.ToInt32(_resolution.Split('x')[1]);

            SGL.Components.Get<RenderTarget>().Window.Size = new Vector2(x, y);
            SGL.Components.Get<GraphicsDevice>().BackBuffer.Scaling = true;
        }