protected override void StateStarted() { Game.RenderSystem.Window.Focus(); map = new MapStack(Game.RenderSystem.Window.Size, 20, 15, "SandboxMap", Game.RenderSystem.Window); map.AddPage(new BuildingPage(map.PageSize), new Vector3(0, 0, 0)); hacker = new PlayerEntity(map); hacker.Location = new Vector3(10, 8, 0); map.ViewFrom(hacker); Game.InputSystem.Command.CommandSet = "World"; }
static void Main() { Game.Initialize("."); AbstractWindow gwin; String glyphPath = Game.PathTo("curses_640x300.png"); using (Stream imgstream = File.OpenRead(glyphPath)) { GlyphPalette pal = new GlyphPalette(imgstream, 16, 16); Int32 width = 80 * pal.GlyphDimensions.Width; Int32 height = 25 * pal.GlyphDimensions.Height; try { Game.SetRenderSystem("OpenTK"); gwin = Game.RenderSystem.CreateWindow(new Size(width, height), pal); Game.SetInputSystem("OpenTK"); } catch (System.NullReferenceException e) { Console.WriteLine("Error when loading plugin: " + e.Message + "\n" + e.Source); return; } } Game.InputSystem.LoadConfiguration(Game.PathTo("commands.ini")); gwin.Clear(); map = new MapStack(Game.RenderSystem.Window.WindowSize, 20, 15, "SandboxMap"); map.AddPage(new YellowWallPage(map.PageSize), new Vector3(0, 0, 0)); map.AddPage(new YellowWallPage(map.PageSize), new Vector3(1, 0, 0)); map.AddPage(new YellowWallPage(map.PageSize), new Vector3(0, 1, 0)); map.AddPage(new YellowWallPage(map.PageSize), new Vector3(1, 1, 0)); map.AddPage(new YellowWallPage(map.PageSize), new Vector3(-1, 0, 0)); map.AddPage(new YellowWallPage(map.PageSize), new Vector3(1, 1, 1)); map.AddPage(new YellowWallPage(map.PageSize), new Vector3(-1, 0, 1)); cache = new ZColdCachingAlgorithm(map); ent = new WanderingEntity(); ent.Location = new Vector3(2, 2, 0); ent.Map = map; gwin.AddRegion(map); Sharplike.UI.Controls.Label l = new UI.Controls.Label(new Size(50, 1), new Point(0, 0)); l.Text = "Label on the map."; map.AddRegion(l); Sharplike.UI.Controls.Window win = new UI.Controls.Window(new Size(20, 10), new Point(5, 5)); win.Title = "Dialog Window"; win.BackgroundColor = Color.FromArgb(100, 0, 0, 200); map.AddRegion(win); Game.OnGameInitialization += new EventHandler <EventArgs>(game_OnGameInitialization); Game.GameProcessing += new EventHandler <EventArgs>(game_GameProcessing); StepwiseGameLoop loop = new StepwiseGameLoop(RunGame); Game.Run(loop); Game.Terminate(); }