Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using RLNET;
- using RogueSharp;
- using LightSouls.Core;
- using LightSouls.Systems;
- namespace LightSouls {
- class LightSouls {
- //Height and width static variables.
- private static readonly int SCREEN_WIDTH = 80;
- private static readonly int SCREEN_HEIGHT = 45;
- //The main console.
- private static RLRootConsole rootCon;
- //The messages console
- private static RLConsole msgCon;
- private static readonly int msgWidth = SCREEN_WIDTH;
- private static readonly int msgHeight = 10;
- private static RLConsole mapCon;
- private static readonly int mapWidth = SCREEN_WIDTH;
- private static readonly int mapHeight = SCREEN_HEIGHT - msgHeight;
- //Bitmap font file
- private static string fontFile = "terminal8x8.png";
- private static int fontW = 8;
- private static int fontH = 8;
- //The dungeon map
- public static DungeonMap dungeonMap { get; private set; }
- static void Main(string[] args) {
- //Init the console.
- rootCon = new RLRootConsole(fontFile, SCREEN_WIDTH, SCREEN_HEIGHT, fontW, fontH, 1f, "Light Souls");
- //Handle the update events.
- rootCon.Update += OnRootUpdate;
- rootCon.Render += OnRootRender;
- //Create the additional consoles.
- msgCon = new RLConsole(msgWidth, msgHeight);
- mapCon = new RLConsole(mapWidth, mapHeight);
- //Spin up a new map.
- MapGenerator mapGen = new MapGenerator(mapWidth, mapHeight);
- dungeonMap = mapGen.CreateMap();
- //Begin the loop.
- rootCon.Run();
- }
- private static void OnRootUpdate(object sender, UpdateEventArgs e) {
- msgCon.Print(1, 1, "Message Log", RLColor.White);
- }
- //Render the screen.
- private static void OnRootRender(object sender, UpdateEventArgs e) {
- //Blit the messages onto the root.
- RLConsole.Blit(msgCon, 0, 0, msgWidth, msgHeight, rootCon, 0, SCREEN_HEIGHT - msgHeight);
- RLConsole.Blit(mapCon, 0, 0, mapWidth, mapHeight, rootCon, 0, 0);
- dungeonMap.Draw(mapCon);
- rootCon.Draw();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement