How to get enum names from irr::EKEY_CODE ?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

How to get enum names from irr::EKEY_CODE ?

Post by t0rt0r0 »

Hi all ;)

After searching on the web and on the forum, i can't find an easy way to do this :
get all the enums names from irr::EKEY_CODE enum to add it into a listbox (it's a part of a setup menu that allow user to select is own keymap for gaming, i hope my english isn't so bad ^^).

Sorry if i'm blind but i didn't see anything in api doc :oops:

Thank's you all and sorry for bad english ;)
CuteAlien
Admin
Posts: 9933
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

There is no automatic way - you have to write your own function for that. With one long switch-case it should just be a few minutes typing and you have that :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

Code: Select all

stringw KeyCodeToStringw(EKEY_CODE e)
{
	if (e == KEY_LBUTTON)		return wstring(L"KEY_LBUTTON");
	if (e == KEY_RBUTTON)		return wstring(L"KEY_RBUTTON");
	if (e == KEY_CANCEL)		return wstring(L"KEY_CANCEL");
	if (e == KEY_MBUTTON)		return wstring(L"KEY_MBUTTON");
	if (e == KEY_XBUTTON1)		return wstring(L"KEY_XBUTTON1");
	if (e == KEY_XBUTTON2)		return wstring(L"KEY_XBUTTON2");
	if (e == KEY_BACK)			return wstring(L"KEY_BACK");
	if (e == KEY_TAB)			return wstring(L"KEY_TAB");
	if (e == KEY_CLEAR)			return wstring(L"KEY_CLEAR");
	if (e == KEY_RETURN)		return wstring(L"KEY_RETURN");
	if (e == KEY_SHIFT)			return wstring(L"KEY_SHIFT");
	if (e == KEY_CONTROL)		return wstring(L"KEY_CONTROL");
	if (e == KEY_MENU)			return wstring(L"KEY_MENU");
	if (e == KEY_PAUSE)			return wstring(L"KEY_PAUSE");
	if (e == KEY_CAPITAL)		return wstring(L"KEY_CAPITAL");
	if (e == KEY_KANA)			return wstring(L"KEY_KANA");
	if (e == KEY_HANGUEL)		return wstring(L"KEY_HANGUEL");
	if (e == KEY_HANGUL)		return wstring(L"KEY_HANGUL");
	if (e == KEY_JUNJA)			return wstring(L"KEY_JUNJA");
	if (e == KEY_FINAL)			return wstring(L"KEY_FINAL");
	if (e == KEY_HANJA)			return wstring(L"KEY_HANJA");
	if (e == KEY_KANJI)			return wstring(L"KEY_KANJI");
	if (e == KEY_ESCAPE)		return wstring(L"KEY_ESCAPE");
	if (e == KEY_CONVERT)		return wstring(L"KEY_CONVERT");
	if (e == KEY_NONCONVERT)	return wstring(L"KEY_NONCONVERT");
	if (e == KEY_ACCEPT)		return wstring(L"KEY_ACCEPT");
	if (e == KEY_MODECHANGE)	return wstring(L"KEY_MODECHANGE");
	if (e == KEY_SPACE)			return wstring(L"KEY_SPACE");
	if (e == KEY_PRIOR)			return wstring(L"KEY_PRIOR");
	if (e == KEY_NEXT)			return wstring(L"KEY_NEXT");
	if (e == KEY_END)			return wstring(L"KEY_END");
	if (e == KEY_HOME)			return wstring(L"KEY_HOME");
	if (e == KEY_LEFT)			return wstring(L"KEY_LEFT");
	if (e == KEY_UP)			return wstring(L"KEY_UP");
	if (e == KEY_RIGHT)			return wstring(L"KEY_RIGHT");
	if (e == KEY_DOWN)			return wstring(L"KEY_DOWN");
	if (e == KEY_SELECT)		return wstring(L"KEY_SELECT");
	if (e == KEY_PRINT)			return wstring(L"KEY_PRINT");
	if (e == KEY_EXECUT)		return wstring(L"KEY_EXECUT");
	if (e == KEY_SNAPSHOT)		return wstring(L"KEY_SNAPSHOT");
	if (e == KEY_INSERT)		return wstring(L"KEY_INSERT");
	if (e == KEY_DELETE)		return wstring(L"KEY_DELETE");
	if (e == KEY_HELP)			return wstring(L"KEY_HELP");
	if (e == KEY_KEY_0)			return wstring(L"KEY_KEY_0");
	if (e == KEY_KEY_1)			return wstring(L"KEY_KEY_1");
	if (e == KEY_KEY_2)			return wstring(L"KEY_KEY_2");
	if (e == KEY_KEY_3)			return wstring(L"KEY_KEY_3");
	if (e == KEY_KEY_4)			return wstring(L"KEY_KEY_4");
	if (e == KEY_KEY_5)			return wstring(L"KEY_KEY_5");
	if (e == KEY_KEY_6)			return wstring(L"KEY_KEY_6");
	if (e == KEY_KEY_7)			return wstring(L"KEY_KEY_7");
	if (e == KEY_KEY_8)			return wstring(L"KEY_KEY_8");
	if (e == KEY_KEY_9)			return wstring(L"KEY_KEY_9");
	if (e == KEY_KEY_A)			return wstring(L"KEY_KEY_A");
	if (e == KEY_KEY_B)			return wstring(L"KEY_KEY_B");
	if (e == KEY_KEY_C)			return wstring(L"KEY_KEY_C");
	if (e == KEY_KEY_D)			return wstring(L"KEY_KEY_D");
	if (e == KEY_KEY_E)			return wstring(L"KEY_KEY_E");
	if (e == KEY_KEY_F)			return wstring(L"KEY_KEY_F");
	if (e == KEY_KEY_G)			return wstring(L"KEY_KEY_G");
	if (e == KEY_KEY_H)			return wstring(L"KEY_KEY_H");
	if (e == KEY_KEY_I)			return wstring(L"KEY_KEY_I");
	if (e == KEY_KEY_J)			return wstring(L"KEY_KEY_J");
	if (e == KEY_KEY_K)			return wstring(L"KEY_KEY_K");
	if (e == KEY_KEY_L)			return wstring(L"KEY_KEY_L");
	if (e == KEY_KEY_M)			return wstring(L"KEY_KEY_M");
	if (e == KEY_KEY_N)			return wstring(L"KEY_KEY_N");
	if (e == KEY_KEY_O)			return wstring(L"KEY_KEY_O");
	if (e == KEY_KEY_P)			return wstring(L"KEY_KEY_P");
	if (e == KEY_KEY_Q)			return wstring(L"KEY_KEY_Q");
	if (e == KEY_KEY_R)			return wstring(L"KEY_KEY_R");
	if (e == KEY_KEY_S)			return wstring(L"KEY_KEY_S");
	if (e == KEY_KEY_T)			return wstring(L"KEY_KEY_T");
	if (e == KEY_KEY_U)			return wstring(L"KEY_KEY_U");
	if (e == KEY_KEY_V)			return wstring(L"KEY_KEY_V");
	if (e == KEY_KEY_W)			return wstring(L"KEY_KEY_W");
	if (e == KEY_KEY_X)			return wstring(L"KEY_KEY_X");
	if (e == KEY_KEY_Y)			return wstring(L"KEY_KEY_Y");
	if (e == KEY_KEY_Z)			return wstring(L"KEY_KEY_Z");
	if (e == KEY_LWIN)			return wstring(L"KEY_LWIN");
	if (e == KEY_RWIN)			return wstring(L"KEY_RWIN");
	if (e == KEY_APPS)			return wstring(L"KEY_APPS");
	if (e == KEY_SLEEP)			return wstring(L"KEY_SLEEP");
	if (e == KEY_NUMPAD0)		return wstring(L"KEY_NUMPAD0");
	if (e == KEY_NUMPAD1)		return wstring(L"KEY_NUMPAD1");
	if (e == KEY_NUMPAD2)		return wstring(L"KEY_NUMPAD2");
	if (e == KEY_NUMPAD3)		return wstring(L"KEY_NUMPAD3");
	if (e == KEY_NUMPAD4)		return wstring(L"KEY_NUMPAD4");
	if (e == KEY_NUMPAD5)		return wstring(L"KEY_NUMPAD5");
	if (e == KEY_NUMPAD6)		return wstring(L"KEY_NUMPAD6");
	if (e == KEY_NUMPAD7)		return wstring(L"KEY_NUMPAD7");
	if (e == KEY_NUMPAD8)		return wstring(L"KEY_NUMPAD8");
	if (e == KEY_NUMPAD9)		return wstring(L"KEY_NUMPAD9");
	if (e == KEY_MULTIPLY)		return wstring(L"KEY_MULTIPLY");
	if (e == KEY_ADD)			return wstring(L"KEY_ADD");
	if (e == KEY_SEPARATOR)		return wstring(L"KEY_SEPARATOR");
	if (e == KEY_SUBTRACT)		return wstring(L"KEY_SUBTRACT");
	if (e == KEY_DECIMAL)		return wstring(L"KEY_DECIMAL");
	if (e == KEY_DIVIDE)		return wstring(L"KEY_DIVIDE");
	if (e == KEY_F1)			return wstring(L"KEY_F1");
	if (e == KEY_F2)			return wstring(L"KEY_F2");
	if (e == KEY_F3)			return wstring(L"KEY_F3");
	if (e == KEY_F4)			return wstring(L"KEY_F4");
	if (e == KEY_F5)			return wstring(L"KEY_F5");
	if (e == KEY_F6)			return wstring(L"KEY_F6");
	if (e == KEY_F7)			return wstring(L"KEY_F7");
	if (e == KEY_F8)			return wstring(L"KEY_F8");
	if (e == KEY_F9)			return wstring(L"KEY_F9");
	if (e == KEY_F10)			return wstring(L"KEY_F10");
	if (e == KEY_F11)			return wstring(L"KEY_F11");
	if (e == KEY_F12)			return wstring(L"KEY_F12");
	if (e == KEY_F13)			return wstring(L"KEY_F13");
	if (e == KEY_F14)			return wstring(L"KEY_F14");
	if (e == KEY_F15)			return wstring(L"KEY_F15");
	if (e == KEY_F16)			return wstring(L"KEY_F16");
	if (e == KEY_F17)			return wstring(L"KEY_F17");
	if (e == KEY_F18)			return wstring(L"KEY_F18");
	if (e == KEY_F19)			return wstring(L"KEY_F19");
	if (e == KEY_F20)			return wstring(L"KEY_F20");
	if (e == KEY_F21)			return wstring(L"KEY_F21");
	if (e == KEY_F22)			return wstring(L"KEY_F22");
	if (e == KEY_F23)			return wstring(L"KEY_F23");
	if (e == KEY_F24)			return wstring(L"KEY_F24");
	if (e == KEY_NUMLOCK)		return wstring(L"KEY_NUMLOCK");
	if (e == KEY_SCROLL)		return wstring(L"KEY_SCROLL");
	if (e == KEY_LSHIFT)		return wstring(L"KEY_LSHIFT");
	if (e == KEY_RSHIFT)		return wstring(L"KEY_RSHIFT");
	if (e == KEY_LCONTROL)		return wstring(L"KEY_LCONTROL");
	if (e == KEY_RCONTROL)		return wstring(L"KEY_RCONTROL");
	if (e == KEY_LMENU)			return wstring(L"KEY_LMENU");
	if (e == KEY_RMENU)			return wstring(L"KEY_RMENU");
	if (e == KEY_PLUS)			return wstring(L"KEY_PLUS");
	if (e == KEY_COMMA)			return wstring(L"KEY_COMMA");
	if (e == KEY_MINUS)			return wstring(L"KEY_MINUS");
	if (e == KEY_PERIOD)		return wstring(L"KEY_PERIOD");
	if (e == KEY_ATTN)			return wstring(L"KEY_ATTN");
	if (e == KEY_CRSEL)			return wstring(L"KEY_CRSEL");
	if (e == KEY_EXSEL)			return wstring(L"KEY_EXSEL");
	if (e == KEY_EREOF)			return wstring(L"KEY_EREOF");
	if (e == KEY_PLAY)			return wstring(L"KEY_PLAY");
	if (e == KEY_ZOOM)			return wstring(L"KEY_ZOOM");
	if (e == KEY_PA1)			return wstring(L"KEY_PA1");
	if (e == KEY_OEM_CLEAR)		return wstring(L"KEY_OEM_CLEAR");
	return stringw(L"UNKNOWN");
}
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

but then i thought......... why not have an array of wstrings and then reference directly into the array...

Code: Select all

stringw [1 million] = { L"KEY_UNKNOWN",
L"KEY_LBUTTON",
L"KEY_RBUTTON",
L"KEY_CANCEL",
L"KEY_MBUTTON",
L"KEY_XBUTTON1",
L"KEY_XBUTTON2",
L"KEY_BACK",
L"KEY_TAB",
L"KEY_CLEAR",
L"KEY_RETURN",
L"KEY_SHIFT",
L"KEY_CONTROL",
L"KEY_MENU",
L"KEY_PAUSE",
L"KEY_CAPITAL",
L"KEY_KANA",
L"KEY_HANGUEL",
L"KEY_HANGUL",
L"KEY_JUNJA",
L"KEY_FINAL",
L"KEY_HANJA",
L"KEY_KANJI",
L"KEY_ESCAPE",
L"KEY_CONVERT",
L"KEY_NONCONVERT",
L"KEY_ACCEPT",
L"KEY_MODECHANGE",
L"KEY_SPACE",
L"KEY_PRIOR",
L"KEY_NEXT",
L"KEY_END",
L"KEY_HOME",
L"KEY_LEFT",
L"KEY_UP",
L"KEY_RIGHT",
L"KEY_DOWN",
L"KEY_SELECT",
L"KEY_PRINT",
L"KEY_EXECUT",
L"KEY_SNAPSHOT",
L"KEY_INSERT",
L"KEY_DELETE",
L"KEY_HELP",
L"KEY_KEY_0",
L"KEY_KEY_1",
L"KEY_KEY_2",
L"KEY_KEY_3",
L"KEY_KEY_4",
L"KEY_KEY_5",
L"KEY_KEY_6",
L"KEY_KEY_7",
L"KEY_KEY_8",
L"KEY_KEY_9",
L"KEY_KEY_A",
L"KEY_KEY_B",
L"KEY_KEY_C",
L"KEY_KEY_D",
L"KEY_KEY_E",
L"KEY_KEY_F",
L"KEY_KEY_G",
L"KEY_KEY_H",
L"KEY_KEY_I",
L"KEY_KEY_J",
L"KEY_KEY_K",
L"KEY_KEY_L",
L"KEY_KEY_M",
L"KEY_KEY_N",
L"KEY_KEY_O",
L"KEY_KEY_P",
L"KEY_KEY_Q",
L"KEY_KEY_R",
L"KEY_KEY_S",
L"KEY_KEY_T",
L"KEY_KEY_U",
L"KEY_KEY_V",
L"KEY_KEY_W",
L"KEY_KEY_X",
L"KEY_KEY_Y",
L"KEY_KEY_Z",
L"KEY_LWIN",
L"KEY_RWIN",
L"KEY_APPS",
L"KEY_SLEEP",
L"KEY_NUMPAD0",
L"KEY_NUMPAD1",
L"KEY_NUMPAD2",
L"KEY_NUMPAD3",
L"KEY_NUMPAD4",
L"KEY_NUMPAD5",
L"KEY_NUMPAD6",
L"KEY_NUMPAD7",
L"KEY_NUMPAD8",
L"KEY_NUMPAD9",
L"KEY_MULTIPLY",
L"KEY_ADD",
L"KEY_SEPARATOR",
L"KEY_SUBTRACT",
L"KEY_DECIMAL",
L"KEY_DIVIDE",
L"KEY_F1",
L"KEY_F2",
L"KEY_F3",
L"KEY_F4",
L"KEY_F5",
L"KEY_F6",
L"KEY_F7",
L"KEY_F8",
L"KEY_F9",
L"KEY_F10",
L"KEY_F11",
L"KEY_F12",
L"KEY_F13",
L"KEY_F14",
L"KEY_F15",
L"KEY_F16",
L"KEY_F17",
L"KEY_F18",
L"KEY_F19",
L"KEY_F20",
L"KEY_F21",
L"KEY_F22",
L"KEY_F23",
L"KEY_F24",
L"KEY_NUMLOCK",
L"KEY_SCROLL",
L"KEY_LSHIFT",
L"KEY_RSHIFT",
L"KEY_LCONTROL",
L"KEY_RCONTROL",
L"KEY_LMENU",
L"KEY_RMENU",
L"KEY_PLUS",
L"KEY_COMMA",
L"KEY_MINUS",
L"KEY_PERIOD",
L"KEY_ATTN",
L"KEY_CRSEL",
L"KEY_EXSEL",
L"KEY_EREOF",
L"KEY_PLAY",
L"KEY_ZOOM",
L"KEY_PA1",
L"KEY_OEM_CLEAR" }
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I'm not sure what you think this will do...

