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

C types for console functions. More...

#include "color.h"
#include "config.h"
#include "console.h"

Go to the source code of this file.

Classes

struct  TCOD_key_t
 Libtcod key event data, as a keycode or text character. More...

Macros

#define TCOD_KEY_TEXT_SIZE   32

Typedefs

typedef enum TCOD_keycode_t TCOD_keycode_t
 Libtcod specific codes representing keys on the keyboard.
typedef struct TCOD_key_t TCOD_key_t
 Libtcod key event data, as a keycode or text character.
typedef enum TCOD_chars_t TCOD_DEPRECATED_ENUM = 196
 Non-standard special character codes.
typedef enum TCOD_renderer_t TCOD_renderer_t
 Libtcod rendering modes.

Enumerations

enum  TCOD_keycode_t {
  TCODK_NONE , TCODK_ESCAPE , TCODK_BACKSPACE , TCODK_TAB ,
  TCODK_ENTER , TCODK_SHIFT , TCODK_CONTROL , TCODK_ALT ,
  TCODK_PAUSE , TCODK_CAPSLOCK , TCODK_PAGEUP , TCODK_PAGEDOWN ,
  TCODK_END , TCODK_HOME , TCODK_UP , TCODK_LEFT ,
  TCODK_RIGHT , TCODK_DOWN , TCODK_PRINTSCREEN , TCODK_INSERT ,
  TCODK_DELETE , TCODK_LWIN , TCODK_RWIN , TCODK_APPS ,
  TCODK_0 , TCODK_1 , TCODK_2 , TCODK_3 ,
  TCODK_4 , TCODK_5 , TCODK_6 , TCODK_7 ,
  TCODK_8 , TCODK_9 , TCODK_KP0 , TCODK_KP1 ,
  TCODK_KP2 , TCODK_KP3 , TCODK_KP4 , TCODK_KP5 ,
  TCODK_KP6 , TCODK_KP7 , TCODK_KP8 , TCODK_KP9 ,
  TCODK_KPADD , TCODK_KPSUB , TCODK_KPDIV , TCODK_KPMUL ,
  TCODK_KPDEC , TCODK_KPENTER , TCODK_F1 , TCODK_F2 ,
  TCODK_F3 , TCODK_F4 , TCODK_F5 , TCODK_F6 ,
  TCODK_F7 , TCODK_F8 , TCODK_F9 , TCODK_F10 ,
  TCODK_F11 , TCODK_F12 , TCODK_NUMLOCK , TCODK_SCROLLLOCK ,
  TCODK_SPACE , TCODK_CHAR , TCODK_TEXT
}
 Libtcod specific codes representing keys on the keyboard. More...
enum  TCOD_chars_t
 Non-standard special character codes. More...
enum  TCOD_key_status_t { TCOD_KEY_PRESSED = 1 , TCOD_KEY_RELEASED = 2 }
 Bitwise flags used for functions such as TCOD_console_check_for_keypress() This was replaced by the equivalent values of TCOD_event_t.
enum  TCOD_font_flags_t {
  TCOD_FONT_LAYOUT_ASCII_INCOL = 1 , TCOD_FONT_LAYOUT_ASCII_INROW = 2 , TCOD_FONT_TYPE_GREYSCALE = 4 , TCOD_FONT_TYPE_GRAYSCALE = 4 ,
  TCOD_FONT_LAYOUT_TCOD = 8 , TCOD_FONT_LAYOUT_CP437 = 16
}
 These font flags can be OR'd together into a bit-field and passed to TCOD_console_set_custom_font. More...
enum  TCOD_renderer_t {
  TCOD_RENDERER_GLSL , TCOD_RENDERER_OPENGL , TCOD_RENDERER_SDL , TCOD_RENDERER_SDL2 ,
  TCOD_RENDERER_OPENGL2 , TCOD_RENDERER_XTERM , TCOD_NB_RENDERERS
}
 Libtcod rendering modes. More...

Detailed Description

C types for console functions.

Typedef Documentation

◆ TCOD_DEPRECATED_ENUM

Non-standard special character codes.

Deprecated
Modern libtcod programs should always uses the Unicode codepoint of special characters and never this enum.

◆ TCOD_key_t

typedef struct TCOD_key_t TCOD_key_t

Libtcod key event data, as a keycode or text character.

Deprecated
The libtcod keyboard state has several known issues such as missing or broken functionality. In its current state it exists only for backwards compatibility. These issues should be resolved by using SDL directly for keyboard events.

◆ TCOD_keycode_t

Libtcod specific codes representing keys on the keyboard.

When no key was pressed (see checkForEvent) : TCOD_NONE (NoKey)

