< index < 1. Colors | ===================================== 2. Console ===================================== | > 3. System layer

The console emulator handles the rendering of the game screen and the keyboard input.
2.1 Initializing the console
2.2 Drawing on the root console
2.3 Handling keyboard input
2.4 Using off-screen consoles
Classic real time game loop :

      TCODConsole::initRoot(80,50,"my game",false);
      TCODSystem::setFps(25); // limit framerate to 25 frames per second
      while ( ! endGame && ! TCODConsole::isWindowClosed() ) {
        ... draw on TCODConsole::root
        TCODConsole::flush();
        TCOD_key_t key=TCODConsole::checkForKeypress();
        updateWorld( key, TCODSystem::getLastFrameLength() );
        // updateWorld(TCOD_key_t key, float elapsed) (using key if key.vk != TCODK_NONE)
        // use elapsed to scale any update that is time dependant.
      }

Classic turn by turn game loop :

      TCODConsole::initRoot(80,50,"my game",false);
      while ( ! endGame && ! TCODConsole::isWindowClosed() ) {
        ... draw on TCODConsole::root
        TCODConsole::flush();
        TCOD_key_t key=TCODConsole::waitForKeypress(true);
        ... update world, using key
      }