#include "debug.h"
#include "util/hex.h"
#include "util/string.h"
+#include "util/basic_macros.h"
class UnknownKeycode : public BaseException
{
#undef N_
-#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
struct table_key lookup_keyname(const char *name)
{
- for (u16 i = 0; i < ARRAYSIZE(table); i++) {
+ for (u16 i = 0; i < ARRLEN(table); i++) {
if (strcmp(table[i].Name, name) == 0)
return table[i];
}
struct table_key lookup_keykey(irr::EKEY_CODE key)
{
- for (u16 i = 0; i < ARRAYSIZE(table); i++) {
+ for (u16 i = 0; i < ARRLEN(table); i++) {
if (table[i].Key == key)
return table[i];
}
struct table_key lookup_keychar(wchar_t Char)
{
- for (u16 i = 0; i < ARRAYSIZE(table); i++) {
+ for (u16 i = 0; i < ARRLEN(table); i++) {
if (table[i].Char == Char)
return table[i];
}
throw UnknownKeycode(os.str().c_str());
}
-KeyPress::KeyPress() :
- Key(irr::KEY_KEY_CODES_COUNT),
- Char(L'\0'),
- m_name("")
-{}
-
KeyPress::KeyPress(const char *name)
{
if (strlen(name) == 0) {
const KeyPress EscapeKey("KEY_ESCAPE");
const KeyPress CancelKey("KEY_CANCEL");
-const KeyPress NumberKey[] = {
- KeyPress("0"), KeyPress("1"), KeyPress("2"), KeyPress("3"), KeyPress("4"),
- KeyPress("5"), KeyPress("6"), KeyPress("7"), KeyPress("8"), KeyPress("9")
-};
/*
Key config