Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Could not load type RogueSharp.Map
using RLNET;
using RogueSharpTut.Core;
using RogueSharpTut.Systems;
using RogueSharp;
namespace RogueSharpTut
public class Game
//screen height and width in number of tiles
private static readonly int _screenWidth = 100;
private static readonly int _screenHeight = 70;
private static RLRootConsole _rootConsole;
//map console, takes up most of the screen and is where map is drawn
private static readonly int _mapWidth = 80;
private static readonly int _mapHeight = 48;
private static RLConsole _mapConsole;
//below map console is message console, which displays attacks, info, etc.
private static readonly int _messageWidth = 80;
private static readonly int _messageHeight = 11;
private static RLConsole _messageConsole;
//right of map console is stat console, displays player and monster stats
private static readonly int _statWidth = 20;
private static readonly int _statHeight = 70;
private static RLConsole _statConsole;
//Above map is inventory console, which shows equipment, abilities, items
private static readonly int _inventoryWidth = 80;
private static readonly int _inventoryHeight = 11;
private static RLConsole _inventoryConsole;
public static DungeonMap DungeonMap { get; private set; }
static void Main(string[] args)
//must be exact name of bitmap font file
string fontFileName = "terminal8x8.png";
//Title that will appear at the top of the console window
string consoleTitle = "RogueSharp";
//tell RLNet to use bitmap font, and specify each tile is 8x8 px
_rootConsole = new RLRootConsole(fontFileName, _screenWidth, _screenHeight, 8, 8, 1f, consoleTitle);
//Initialize sub consoles
_mapConsole = new RLConsole(_mapWidth, _mapHeight);
_messageConsole = new RLConsole(_messageWidth, _messageHeight);
_statConsole = new RLConsole(_statWidth, _statHeight);
_inventoryConsole = new RLConsole(_inventoryWidth, _inventoryHeight);
//Create DungeonMap using MapGenerator
MapGenerator mapGenerator = new MapGenerator(_mapWidth, _mapHeight);
DungeonMap = mapGenerator.CreateMap();
//Set handler for RLNET update
_rootConsole.Update += OnRootConsoleUpdate;
//set handler for RLNET render
_rootConsole.Render += OnRootConsoleRender;
//Begin RLNET game loop
//Event handler for RLNET update
private static void OnRootConsoleUpdate( object sender, UpdateEventArgs e)
_mapConsole.SetBackColor(0, 0, _mapWidth, _mapHeight, Colors.FloorBackground); //sets background color
_mapConsole.Print(1, 1,"Map", Colors.TextHeading); //set label position, label text, label color
_messageConsole.SetBackColor(0, 0, _messageWidth, _messageHeight, Swatch.DbDeepWater);
_messageConsole.Print(1, 1, "Messages", Colors.TextHeading);
_statConsole.SetBackColor(0, 0, _statWidth, _statHeight, Swatch.DbOldStone);
_statConsole.Print(1, 1, "Stats", Colors.TextHeading);
_inventoryConsole.SetBackColor(0, 0, _inventoryWidth, _inventoryHeight, Swatch.DbWood);
_inventoryConsole.Print(1, 1, "Inventory", Colors.TextHeading);
//Event handler for RLNET render
private static void OnRootConsoleRender(object sender, UpdateEventArgs e)
//Blit the sub consoles to the root console in correct locations
RLConsole.Blit(_mapConsole, 0, 0, _mapWidth, _mapHeight, _rootConsole, 0, _inventoryHeight); //source console, x and y positions of top left corner of the console, width and height of console, console to blit to, x and 7 positions of where to put to pleft corner
RLConsole.Blit(_statConsole, 0, 0, _statWidth, _statHeight, _rootConsole, _mapWidth, 0);
RLConsole.Blit(_messageConsole, 0, 0, _messageWidth, _messageHeight, _rootConsole, 0, _screenHeight - _messageHeight);
RLConsole.Blit(_inventoryConsole, 0, 0, _inventoryWidth, _inventoryHeight, _rootConsole, 0, 0);
//Draw DungeonMap created in Main()
//tell RLNet to draw the console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment