public InputHandler(ArmorPotionsGame game) : base(game) { keyboardState = Keyboard.GetState(); mouseState = Mouse.GetState(); gamePadStates = new GamePadState[Enum.GetValues(typeof(PlayerIndex)).Length]; lastGamePadStates = new GamePadState[Enum.GetValues(typeof(PlayerIndex)).Length]; foreach (PlayerIndex index in Enum.GetValues(typeof(PlayerIndex))) gamePadStates[(int)index] = GamePad.GetState(index); }
public Camera(ArmorPotionsGame game, float _setX, float _setY, float _setW, float _setH, float _setScale) : base(game) { this._cameraX = _setX; this._cameraY = _setY; this._cameraW = _setW; this._cameraH = _setH; this._cameraCenter.X = this._cameraX + (this.CameraW / 2); this._cameraCenter.Y = this._cameraY + (this.CameraH / 2); this._scale = _setScale; _viewportRectangle = game.ScreenRectangle; }
public World(ArmorPotionsGame game) { _game = game; _projectiles = new List<Projectile>(); _projectilesToAdd = new List<Projectile>(); _player = new Player(this, _game.Content.Load<Texture2D>(@"Player\PlayerWalking"), _game.Content.Load<Texture2D>(@"Player\SwordAttack")); _player.Position = new Vector2(350, 350); Rectangle clientBounds = _game.Window.ClientBounds; _camera = new Camera(_game, 0, 0, clientBounds.Width, clientBounds.Height, 1f); _game.Components.Add(_camera); MaxTileWidth = clientBounds.Width / Tile.Width; MaxTileHeight = clientBounds.Height / Tile.Height; }