Special keys:

  • TCODK_ESCAPE (Escape)
  • TCODK_BACKSPACE (Backspace)
  • TCODK_TAB (Tab)
  • TCODK_ENTER (Enter)
  • TCODK_SHIFT (Shift)
  • TCODK_CONTROL (Control)
  • TCODK_ALT (Alt)
  • TCODK_PAUSE (Pause)
  • TCODK_CAPSLOCK (CapsLock)
  • TCODK_PAGEUP (PageUp)
  • TCODK_PAGEDOWN (PageDown)
  • TCODK_END (End)
  • TCODK_HOME (Home)
  • TCODK_UP (Up)
  • TCODK_LEFT (Left)
  • TCODK_RIGHT (Right)
  • TCODK_DOWN (Down)
  • TCODK_PRINTSCREEN (Printscreen)
  • TCODK_INSERT (Insert)
  • TCODK_DELETE (Delete)
  • TCODK_LWIN (Lwin)
  • TCODK_RWIN (Rwin)
  • TCODK_APPS (Apps)
  • TCODK_KPADD (KeypadAdd)
  • TCODK_KPSUB (KeypadSubtract)
  • TCODK_KPDIV (KeypadDivide)
  • TCODK_KPMUL (KeypadMultiply)
  • TCODK_KPDEC (KeypadDecimal)
  • TCODK_KPENTER (KeypadEnter)
  • TCODK_F1 (F1)
  • TCODK_F2 (F2)
  • TCODK_F3 (F3)
  • TCODK_F4 (F4)
  • TCODK_F5 (F5)
  • TCODK_F6 (F6)
  • TCODK_F7 (F7)
  • TCODK_F8 (F8)
  • TCODK_F9 (F9)
  • TCODK_F10 (F10)
  • TCODK_F11 (F11)
  • TCODK_F12 (F12)
  • TCODK_NUMLOCK (Numlock)
  • TCODK_SCROLLLOCK (Scrolllock)
  • TCODK_SPACE (Space)

Numeric keys:

  • TCODK_0 (Zero)
  • TCODK_1 (One)
  • TCODK_2 (Two)
  • TCODK_3 (Three)
  • TCODK_4 (Four)
  • TCODK_5 (Five)
  • TCODK_6 (Six)
  • TCODK_7 (Seven)
  • TCODK_8 (Eight)
  • TCODK_9 (Nine)
  • TCODK_KP0 (KeypadZero)
  • TCODK_KP1 (KeypadOne)
  • TCODK_KP2 (KeypadTwo)
  • TCODK_KP3 (KeypadThree)
  • TCODK_KP4 (KeypadFour)
  • TCODK_KP5 (KeypadFive)
  • TCODK_KP6 (KeypadSix)
  • TCODK_KP7 (KeypadSeven)
  • TCODK_KP8 (KeypadEight)
  • TCODK_KP9 (KeypadNine)

Any other (printable) key:

  • TCODK_CHAR (Char)
  • TCODK_TEXT (SDL_TEXTINPUT)

Codes starting with TCODK_KP represents keys on the numeric keypad (if available).

Deprecated
Using libtcod for events means only a limited set of keys are available. Use SDL for events to access a complete range of keys.

Enumeration Type Documentation

◆ TCOD_chars_t

Non-standard special character codes.

Deprecated
Modern libtcod programs should always uses the Unicode codepoint of special characters and never this enum.

◆ TCOD_font_flags_t

These font flags can be OR'd together into a bit-field and passed to TCOD_console_set_custom_font.

Enumerator
TCOD_FONT_LAYOUT_ASCII_INCOL 

Tiles are arranged in column-major order.

0 3 6 1 4 7 2 5 8

TCOD_FONT_LAYOUT_ASCII_INROW 

Tiles are arranged in row-major order.

0 1 2 3 4 5 6 7 8

TCOD_FONT_TYPE_GREYSCALE 

Converts all tiles into a monochrome gradient.

TCOD_FONT_LAYOUT_TCOD 

A unique layout used by some of libtcod's fonts.

TCOD_FONT_LAYOUT_CP437 

Decode a code page 437 tileset into Unicode code-points.

embed:rst:leading-asterisk 
*  .. versionadded:: 1.10
*  

◆ TCOD_keycode_t

Libtcod specific codes representing keys on the keyboard.

When no key was pressed (see checkForEvent) : TCOD_NONE (NoKey)

