static void OtherMain(string[] args) { Terminal.Init(95, 43, "caRL", 7, 9); //GameStateManager.SetCurrentGameState(new MainGameState()); Console.SetCursorPosition(0, 4); Buffer buffer; Narrative dialogue; buffer = Terminal.CreateBuffer(80, 35); dialogue = new Narrative(buffer); buffer.DrawFrameLeft(0, 0, 80, 35, ConsoleColor.DarkGray); String textBlob = "Lorem ipsum dolor\n sit amet, consectetur adipiscing elit. Donec eget fermentum neque. Curabitur aliquam velit quis dapibus varius. Sed id dolor mattis, lacinia metus ac, varius leo. Nullam fringilla diam congue eros dictum lacinia. Donec ac suscipit turpis, a laoreet lectus. Nullam blandit tempus mi, a malesuada neque pellentesque ut. Maecenas nunc elit, dapibus et auctor vel, placerat sed lorem. Morbi rutrum eleifend volutpat." + "Suspendisse a gravida leo, et volutpat diam.Proin efficitur tincidunt erat a varius.Nam in nulla vel nisl finibus commodo.Aliquam tempor sapien quis tellus interdum consequat.Donec aliquam dignissim egestas.Nullam non suscipit est, in interdum magna.Nunc volutpat enim hendrerit libero rhoncus, ac placerat nisl feugiat.Quisque condimentum tortor at enim laoreet, at rhoncus turpis lacinia.Aliquam lacus turpis, accumsan a viverra in, pretium ac tortor.Maecenas pharetra sollicitudin blandit.Ut in libero tincidunt elit fringilla rutrum.Mauris lacinia posuere diam a lacinia.Nulla volutpat, diam ac varius gravida, massa eros vehicula dui, in blandit elit augue sit amet orci."; var frameTimer = new Stopwatch(); bool running = true; while (running) { // lock core game loop to 10 FPS var ms = (int)frameTimer.ElapsedMilliseconds; if (ms < 100) { Thread.Sleep(100 - ms); } frameTimer.Restart(); //GameStateManager.CurrentGameState.Update(); // logic update //GameStateManager.CurrentGameState.Render(); // render update //Console.Write(CreateBorderedText(textBlob,80, prefix:" ", suffix: " ")); dialogue.Write(textBlob); buffer.Blit(0, 2); Console.ReadLine(); //Console.SetCursorPosition(0, 5); //Console.Write("This is some sample text that I am going to keep typing so that I can test if it wraps. If it does then I will have achieved something cool. If not it's back to the drawing board" + Environment.NewLine + "here is a new line."); //Console.Read(); if (Terminal.IsKeyPressed(Keys.Escape)) { running = false; } } }
public void DrawGameUI() { Player player = Controller.Game.Player; GameStatistics stats = Controller.Game.Gamestats; Console.Clear(); //mainBuffer = Terminal.CreateBuffer(80, 43); narrative = new Narrative(mainBuffer); mainBuffer.DrawFrame(0, 0, 80, 43, ConsoleColor.DarkGray); narrative.Write(GameController.InputResponse.ToString(), fg: ConsoleColor.DarkGreen); mainBuffer.Blit(0, 3); statsBuffer.DrawFrame(0, 0, 80, 3, ConsoleColor.DarkGray); //statsBuffer.Draw($"HP {stats.HP}/{stats.MaxHP} MP {stats.MP}/{stats.MaxMP} ST {stats.ST}/{stats.MaxST} GP {stats.GP}", 2, 1, ConsoleColor.Cyan); statsBuffer.Draw($"Health: {player.Health.ToString()}", 2, 1, ConsoleColor.Gray); statsBuffer.Draw($"Moves: {stats.Moves.ToString().PadLeft(4, '0')}", 18, 1, ConsoleColor.Gray); statsBuffer.Draw($"Score: {stats.Score.ToString().PadLeft(6, '0')}", 32, 1, ConsoleColor.Gray); statsBuffer.Draw($"Time: {stats.ElapsedTime}", 47, 1, ConsoleColor.Gray); var hpColor = (stats.HP < stats.MaxHP / 2) ? ConsoleColor.Red : ConsoleColor.White; statsBuffer.Draw($"{player.PlayerLocation.Name}".PadLeft(15), 64, 1, ConsoleColor.Yellow); statsBuffer.Blit(0, 0); attrBuffer.DrawFrame(0, 0, 38, 46, ConsoleColor.DarkGray); //attrBuffer.DrawVDiv(0, 0, 3, ConsoleColor.DarkGray); //attrBuffer.DrawHDiv(0, 15, 45, ConsoleColor.DarkGray); //attrBuffer.DrawHDiv(0, 23, 45, ConsoleColor.DarkGray); //attrBuffer.DrawHDiv(0, 34, 45, ConsoleColor.DarkGray); //attrBuffer.Draw(" ATTR ", 2, 0, ConsoleColor.White); attrBuffer.Draw(player.FirstName == "" ?"Name:??????":$"Name:{player.FirstName}", 2, 1, ConsoleColor.White); attrBuffer.Draw("Disoriented Barista", 2, 3, ConsoleColor.DarkCyan); attrBuffer.Draw($"Status:", 2, 5, ConsoleColor.White); attrBuffer.Draw($"Has to take a shit", 2, 7, ConsoleColor.Yellow); attrBuffer.Draw("EQUIPPED", 2, 16, ConsoleColor.Gray); attrBuffer.Draw("Dirty Underwear", 2, 18, ConsoleColor.DarkGray); //attrBuffer.Draw("+7 War Axe", 2, 18, ConsoleColor.DarkGray); //attrBuffer.Draw("Steel Plate", 2, 19, ConsoleColor.DarkGray); //attrBuffer.Draw("Iron Shield", 2, 20, ConsoleColor.DarkGray); //attrBuffer.Draw("Heavy Boots", 2, 21, ConsoleColor.DarkGray); attrBuffer.Draw("Exits", 2, 24, ConsoleColor.Gray); int currentY = 26; foreach (KeyValuePair <string, Exit> exit in player.PlayerLocation.Exits) { Room destination = GameObject.GetComponent <Room>(exit.Value.DestinationKey); //display the name of the door to the player if the path is locked else just tell them where the exit leads string nameDisplay = exit.Value.IsLocked ? exit.Value.Name : destination.Name; attrBuffer.Draw($"{exit.Key}: {nameDisplay}", 2, currentY, ConsoleColor.DarkGray); currentY += 1; } attrBuffer.Draw("Interesting Things", 2, 36, ConsoleColor.Gray); currentY = 38; foreach (StoryItem item in player.PlayerLocation.RoomItems) { string itemString = ""; attrBuffer.Draw($"{item.Name }", 2, currentY, ConsoleColor.DarkGray); currentY += 1; } attrBuffer.Blit(81, 0); Console.SetCursorPosition(0, 45); }