Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
keycode.cpp File Reference
#include "keycode.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

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

static const table_keylookup_keyname (const char *name)
 
static const table_keylookup_keykey (irr::EKEY_CODE key)
 
static const table_keylookup_keychar (wchar_t Char)
 
const KeyPressgetKeySetting (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 LMBKey ("KEY_LBUTTON")
 
const KeyPress MMBKey ("KEY_MBUTTON")
 
const KeyPress RMBKey ("KEY_RBUTTON")
 
static 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:27

◆ 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_

Function Documentation

◆ clearKeyCache()

void clearKeyCache ( )

References g_key_setting_cache.

Referenced by GUIKeyChangeMenu::acceptInput().

+ Here is the caller graph for this function:

◆ getKeySetting()

const KeyPress & getKeySetting ( const char * settingname)

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

Referenced by GUIKeyChangeMenu::add_key(), GUIChatConsole::OnEvent(), GUIFormSpecMenu::OnEvent(), MyEventReceiver::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 id_to_keycode().

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

◆ lookup_keychar()

static const table_key & lookup_keychar ( wchar_t Char)
static

References table_key::Char, hex_encode(), and table.

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

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

◆ lookup_keykey()

static const table_key & lookup_keykey ( irr::EKEY_CODE key)
static

References table_key::Key, and table.

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

+ Here is the caller graph for this function:

◆ lookup_keyname()

static const table_key & lookup_keyname ( const char * name)
static

References table_key::Name, and table.

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

+ Here is the caller graph for this function:

Variable Documentation

◆ EscapeKey

◆ g_key_setting_cache

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

Referenced by clearKeyCache(), and getKeySetting().

◆ LMBKey

const KeyPress LMBKey("KEY_LBUTTON") ( "KEY_LBUTTON" )

◆ MMBKey

const KeyPress MMBKey("KEY_MBUTTON") ( "KEY_MBUTTON" )

◆ RMBKey

const KeyPress RMBKey("KEY_RBUTTON") ( "KEY_RBUTTON" )

◆ table