/// <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); }
static void Main(string[] args) { Console.WriteLine("Rogue Game: By Thomas Edmunds"); #if CUSTOM_FONT Console.WriteLine("- Creating custom libTCOD font..."); TCODConsole.setCustomFont(FONT_SHEET, (int)TCODFontFlags.LayoutAsciiInRow | (int)TCODFontFlags.Greyscale); #endif Console.WriteLine("- Initializing libTCOD console..."); TCODConsole.initRoot(WindowWidth, WindowHeight, GAME_TITLE, false, TCODRendererType.SDL); TCODConsole.setKeyboardRepeat(keyInitialDelay, keyInterval); Console.WriteLine("- libTCOD fullscreen = " + doFullscreen.ToString()); TCODConsole.setFullscreen(doFullscreen); Console.WriteLine("- Game Entry point, launching rogue engine..."); // Init the game engine: game entrypoint Engine engine = new Engine(TCODConsole.root); int endCode = engine.Run(); Console.WriteLine("- Game exit with code " + endCode); return; }
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); }
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(); } }