Special keys:

  • TCODK_ESCAPE (Escape)
  • TCODK_BACKSPACE (Backspace)
  • TCODK_TAB (Tab)
  • TCODK_ENTER (Enter)
  • TCODK_SHIFT (Shift)
  • TCODK_CONTROL (Control)
  • TCODK_ALT (Alt)
  • TCODK_PAUSE (Pause)
  • TCODK_CAPSLOCK (CapsLock)
  • TCODK_PAGEUP (PageUp)
  • TCODK_PAGEDOWN (PageDown)
  • TCODK_END (End)
  • TCODK_HOME (Home)
  • TCODK_UP (Up)
  • TCODK_LEFT (Left)
  • TCODK_RIGHT (Right)
  • TCODK_DOWN (Down)
  • TCODK_PRINTSCREEN (Printscreen)
  • TCODK_INSERT (Insert)
  • TCODK_DELETE (Delete)
  • TCODK_LWIN (Lwin)
  • TCODK_RWIN (Rwin)
  • TCODK_APPS (Apps)
  • TCODK_KPADD (KeypadAdd)
  • TCODK_KPSUB (KeypadSubtract)
  • TCODK_KPDIV (KeypadDivide)
  • TCODK_KPMUL (KeypadMultiply)
  • TCODK_KPDEC (KeypadDecimal)
  • TCODK_KPENTER (KeypadEnter)
  • TCODK_F1 (F1)
  • TCODK_F2 (F2)
  • TCODK_F3 (F3)
  • TCODK_F4 (F4)
  • TCODK_F5 (F5)
  • TCODK_F6 (F6)
  • TCODK_F7 (F7)
  • TCODK_F8 (F8)
  • TCODK_F9 (F9)
  • TCODK_F10 (F10)
  • TCODK_F11 (F11)
  • TCODK_F12 (F12)
  • TCODK_NUMLOCK (Numlock)
  • TCODK_SCROLLLOCK (Scrolllock)
  • TCODK_SPACE (Space)

Numeric keys:

  • TCODK_0 (Zero)
  • TCODK_1 (One)
  • TCODK_2 (Two)
  • TCODK_3 (Three)
  • TCODK_4 (Four)
  • TCODK_5 (Five)
  • TCODK_6 (Six)
  • TCODK_7 (Seven)
  • TCODK_8 (Eight)
  • TCODK_9 (Nine)
  • TCODK_KP0 (KeypadZero)
  • TCODK_KP1 (KeypadOne)
  • TCODK_KP2 (KeypadTwo)
  • TCODK_KP3 (KeypadThree)
  • TCODK_KP4 (KeypadFour)
  • TCODK_KP5 (KeypadFive)
  • TCODK_KP6 (KeypadSix)
  • TCODK_KP7 (KeypadSeven)
  • TCODK_KP8 (KeypadEight)
  • TCODK_KP9 (KeypadNine)

Any other (printable) key:

  • TCODK_CHAR (Char)
  • TCODK_TEXT (SDL_TEXTINPUT)

Codes starting with TCODK_KP represents keys on the numeric keypad (if available).

Deprecated
Using libtcod for events means only a limited set of keys are available. Use SDL for events to access a complete range of keys.

◆ TCOD_renderer_t

Libtcod rendering modes.

Enumerator
TCOD_RENDERER_GLSL 

Alias for TCOD_RENDERER_OPENGL2.

TCOD_RENDERER_OPENGL 

An OpenGL 1.1 implementation.

Performs worse than TCOD_RENDERER_GLSL without many benefits.

embed:rst:leading-asterisk 
.. deprecated:: 1.23
    This renderer has been removed.
TCOD_RENDERER_SDL 

A software based renderer.

The font file is loaded into RAM instead of VRAM in this implementation.

embed:rst:leading-asterisk 
.. deprecated:: 1.23
    This renderer has been removed.
TCOD_RENDERER_SDL2 

Libtcod's primary SDL renderer.

Uses graphics hardware.

Despite the name this renderer uses SDL3.

You may set SDL_HINT_RENDER_SCALE_QUALITY to determine the tileset upscaling filter of either nearest or linear. This hint will only take effect if it's set before this renderer is created.

embed:rst:leading-asterisk 
.. versionadded:: 1.8
TCOD_RENDERER_OPENGL2 

A new OpenGL 2.0 core renderer.

Allows the window to be resized.

You may set SDL_HINT_RENDER_SCALE_QUALITY to determine the tileset upscaling filter. Either nearest or linear. The hint will take effect on the next frame.

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

.. versionchanged:: 1.11
    This renderer now uses OpenGL 2.0 instead of 2.1.

.. versionchanged:: 1.16
    Now checks the `SDL_HINT_RENDER_SCALE_QUALITY` hint.

.. deprecated:: 1.23
    This renderer has been removed.
TCOD_RENDERER_XTERM 

A renderer targeting modern XTerm terminals with 24-bit color support.

This is an experimental renderer with partial support for XTerm and SSH. This will work best on those terminals.

Terminal inputs and events will be passed to SDL's event system.

There is poor support for ANSI escapes on Windows 10. It is not recommended to use this renderer on Windows.

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