Minetest  5.4.0
keycode.cpp File Reference
#include "keycode.h"
#include "exceptions.h"
#include "settings.h"
#include "log.h"
#include "debug.h"
#include "util/hex.h"
#include "util/string.h"
#include "util/basic_macros.h"
+ Include dependency graph for keycode.cpp:

Classes

class  UnknownKeycode
 
struct  table_key
 

Macros

#define DEFINEKEY1(x, lang)
 
#define DEFINEKEY2(x, ch, lang)
 
#define DEFINEKEY3(ch)
 
#define DEFINEKEY4(ch)
 
#define DEFINEKEY5(ch)
 
#define N_(text)   text
 

Functions

struct table_key lookup_keyname (const char *name)
 
struct table_key lookup_keykey (irr::EKEY_CODE key)
 
struct table_key lookup_keychar (wchar_t Char)
 
KeyPress getKeySetting (const char *settingname)
 
void clearKeyCache ()
 
irr::EKEY_CODE keyname_to_keycode (const char *name)
 

Variables

static const struct table_key table []
 
const KeyPress EscapeKey ("KEY_ESCAPE")
 
const KeyPress CancelKey ("KEY_CANCEL")
 
std::unordered_map< std::string, KeyPressg_key_setting_cache
 

Macro Definition Documentation

◆ DEFINEKEY1

#define DEFINEKEY1 (   x,
  lang 
)
Value:
/* Irrlicht key without character */ \
{ #x, irr::x, L'\0', lang },

◆ DEFINEKEY2

#define DEFINEKEY2 (   x,
  ch,
  lang 
)
Value:
/* Irrlicht key with character */ \
{ #x, irr::x, ch, lang },

◆ DEFINEKEY3

#define DEFINEKEY3 (   ch)
Value:
/* single Irrlicht key (e.g. KEY_KEY_X) */ \
{ "KEY_KEY_" TOSTRING(ch), irr::KEY_KEY_ ## ch, (wchar_t) *TOSTRING(ch), TOSTRING(ch) },
#define TOSTRING(x)
Definition: string.h:37

◆ DEFINEKEY4

#define DEFINEKEY4 (   ch)
Value:
/* single Irrlicht function key (e.g. KEY_F3) */ \
{ "KEY_F" TOSTRING(ch), irr::KEY_F ## ch, L'\0', "F" TOSTRING(ch) },

◆ DEFINEKEY5

#define DEFINEKEY5 (   ch)
Value:
/* key without Irrlicht keycode */ \
{ ch, irr::KEY_KEY_CODES_COUNT, (wchar_t) *ch, ch },

◆ N_

#define N_ (   text)    text

Function Documentation

◆ clearKeyCache()

void clearKeyCache ( )

References g_key_setting_cache.

Referenced by GUIKeyChangeMenu::acceptInput().

+ Here is the caller graph for this function:

◆ getKeySetting()

KeyPress getKeySetting ( const char *  settingname)

References g_key_setting_cache, g_settings, and Settings::get().

Referenced by GUIKeyChangeMenu::add_key(), GUIChatConsole::OnEvent(), GUIFormSpecMenu::OnEvent(), KeyCache::populate(), GUIFormSpecMenu::preprocessEvent(), and RandomInputHandler::step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keyname_to_keycode()

irr::EKEY_CODE keyname_to_keycode ( const char *  name)

References table_key::Key, and lookup_keyname().

Referenced by id2keycode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookup_keychar()

struct table_key lookup_keychar ( wchar_t  Char)

Referenced by KeyPress::KeyPress(), and KeyPress::name().

+ Here is the caller graph for this function:

◆ lookup_keykey()

struct table_key lookup_keykey ( irr::EKEY_CODE  key)

Referenced by KeyPress::KeyPress(), and KeyPress::name().

+ Here is the caller graph for this function:

◆ lookup_keyname()

struct table_key lookup_keyname ( const char *  name)

Referenced by KeyPress::KeyPress(), and keyname_to_keycode().

+ Here is the caller graph for this function:

Variable Documentation

◆ CancelKey

◆ EscapeKey

◆ g_key_setting_cache

std::unordered_map<std::string, KeyPress> g_key_setting_cache

Referenced by clearKeyCache(), and getKeySetting().

◆ table