Ejemplo n.º 1
0
        public ScoreWindow(WindowHandler windowHandler)
        {
            _inputHelper = new KeyboardInputHelper();
            _windowHandler = windowHandler;
            _spriteBatch = new SpriteBatch(_windowHandler.Game.GraphicsDevice);
            _titleFont = Game1.contentManager.Load<SpriteFont>(@"ScoreHeading");
            _entryFont = Game1.contentManager.Load<SpriteFont>(@"ScoreEntries");
            _titleString = "Snabbaste tiderna";
            _background = new Sprite(Game1.contentManager.Load<Texture2D>(@"images\highscorebackground"));
            Vector2 scale;
            scale.X = _windowHandler.Game.GraphicsDevice.Viewport.Width / _background.OriginalSize.X;
            scale.Y = _windowHandler.Game.GraphicsDevice.Viewport.Height / _background.OriginalSize.Y;
            _background.Scale = scale;

            Vector2 stringDimensions = _titleFont.MeasureString(_titleString);
            _titlePosition = new Vector2((_windowHandler.Game.GraphicsDevice.Viewport.Width - stringDimensions.X) / 2,
                                _windowHandler.Game.GraphicsDevice.Viewport.Height / 7);

            _entryPositions = new Vector2(_windowHandler.Game.GraphicsDevice.Viewport.Width / 4,
                                        (_windowHandler.Game.GraphicsDevice.Viewport.Height * 2) / 7);
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            _inputHelper = new KeyboardInputHelper();
            this.GraphicsDevice = _windowHandler.Game.GraphicsDevice;
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            Camera2D = new Camera2D(GraphicsDevice);
            World = new World(Vector2.Zero);

            InitDebug();

            _background = new Sprite(Game1.contentManager.Load<Texture2D>(@"Images\Gradient"));
            _background.CenterOrigin();
            _backgroundSprites.Add(_background);

            _background2 = new Background(@"Images\Gradient", this);

            //TestInit();
            //LoadLevel(@"levels\smalltest");
            //
            //Camera2D.Position = _player.Position;
            //Camera2D.Jump2Target();
            //Camera2D.EnableTracking = true;
            //Camera2D.TrackingBody = _player.Body;
            //Camera2D.Zoom = 0.75f;

            _endTimer.Reset();
        }