Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.39 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using RLNET;
  7. using RogueSharp;
  8. using LightSouls.Core;
  9. using LightSouls.Systems;
  10.  
  11. namespace LightSouls {
  12.     class LightSouls {
  13.  
  14.         //Height and width static variables.
  15.         private static readonly int SCREEN_WIDTH = 80;
  16.         private static readonly int SCREEN_HEIGHT = 45;
  17.  
  18.         //The main console.
  19.         private static RLRootConsole rootCon;
  20.  
  21.         //The messages console
  22.         private static RLConsole msgCon;
  23.         private static readonly int msgWidth = SCREEN_WIDTH;
  24.         private static readonly int msgHeight = 10;
  25.  
  26.         private static RLConsole mapCon;
  27.         private static readonly int mapWidth = SCREEN_WIDTH;
  28.         private static readonly int mapHeight = SCREEN_HEIGHT - msgHeight;
  29.  
  30.         //Bitmap font file
  31.         private static string fontFile = "terminal8x8.png";
  32.         private static int fontW = 8;
  33.         private static int fontH = 8;
  34.  
  35.         //The dungeon map
  36.         public static DungeonMap dungeonMap { get; private set; }
  37.  
  38.         static void Main(string[] args) {
  39.             //Init the console.
  40.             rootCon = new RLRootConsole(fontFile, SCREEN_WIDTH, SCREEN_HEIGHT, fontW, fontH, 1f, "Light Souls");
  41.            
  42.             //Handle the update events.
  43.             rootCon.Update += OnRootUpdate;
  44.             rootCon.Render += OnRootRender;
  45.  
  46.             //Create the additional consoles.
  47.             msgCon = new RLConsole(msgWidth, msgHeight);
  48.             mapCon = new RLConsole(mapWidth, mapHeight);
  49.  
  50.             //Spin up a new map.
  51.             MapGenerator mapGen = new MapGenerator(mapWidth, mapHeight);
  52.             dungeonMap = mapGen.CreateMap();
  53.  
  54.             //Begin the loop.
  55.             rootCon.Run();
  56.         }
  57.  
  58.         private static void OnRootUpdate(object sender, UpdateEventArgs e) {
  59.             msgCon.Print(1, 1, "Message Log", RLColor.White);
  60.         }
  61.  
  62.         //Render the screen.
  63.         private static void OnRootRender(object sender, UpdateEventArgs e) {
  64.             //Blit the messages onto the root.
  65.             RLConsole.Blit(msgCon, 0, 0, msgWidth, msgHeight, rootCon, 0, SCREEN_HEIGHT - msgHeight);
  66.             RLConsole.Blit(mapCon, 0, 0, mapWidth, mapHeight, rootCon, 0, 0);
  67.             dungeonMap.Draw(mapCon);
  68.             rootCon.Draw();
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement