public ConsoleView() { RConsole.InitializeRootConsole((int)(1920d / 8 / 2), (int)(1080d / 8 / 2)); TCODSystem.setFps(30); RConsole.RootConsole.SetBackgroundColour(TCODColor.black); RConsole.RootConsole.SetForegroundColour(TCODColor.white); }
/// <summary> /// Called after Application.Start has been called. Override and place application specific /// setup code here after calling base method. /// </summary> /// <param name="info"></param> protected virtual void Setup(ApplicationInfo info) { if (!string.IsNullOrEmpty(info.Font)) { TCODConsole.setCustomFont(info.Font, (int)info.FontFlags); } FpsLimit = info.FpsLimit; _fpsFrameLength = FpsLimit == 0 ? 0 : MilliSecondsPerSecond / FpsLimit; _lastDrawMilli = 0; UpdatesPerSecondLimit = info.UpdatesPerSecondLimit; _upsFrameLength = UpdatesPerSecondLimit == 0 ? 0 : MilliSecondsPerSecond / UpdatesPerSecondLimit; _lastUpdateMilli = 0; _delayFps = FpsLimit > UpdatesPerSecondLimit; TCODSystem.setFps(FpsLimit); TCODConsole.initRoot(info.ScreenSize.Width, info.ScreenSize.Height, info.Title, info.Fullscreen, info.RendererType); TCODConsole.setKeyboardRepeat(info.InitialDelay, info.IntervalDelay); TCODMouse.showCursor(true); if (SetupEventHandler != null) { SetupEventHandler(this, EventArgs.Empty); } Pigments = new PigmentMap(DefaultPigments.FrameworkDefaults, info.Pigments); }
public static void InitDisplay() { TCODConsole.setCustomFont(font2, (int)TCODFontFlags.LayoutAsciiInRow, 16, 16); //Init font TCODSystem.setFps(30); //Set draw speed TCODConsole.initRoot(CONSOLE_WIDTH, CONSOLE_HEIGHT, "Wizard's Peril", false, TCODRendererType.GLSL); //Init the console displayConsole = TCODConsole.root; }
public Engine(TCODConsole mainConsole) { instance = this; isRunning = false; this.mainConsole = mainConsole; consoleWidth = mainConsole.getWidth(); consoleHeight = mainConsole.getHeight(); // Frame rate intialization TCODSystem.setFps(FRAME_RATE); internalTimer = new Stopwatch(); MS_PER_UPDATE = 1000 / FRAME_RATE; renderer = new Renderer(); mainCamera = new Camera(20, 2, consoleWidth - 40, consoleHeight - 12); // Load blueprint data files data = new DataManager(); data.LoadContent(); // load data tables dataTables = new TableManager(); dataTables.LoadData(TableManager.LoadDataFileList("DataTables.dir")); #if ENTRY_GAME StartNewGame(null); #else OpenMenu(new WindowMainMenu(0, 0, consoleWidth, consoleHeight, null, Window.EBorderStyle.NONE, null, null)); #endif }
static void Main(string[] args) { TCODConsole.initRoot(80, 50, "Z-Day", false); TCODSystem.setFps(30); TCODMouse.showCursor(false); Game.Current = new Game(); Game.Current.Initialize(); Game.Current.Play(); }
private void createWindow() { int fontflags = (int)TCODFontFlags.Greyscale | (int)TCODFontFlags.LayoutAsciiInRow; TCODConsole.setCustomFont(FONT, fontflags); TCODConsole.setKeyboardRepeat(500, 5000 / TARGET_FPS); TCODConsole.initRoot(WINDOW_WIDTH / FONT_WIDTH, WINDOW_HEIGHT / FONT_HEIGHT, windowName, false, TCODRendererType.SDL); TCODSystem.setFps(CONTROL_FPS); terminalManager = new TerminalManager(WINDOW_WIDTH / FONT_WIDTH, WINDOW_HEIGHT / FONT_HEIGHT); }
public void adjustFPS() { if (TCODSystem.getFps() < TARGET_FPS) { CONTROL_FPS++; TCODSystem.setFps(CONTROL_FPS); } else if (TCODSystem.getFps() > TARGET_FPS) { CONTROL_FPS--; TCODSystem.setFps(CONTROL_FPS); } }
static void Main() { TCODConsole.initRoot(80, 61, "Lights Out"); TCODSystem.setFps(100); TCODConsole.setKeyboardRepeat(250, 100); Game game = new Game(); game.Draw(); while (!TCODConsole.isWindowClosed() && !game.Exit) { game.Update(); } }
// Constructor public Window(string fontBitmap, int numberCharsHorz, int numberCharsVert, string windowTitle) { // Initialise the custom default font int fontNumberCharsHorz = 16; int fontNumberCharsVert = 16; TCODFontFlags flags = TCODFontFlags.LayoutAsciiInRow; TCODConsole.setCustomFont(fontBitmap, (int)flags, fontNumberCharsHorz, fontNumberCharsVert); // Set up the console dimensions TCODConsole.initRoot(numberCharsHorz, numberCharsVert, windowTitle, false, TCODRendererType.SDL); consoleWidth = numberCharsHorz; consoleHeight = numberCharsVert; // Get the console handle rootConsole = TCODConsole.root; // Set the framerate; TCODSystem.setFps(30); // Initialise the Menu Menu[0] = "[S]tart a new Adventure "; Menu[1] = "[C]ontinue an existing Adventure"; Menu[2] = "[Q]uit"; // Initialise the Intro Intro[0] = "A time was when we could live above ground."; Intro[1] = "A time when life flourished on the surface,"; Intro[2] = "and all the races were warmed by the Sun."; Intro[3] = String.Empty; Intro[4] = "That time was no more. Darkness claimed the Earth."; Intro[5] = "The pious extolled that we were punished by wrathful gods."; Intro[6] = "Penance and pilgrimage to atone for our sins our only hope"; Intro[7] = " at redemption."; Intro[8] = String.Empty; Intro[9] = "The sorcerers, the artificers, they sought other solutions."; Intro[10] = "Mystical archaic incantations or mechanical miracles from"; Intro[11] = " the minds of men."; Intro[12] = "That would bring back the Sun."; Intro[13] = "That would restore life to our world."; Intro[14] = String.Empty; Intro[15] = "The Sun is now but a memory, and hope fades along with the"; Intro[16] = " last of the heat."; Intro[17] = "Driving us further into the deep dark places in the Earth."; Intro[18] = "Monsters lurk in these caverns."; Intro[19] = "And men who have turned monster prey on their own kind."; Intro[20] = String.Empty; Intro[21] = "Welcome to the end of our time."; Intro[22] = "Welcome to Stygia..."; }
public static int Main() { Console.WriteLine("Started Game"); TCODSystem.setFps(30); engine.initialize(false); while (!TCODConsole.isWindowClosed() && !exit) { engine.update(); engine.render(); } Console.WriteLine("Game exited with code " + exitCode.ToString()); return(exitCode); }
static void Main() { TCODConsole.initRoot(80, 50, "my game", false); TCODSystem.setFps(25); bool endGame = false; while (!endGame && !TCODConsole.isWindowClosed()) { TCODConsole.root.print(0, 0, "Hello, world"); TCODConsole.flush(); var key = TCODConsole.checkForKeypress(); if (key.KeyCode == TCODKeyCode.Escape) { endGame = true; } } }
public void Initialize(BaseScene initialScene = null) { Logger.Initialize(); windowTitle = "Emergence"; Settings = LoadSettings("Assets/config.json"); if (Settings == null) { throw new Exception("Error loading config file."); } TCODConsole.setCustomFont($"Assets/Fonts/{Settings.Font}", (int)TCODFontFlags.LayoutAsciiInRow); TCODSystem.setFps(Settings.Fps); TCODConsole.initRoot(Settings.ScreenWidth, Settings.ScreenHeight, windowTitle, false, Settings.GetRendererType()); previousMouseData = TCODMouse.getStatus(); CurrentScene = initialScene; }
private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (CurrentDomain_UnhandledException); TCODColor fogOfWarColour = new TCODColor(80, 80, 80); int horizontalPixels, verticalPixels; TCODSystem.getCurrentResolution(out horizontalPixels, out verticalPixels); //string font = "celtic_garamond_10x10_gs_tc.png"; string font = "arial12x12.png"; TCODConsole.setCustomFont( font, (int)(TCODFontFlags.Grayscale | TCODFontFlags.LayoutTCOD), 32, 8); int fontWidth, fontHeight; TCODSystem.getCharSize(out fontWidth, out fontHeight); int screenWidth = horizontalPixels / fontWidth; int screenHeight = verticalPixels / fontHeight; var screenBounds = new Rectangle(0, 0, screenWidth, screenHeight); int infoPanelWidth = 42; var playBounds = new Rectangle(0, 0, screenBounds.Width - infoPanelWidth, screenBounds.Height); var playerBounds = new Rectangle(playBounds.Right, 0, infoPanelWidth, 6); //var threatBounds = new Rectangle(playBounds.Right, playerBounds.Bottom, infoPanelWidth, 10); var competitorBounds = new Rectangle(playBounds.Right, playerBounds.Bottom, infoPanelWidth, 27); var eventBounds = new Rectangle(playBounds.Right, competitorBounds.Bottom, infoPanelWidth, screenBounds.Height - (playerBounds.Height + competitorBounds.Height)); Game game = CreateGame(); Logger.Info("Initializing RootConsole..."); TCODConsole.initRoot(screenBounds.Width, screenBounds.Height, "Last Man Standing v1.0", true, TCODRendererType.SDL); TCODSystem.setFps(30); var rootConsole = TCODConsole.root; rootConsole.setForegroundColor(ColorPresets.White); rootConsole.setAlignment(TCODAlignment.LeftAlignment); rootConsole.setBackgroundFlag(TCODBackgroundFlag.Set); Logger.Info("Initializing playConsole..."); TCODConsole playConsole = new TCODConsole(playBounds.Width, playBounds.Height); //Logger.Info("Initializing threatConsole..."); //Console threatConsole = RootConsole.GetNewConsole(threatBounds.Width, threatBounds.Height); Logger.Info("Initializing playerConsole..."); TCODConsole playerConsole = new TCODConsole(playerBounds.Width, playerBounds.Height); Logger.Info("Initializing competitorConsole..."); TCODConsole competitorConsole = new TCODConsole(competitorBounds.Width, competitorBounds.Height); Logger.Info("Initializing eventsConsole..."); TCODConsole eventsConsole = new TCODConsole(eventBounds.Width, eventBounds.Height); Logger.Info("Starting Game Loop..."); do { TCODKey keyStroke = TCODConsole.checkForKeypress((int)TCODKeyStatus.KeyPressed); if (game.IsActive) { game.ProcessTurn(); if (keyStroke.KeyCode != TCODKeyCode.NoKey) { ((PlayerAI)game.Player.Intellect).EvaluateKeyPress(keyStroke); } } RenderAllConsoles(game, rootConsole, playConsole, fogOfWarColour, playerConsole, competitorConsole, eventsConsole, playBounds, playerBounds, competitorBounds, eventBounds); if (!game.IsActive) { rootConsole.printEx((screenBounds.Width - 30) / 2, (screenBounds.Height - 10) / 2, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, "Press SPACE to start a new game. Press ESC to quit."); if (keyStroke.KeyCode == TCODKeyCode.Space) { rootConsole.print(1, 1, "Creating new game..."); TCODConsole.flush(); game = CreateGame(); } } TCODConsole.flush(); if (keyStroke.KeyCode == TCODKeyCode.Escape) { return; } } while (!TCODConsole.isWindowClosed()); }