public void DrawCharacter(SpriteBatch spriteBatch, AsciiFontTexture2D asciiFontTexture2D, Player player) { spriteBatch.Draw(asciiFontTexture2D.Texture2D, new Rectangle((_rectangle.X + player.X) * asciiFontTexture2D.GlyphWidth, (_rectangle.Y + player.Y) * asciiFontTexture2D.GlyphHeight, asciiFontTexture2D.GlyphWidth, asciiFontTexture2D.GlyphHeight), asciiFontTexture2D.RectangleFromGlyph(64), Color.Yellow); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { IsMouseVisible = true; _keyboardHandler = new KeyboardHandler(); _mouseHandler = new MouseHandler(); _gameStateManager = new GameStateManager(); _gameStateManager.Push(new MenuGameState(this)); _map = new Map(); _map.Width = 10; _map.Height = 10; _map.TileSet = new TileSet(); _map.TileSet.Tiles = new List<Tile> { new Tile { Name = "Void", Glyph = 8, Color = Color.White, Walkable = false, Transparent = true }, new Tile { Name = "Floor", Glyph = 249, Color = Color.White, Walkable = false, Transparent = true }, new Tile { Name = "Wall", Glyph = 219, Color = Color.White, Walkable = false, Transparent = true }, }; _map.TileSet.TileWidth = 8; _map.TileSet.TileHeight = 8; _map.TileData = new int[_map.Width, _map.Height]; for (var x = 0; x < _map.Width; x++) { for (var y = 0; y < _map.Width; y++) { _map.TileData[x, y] = 1; } } _player = new Player { X = 0, Y = 0 }; _statusView = new StatusView(new Rectangle(0, 89, 160, 90)); _consoleView = new ConsoleView(new Rectangle(0, 0, 80, 89), Color.Green); _console = new Console(); _console.Log("test"); _worldView = new WorldView(new Rectangle(80, 0, 80, 89)); base.Initialize(); }