< index < 2. Console emulator < 2.1 Initializing the console |
===================================== |
C++ : static void TCODConsole::credits() C : void TCOD_console_credits() Py : console_credits()The credits screen can be skipped by pressing any key.
C++ : TCODConsole::initRoot(80,50,"The Chronicles Of Doryen v0.1",false); // initialize the root console TCODConsole::credits(); // print the credits page // your game here... C : TCOD_console_init_root(80,50,"The Chronicles Of Doryen v0.1",false); TCOD_console_credits(); Py : libtcod.console_init_root(80,50,"The Chronicles Of Doryen v0.1",False) libtcod.console_credits()
C++ : static bool TCODConsole::renderCredits(int x, int y, bool alpha) C : bool TCOD_console_credits_render(int x, int y, bool alpha) Py : console_credits_render(x, y, alpha)
Parameter | Description |
---|---|
x,y | Position of the credits text in your root console |
alpha | If true, credits are transparently added on top of the existing screen. For this to work, this function must be placed between your screen rendering code and the console flush. |
C++ : TCODConsole::initRoot(80,50,"The Chronicles Of Doryen v0.1",false); // initialize the root console bool endCredits=false; while ( ! TCODConsole::isWindowClosed() ) { // your game loop // your game rendering here... // render transparent credits near the center of the screen if (! endCredits ) endCredits=TCODConsole::renderCredits(35,25,true); TCODConsole::flush(); } C : TCOD_console_init_root(80,50,"The Chronicles Of Doryen v0.1",false); bool end_credits=false; while ( ! TCOD_console_is_window_closed() ) { // your game rendering here... // render transparent credits near the center of the screen if (! end_credits ) end_credits=TCOD_console_credits_render(35,25,true); TCOD_console_flush(); } Py : libtcod.console_init_root(80,50,"The Chronicles Of Doryen v0.1",False) end_credits=False while not libtcod.console_is_window_closed() : // your game rendering here... // render transparent credits near the center of the screen if (not end_credits ) : end_credits=libtcod.console_credits_render(35,25,True) libtcod.console_flush()