Code: Select all

stringw [1 million] = { L"KEY_UNKNOWN", 
1 million isn't a valid integral constant and you haven't named the array, so the code isn't legal. Another thing to consider is that the array you're attempting to declare is an array of objects that need to be constructed. If you did declare the array as core::stringw names [] = {...}, each string would be constructed at dynamic initialization time. If you used const wchar_t* const names[] = {...} the values would be initialized statically, well before program startup.

The first solution is likely to be inefficient because it uses many ifs, and the second is error prone because a change in any of the values of the key codes would cause your code to misbehave.

I think I've posted this before, it should be efficient, and correctly handles any changes to the key code values.

Code: Select all

const wchar_t* KeyCodeName(EKEY_CODE key) 
{
   switch (key)
   {
#define KEY_CASE(k) case k: return L#k
      KEY_CASE(KEY_LBUTTON);
      KEY_CASE(KEY_LBUTTON);

      // ...

      KEY_CASE(KEY_OEM_CLEAR);
#undef KEY_CASE
   }

   return 0;
}
Travis
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

Post by t0rt0r0 »

Thanks you all for replying !

So there is no prebuilded c++ way to do this, we have to implement our own code :/

I'll try to implement this, thanks ;)

Have a nice day !
shadow2kx
Posts: 3
Joined: Mon Apr 21, 2008 12:34 am

Post by shadow2kx »

Unfortunately enum in c++ are not very parsing friendly. In .net the reflection is usefull in that case. I found this (click). It might be usefull for some.

Thank you for your code vitek.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Seven your array thing won't work bc the enums don't have the values from 0-KEY_COUNT. Thats why that array thing won't do anything but crash sry
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

Sudi wrote:Seven your array thing won't work bc the enums don't have the values from 0-KEY_COUNT. Thats why that array thing won't do anything but crash sry
you guys crack me up......
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

vitek wrote:I'm not sure what you think this will do...

Code: Select all

stringw [1 million] = { L"KEY_UNKNOWN", 
1 million isn't a valid integral constant and you haven't named the array, so the code isn't legal.

really? 1 million isnt a valid integral constant? hmmmm... who woulda thought? you guys really do crack me up.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Seven wrote:really? 1 million isnt a valid integral constant? hmmmm... who woulda thought? you guys really do crack me up.
Then why didn't you just write 1000000, or better yet, avoid specifying the array size at all? It is more compact, accurate, and legal. It is best to say what you mean, and mean what you say.
shadow2kx wrote:Unfortunately enum in c++ are not very parsing friendly.
The IAttributes interface has a few methods that makes serialization of enumerations much easier.

Travis
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Seven wrote:
Sudi wrote:Seven your array thing won't work bc the enums don't have the values from 0-KEY_COUNT. Thats why that array thing won't do anything but crash sry
you guys crack me up......
what? i tried this some time ago it simply doesn't work and its obvious why when u would take a look at the header file.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
CuteAlien
Admin
Posts: 9933
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Yeah, main problem with using an array is that the values in the enum have gaps. I like viteks solution as it is safe. Only problem is that it returns not exactly names which are nice to display to users, which is probably what you want this function for. Sevens first solution would be better for that (as other names can be used).

My own solution loads each values from a stringtable (st). Stringtable is loaded from xml and if it does not contain the corresponding label it just returns the values of the label for which it is asked itself.

So looks like that:

Code: Select all

    irr::core::stringw strw(L"unknown");

    if ( st )
    {
        switch ( button_ )
        {
        case KEY_CANCEL:    strw = st->Get("Control-break"); break;
        case KEY_BACK:      strw = st->Get("BACKSPACE"); break;
        case KEY_TAB:       strw = st->Get("TAB"); break;
        case KEY_CLEAR:     strw = st->Get("CLEAR"); break;
        case KEY_RETURN:    strw = st->Get("ENTER"); break;
        case KEY_SHIFT:     strw = st->Get("SHIFT"); break;
        case KEY_CONTROL:   strw = st->Get("CTRL"); break;
        case KEY_MENU:      strw = st->Get("ALT"); break;
        case KEY_PAUSE:     strw = st->Get("PAUSE"); break;
        case KEY_CAPITAL:   strw = st->Get("CAPS LOCK"); break;
        case KEY_ESCAPE:    strw = st->Get("ESC key"); break;
        case KEY_SPACE:     strw = st->Get("SPACEBAR"); break;
        case KEY_PRIOR:     strw = st->Get("PAGE UP"); break;
        case KEY_NEXT:      strw = st->Get("PAGE DOWN"); break;
        case KEY_END:       strw = st->Get("END"); break;
        case KEY_HOME:      strw = st->Get("HOME"); break;
        case KEY_LEFT:      strw = st->Get("LEFT ARROW"); break;
        case KEY_UP:        strw = st->Get("UP ARROW"); break;
        case KEY_RIGHT:     strw = st->Get("RIGHT ARROW"); break;
        case KEY_DOWN:      strw = st->Get("DOWN ARROW"); break;
        case KEY_SELECT:    strw = st->Get("SELECT"); break;
        case KEY_PRINT:     strw = st->Get("PRINT"); break;
        case KEY_EXECUT:    strw = st->Get("EXECUTE"); break;
        case KEY_SNAPSHOT:  strw = st->Get("PRINT SCREEN"); break;
        case KEY_INSERT:    strw = st->Get("INS"); break;
        case KEY_DELETE:    strw = st->Get("DEL"); break;
        case KEY_HELP:      strw = st->Get("HELP"); break;
        case KEY_KEY_0:     strw = st->Get("0"); break;
        case KEY_KEY_1:     strw = st->Get("1"); break;
        case KEY_KEY_2:     strw = st->Get("2"); break;
        case KEY_KEY_3:     strw = st->Get("3"); break;
        case KEY_KEY_4:     strw = st->Get("4"); break;
        case KEY_KEY_5:     strw = st->Get("5"); break;
        case KEY_KEY_6:     strw = st->Get("6"); break;
        case KEY_KEY_7:     strw = st->Get("7"); break;
        case KEY_KEY_8:     strw = st->Get("8"); break;
        case KEY_KEY_9:     strw = st->Get("9"); break;
        case KEY_KEY_A:     strw = st->Get("A"); break;
        case KEY_KEY_B:     strw = st->Get("B"); break;
        case KEY_KEY_C:     strw = st->Get("C"); break;
        case KEY_KEY_D:     strw = st->Get("D"); break;
        case KEY_KEY_E:     strw = st->Get("E"); break;
        case KEY_KEY_F:     strw = st->Get("F"); break;
        case KEY_KEY_G:     strw = st->Get("G"); break;
        case KEY_KEY_H:     strw = st->Get("H"); break;
        case KEY_KEY_I:     strw = st->Get("I"); break;
        case KEY_KEY_J:     strw = st->Get("J"); break;
        case KEY_KEY_K:     strw = st->Get("K"); break;
        case KEY_KEY_L:     strw = st->Get("L"); break;
        case KEY_KEY_M:     strw = st->Get("M"); break;
        case KEY_KEY_N:     strw = st->Get("N"); break;
        case KEY_KEY_O:     strw = st->Get("O"); break;
        case KEY_KEY_P:     strw = st->Get("P"); break;
        case KEY_KEY_Q:     strw = st->Get("Q"); break;
        case KEY_KEY_R:     strw = st->Get("R"); break;
        case KEY_KEY_S:     strw = st->Get("S"); break;
        case KEY_KEY_T:     strw = st->Get("T"); break;
        case KEY_KEY_U:     strw = st->Get("U"); break;
        case KEY_KEY_V:     strw = st->Get("V"); break;
        case KEY_KEY_W:     strw = st->Get("W"); break;
        case KEY_KEY_X:     strw = st->Get("X"); break;
        case KEY_KEY_Y:     strw = st->Get("Y"); break;
        case KEY_KEY_Z:     strw = st->Get("Z"); break;
        case KEY_LWIN:      strw = st->Get("Left Windows"); break;
        case KEY_RWIN:      strw = st->Get("Right Windows"); break;
        case KEY_APPS:      strw = st->Get("Applications"); break;
        case KEY_SLEEP:     strw = st->Get("Sleep"); break;
        case KEY_NUMPAD0:   strw = st->Get("Num 0"); break;
        case KEY_NUMPAD1:   strw = st->Get("Num 1"); break;
        case KEY_NUMPAD2:   strw = st->Get("Num 2"); break;
        case KEY_NUMPAD3:   strw = st->Get("Num 3"); break;
        case KEY_NUMPAD4:   strw = st->Get("Num 4"); break;
        case KEY_NUMPAD5:   strw = st->Get("Num 5"); break;
        case KEY_NUMPAD6:   strw = st->Get("Num 6"); break;
        case KEY_NUMPAD7:   strw = st->Get("Num 7"); break;
        case KEY_NUMPAD8:   strw = st->Get("Num 8"); break;
        case KEY_NUMPAD9:   strw = st->Get("Num 9"); break;
        case KEY_MULTIPLY:  strw = st->Get("Multiply"); break;
        case KEY_ADD:       strw = st->Get("Add"); break;
        case KEY_SEPARATOR: strw = st->Get("Separator"); break;
        case KEY_SUBTRACT:  strw = st->Get("Subtract"); break;
        case KEY_DECIMAL:   strw = st->Get("Decimal"); break;
        case KEY_DIVIDE:    strw = st->Get("Divide"); break;
        case KEY_F1:        strw = st->Get("F1"); break;
        case KEY_F2:        strw = st->Get("F2"); break;
        case KEY_F3:        strw = st->Get("F3"); break;
        case KEY_F4:        strw = st->Get("F4"); break;
        case KEY_F5:        strw = st->Get("F5"); break;
        case KEY_F6:        strw = st->Get("F6"); break;
        case KEY_F7:        strw = st->Get("F7"); break;
        case KEY_F8:        strw = st->Get("F8"); break;
        case KEY_F9:        strw = st->Get("F9"); break;
        case KEY_F10:       strw = st->Get("F10"); break;
        case KEY_F11:       strw = st->Get("F11"); break;
        case KEY_F12:       strw = st->Get("F12"); break;
        case KEY_NUMLOCK:   strw = st->Get("NUM LOCK"); break;
        case KEY_SCROLL:    strw = st->Get("SCROLL LOCK"); break;
        case KEY_LSHIFT:    strw = st->Get("Left SHIFT"); break;
        case KEY_RSHIFT:    strw = st->Get("Right SHIFT"); break;
        case KEY_LCONTROL:  strw = st->Get("Left CONTROL"); break;
        case KEY_RCONTROL:  strw = st->Get("Right CONTROL"); break;
        case KEY_LMENU:     strw = st->Get("Left MENU"); break;
        case KEY_RMENU:     strw = st->Get("Right MENU"); break;
        case KEY_COMMA:     strw = st->Get(","); break;
        case KEY_PLUS:      strw = st->Get("+"); break;
        case KEY_MINUS:     strw = st->Get("-"); break;
        case KEY_PERIOD:    strw = st->Get("."); break;
        case KEY_ATTN:      strw = st->Get("Attn"); break;
        case KEY_CRSEL:     strw = st->Get("CrSel"); break;
        case KEY_EXSEL:     strw = st->Get("ExSel"); break;
        case KEY_EREOF:     strw = st->Get("Erase EOF"); break;
        case KEY_PLAY:      strw = st->Get("Play"); break;
        case KEY_ZOOM:      strw = st->Get("Zoom"); break;
        case KEY_PA1:       strw = st->Get("PA1"); break;
        case KEY_OEM_CLEAR: strw = st->Get("Clear"); break;
        default:
            strw = st->Get("unknown key"); break;
        }
    }
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

Post by t0rt0r0 »

Interresting way !
For the moment i didn't had the time to implement/try your methods, but if you could share your xml file, maybe some people are interrested in ;)

I'll be back when i'll have time to do this ;)

Thank's a lot ;)
d3jake
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Post by d3jake »

This is a bit of a ressurection, but thank you for the code. This is something that I will be needing in the short future for my project.
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
Post Reply