libtcod
Loading...
Searching...
No Matches
console_etc.h File Reference

Miscellaneous deprecated functions. More...

#include <stdbool.h>
#include <wchar.h>
#include "color.h"
#include "config.h"
#include "console.h"
#include "console_types.h"
#include "context.h"
#include "error.h"
#include "image.h"
#include "list.h"

Go to the source code of this file.

Macros

#define TCOD_BKGND_ALPHA(alpha)
#define TCOD_BKGND_ADDALPHA(alpha)

Functions

TCOD_Error TCOD_console_set_custom_font (const char *fontFile, int flags, int nb_char_horiz, int nb_char_vertic)
void TCOD_console_map_ascii_code_to_font (int asciiCode, int fontCharX, int fontCharY)
void TCOD_console_map_ascii_codes_to_font (int asciiCode, int nbCodes, int fontCharX, int fontCharY)
void TCOD_console_map_string_to_font (const char *s, int fontCharX, int fontCharY)
void TCOD_console_map_string_to_font_utf (const wchar_t *s, int fontCharX, int fontCharY)
void TCOD_console_set_dirty (int x, int y, int w, int h)
TCOD_Error TCOD_console_flush_ex (TCOD_Console *console, struct TCOD_ViewportOptions *viewport)
 Render and present a console with optional viewport options.
TCOD_Error TCOD_console_flush (void)
 Render and present the root console to the active display.
bool TCOD_console_is_key_pressed (TCOD_keycode_t key)
 Return True if the libtcod keycode is held.
TCOD_console_t TCOD_console_from_file (const char *filename)
bool TCOD_console_load_asc (TCOD_console_t con, const char *filename)
bool TCOD_console_load_apf (TCOD_console_t con, const char *filename)
bool TCOD_console_save_asc (TCOD_console_t con, const char *filename)
bool TCOD_console_save_apf (TCOD_console_t con, const char *filename)
TCODLIB_BEGIN_IGNORE_DEPRECATIONS TCOD_key_t TCOD_console_check_for_keypress (int flags)
 Return immediately with a recently pressed key.
TCOD_key_t TCOD_console_wait_for_keypress (bool flush)
 Wait for a key press event, then return it.
void TCOD_console_credits (void)
void TCOD_console_credits_reset (void)
bool TCOD_console_credits_render (int x, int y, bool alpha)
TCODLIB_END_IGNORE_DEPRECATIONS bool TCOD_console_credits_render_ex (TCOD_Console *console, int x, int y, bool alpha, float delta_time)
 Render a libtcod credit animation to a console.
void TCOD_console_set_keyboard_repeat (int initial_delay, int interval)
void TCOD_console_disable_keyboard_repeat (void)
void TCOD_console_set_fade (uint8_t val, TCOD_color_t fade_color)
 Fade the color of the display.
uint8_t TCOD_console_get_fade (void)
 Return the fade value.
TCOD_color_t TCOD_console_get_fading_color (void)
 Return the fade color.

Detailed Description

Miscellaneous deprecated functions.

Macro Definition Documentation

◆ TCOD_BKGND_ADDALPHA

#define TCOD_BKGND_ADDALPHA ( alpha)
Value:
((TCOD_bkgnd_flag_t)(TCOD_BKGND_ADDA | (((uint8_t)(alpha * 255)) << 8)))
TCOD_bkgnd_flag_t
Background color blend modes.
Definition console.h:60

◆ TCOD_BKGND_ALPHA

#define TCOD_BKGND_ALPHA ( alpha)
Value:
((TCOD_bkgnd_flag_t)(TCOD_BKGND_ALPH | (((uint8_t)(alpha * 255)) << 8)))

Function Documentation

◆ TCOD_console_check_for_keypress()

TCODLIB_BEGIN_IGNORE_DEPRECATIONS TCOD_key_t TCOD_console_check_for_keypress ( int flags)

Return immediately with a recently pressed key.

Parameters
flagsA TCOD_event_t bit-field, for example: TCOD_EVENT_KEY_PRESS
Returns
A TCOD_key_t struct with a recently pressed key. If no event exists then the vk attribute will be TCODK_NONE

◆ TCOD_console_credits_render_ex()

TCODLIB_END_IGNORE_DEPRECATIONS bool TCOD_console_credits_render_ex ( TCOD_Console * console,
int x,
int y,
bool alpha,
float delta_time )

Render a libtcod credit animation to a console.

Parameters
consoleThe console to render to.
x
y
alpha
delta_timeDelta time in seconds.
Returns
Returns true once the credits animation has ended.
embed:rst:leading-asterisk 
.. versionadded:: 1.19

◆ TCOD_console_flush_ex()

TCOD_Error TCOD_console_flush_ex ( TCOD_Console * console,
struct TCOD_ViewportOptions * viewport )

Render and present a console with optional viewport options.

console is the console to render.

viewport is optional.

Returns a negative values on error. See TCOD_get_error.

embed:rst:leading-asterisk 
.. versionadded:: 1.16

◆ TCOD_console_get_fade()

uint8_t TCOD_console_get_fade ( void )

Return the fade value.

Returns
At 255 colors are normal and at 0 colors are completely faded.

◆ TCOD_console_get_fading_color()

TCOD_color_t TCOD_console_get_fading_color ( void )

Return the fade color.

Returns
The current fading color.

◆ TCOD_console_is_key_pressed()

bool TCOD_console_is_key_pressed ( TCOD_keycode_t key)

Return True if the libtcod keycode is held.

embed:rst:leading-asterisk 
.. deprecated:: 1.16
    You should instead use SDL_GetKeyboardState to check if keys are held.

◆ TCOD_console_set_fade()

void TCOD_console_set_fade ( uint8_t val,
TCOD_color_t fade_color )

Fade the color of the display.

Parameters
valWhere at 255 colors are normal and at 0 colors are completely faded.
fade_colorColor to fade towards.
embed:rst:leading-asterisk 
.. deprecated:: 1.19
    This function will not work with libtcod contexts.

◆ TCOD_console_wait_for_keypress()

TCOD_key_t TCOD_console_wait_for_keypress ( bool flush)

Wait for a key press event, then return it.

Parameters
flushIf 1 then the event queue will be cleared before waiting for the next event. This should always be 0.
Returns
A TCOD_key_t struct with the most recent key data.

Do not solve input lag issues by arbitrarily dropping events!