/// <summary> /// Initializes a new instance of the <see cref="GameConsole"/> class. /// </summary> /// <param name="area">The area.</param> /// <param name="graphicsDevice">The graphics device.</param> /// <param name="keyboard">The keyboard.</param> /// <param name="backgroundTexture">The background texture.</param> public GameConsole(Rectangle area, GraphicsDevice graphicsDevice, KeyboardInput keyboard, Texture2D backgroundTexture) { this.graphicsDevice = graphicsDevice; this.spriteBatch = new SpriteBatch(graphicsDevice); this.keyboard = keyboard; this.Area = area; this.Size = byte.MaxValue; this.BackgroundTexture = backgroundTexture; this.BackgroundColor = new Color(0, 0, 0, 0.7f); this.DefaultTextColour = Color.WhiteSmoke; this.WarningTextColour = Color.Yellow; this.ErrorTextColour = Color.Red; this.TextScale = 0.5f; this.TabLength = 4; Logger.Global.LogAddedEvent += LogAdded; Logger.Global.Log("GameConsole activated.", LogLevel.Debug); this.SetupBroker(); }
public Ship(Texture2D shiptexture, Texture2D bullettexture, EntityState es) : base(es) { Body = new Body(this, new Vector2(es.GameRef.Viewport.Width / 2.0f, es.GameRef.Viewport.Height / 2.0f), new Vector2(shiptexture.Width, shiptexture.Height)); Components.Add(Body); Physics = new Physics(this) { Drag = 0.9f }; Components.Add(Physics); Render = new Render(this, shiptexture) { Scale = .5f }; Components.Add(Render); Weapon = new Gun(this, bullettexture); Components.Add(Weapon); Health = new Health(this, 5); Health.DiedEvent += Destroy; Health.DiedEvent += EmitEventHandler; Components.Add(Health); Collision = new Collision(this); Components.Add(Collision); ThrustEmitter = new ThrustEmitter(this, StateRef.GameRef.Game.Content.Load<Texture2D>(@"particles/thrustparticle")); Components.Add(ThrustEmitter); DeathEmitter = new DeathEmitter(this, StateRef.GameRef.Game.Content.Load<Texture2D>(@"particles/shipdeathparticle123")); Components.Add(DeathEmitter); _attackkey = new KeyboardInput(Keys.Enter); _upkey = new KeyboardInput(Keys.W); _downkey = new KeyboardInput(Keys.S); _leftkey = new KeyboardInput(Keys.A); _rightkey = new KeyboardInput(Keys.D); _debugkey = new KeyboardInput(Keys.L); }
public DoubleInput(Keys key, Buttons button, PlayerIndex pi) { Key = new KeyboardInput(key); Button = new GamePadInput(button, pi); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load<SpriteFont>(@"Arial"); playerAnimations = new PlayerAnimations(Content); playerInterface = new Interface(Content); player = new Player(playerAnimations); keyboardInput = new KeyboardInput(); database = new DatabaseClass(); collision = new Collision(); enemies = new List<Enemy>(); level = new Level(Content); menu = new Menu(Content); text = new Text(); GlobalVars.currentState = GlobalVars.gameState.mainMenu; }