-
Notifications
You must be signed in to change notification settings - Fork 0
/
ApprenticeGame.cs
71 lines (60 loc) · 2.32 KB
/
ApprenticeGame.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using Apprentice.GameObjects;
using Apprentice.World;
using GoRogue;
using GoRogue.Random;
using RLNET;
using WinMan;
namespace Apprentice
{
class ApprenticeGame
{
static public GameWorld World { get; private set; }
static public GameScreen GameScreen;
static public SpellsPanel SpellsPanel;
static public MessageRecallPanel MessageRecallPanel;
static public Player Player { get; private set; }
static public Map ActiveMap
{
get
{
if (Player == null)
return null;
return Player.CurrentMap;
}
}
static private KeyHandler globalKeyHandler; // handles global keys like fullscreen and exit
static void Main()
{
var settings = new RLSettings
{
BitmapFile = "font14x14.png",
CharWidth = 14,
CharHeight = 14,
Width = 80,
Height = 45,
ResizeType = RLResizeType.ResizeCells, // Display more tiles on screen if the console gets bigger, dont just increase size of existing
Scale = 1f,
StartWindowState = RLWindowState.Normal,
WindowBorder = RLWindowBorder.Resizable,
Title = "Apprentice"
};
Engine.Init(settings);
// Generate new world
World = new GameWorld(30, 30, 50, 50);
// For now we just spawn player at random position in the demi-plane
Coord playerSpawn = Map.RandomOpenPosition(World.DemiPlane, SingletonRandom.DefaultRNG);
Player = new Player(playerSpawn);
World.DemiPlane.Add(Player); // Changes active map too
// Global key commands setup
globalKeyHandler = new GlobalKeyHandler();
globalKeyHandler.StartHandling();
// UI setup
GameScreen = new GameScreen();
SpellsPanel = new SpellsPanel(Screen.SizeC(0), Screen.SizeC(0), Screen.WidthMinus(0), Screen.HeightMinus(0));
MessageRecallPanel = new MessageRecallPanel(Screen.SizeC(0), Screen.SizeC(0), Screen.WidthMinus(0), Screen.HeightMinus(0));
// Show UI and get game underway
GameScreen.Show();
Engine.Run();
}
}
}