Re: Tab Order / Focus
That array is not defined anywhere because it has to map from Ogre key definitions to NoesisGUI key definitions. Our keys are defined in NsGui/InputEnums.hYeah, I would put it in the OgreBindings logic.
I was mainly curious if Noesis already had that array defined so that I could paste it into my version of the bindings as a hot-fix (as opposed to me writing it by hand). If you don't already have it written though I can wait until the update goes out.
Code: Select all
enum Key
{
Key_None,
Key_Back,
Key_Tab,
Key_Clear,
Key_Return,
Key_Pause,
Key_Shift,
Key_Control,
Key_Alt,
Key_Escape,
Key_Space,
Key_Prior,
Key_Next,
Key_End,
Key_Home,
Key_Left,
Key_Up,
Key_Right,
Key_Down,
Key_Select,
Key_Print,
Key_Execute,
Key_SnapShot,
Key_Insert,
Key_Delete,
Key_Help,
Key_0,
Key_1,
Key_2,
Key_3,
Key_4,
Key_5,
Key_6,
Key_7,
Key_8,
Key_9,
Key_Pad0,
Key_Pad1,
Key_Pad2,
Key_Pad3,
Key_Pad4,
Key_Pad5,
Key_Pad6,
Key_Pad7,
Key_Pad8,
Key_Pad9,
Key_Multiply,
Key_Add,
Key_Separator,
Key_Subtract,
Key_Decimal,
Key_Divide,
Key_A,
Key_B,
Key_C,
Key_D,
Key_E,
Key_F,
Key_G,
Key_H,
Key_I,
Key_J,
Key_K,
Key_L,
Key_M,
Key_N,
Key_O,
Key_P,
Key_Q,
Key_R,
Key_S,
Key_T,
Key_U,
Key_V,
Key_W,
Key_X,
Key_Y,
Key_Z,
Key_F1,
Key_F2,
Key_F3,
Key_F4,
Key_F5,
Key_F6,
Key_F7,
Key_F8,
Key_F9,
Key_F10,
Key_F11,
Key_F12,
Key_F13,
Key_F14,
Key_F15,
Key_F16,
Key_F17,
Key_F18,
Key_F19,
Key_F20,
Key_F21,
Key_F22,
Key_F23,
Key_F24,
Key_NumLock,
Key_Scroll,
Key_Count // for static array dimension
};
This function for example,
Code: Select all
extern "C" NS_DLL_EXPORT void Noesis_KeyDown(void* uiRenderer, int key)
I don't know much about Ogre. In fact, the initial version of the bindings was done by the Ogre team. But I wonder if this could be improved.
What do you think?
Re: Tab Order / Focus
The conversion should definitely happen withing the Bindings, since that code is meant to join the two systems. I've implemented a mapping on my end. Keep in mind though that I have included the bindings code directly in my project and removed the dll logic. At the top if my cpp file I have:
This maps the OIS codes to the Noesis codes. The comments are taken from the OIS code and I have marked gaps. Note that OIS supports many more inputs than Noesis does so I have mapped those to Key_None. There are also some values in the Noesis enumeration that I was uncertain what they corresponded to. Furthermore OIS separates out things like left control and right control whereas Noesis does not so I mapped both to the same Noesis command (I am not sure if that will cause issues if a user uses both left and right keys at the same time). If you plan on integrating something like what I have pasted above it could definitely use a second set of eyes as I have barely tested it.
In my Noesis_KeyUp and Noesis_KeyDown methods I simply map by doing the following:
Code: Select all
static Noesis::Gui::Key s_OISKeyMappings[] =
{
Key_None, //KC_UNASSIGNED = 0x00,
Key_Escape, //KC_ESCAPE = 0x01,
Key_1, //KC_1 = 0x02,
Key_2, //KC_2 = 0x03,
Key_3, //KC_3 = 0x04,
Key_4, //KC_4 = 0x05,
Key_5, //KC_5 = 0x06,
Key_6, //KC_6 = 0x07,
Key_7, //KC_7 = 0x08,
Key_8, //KC_8 = 0x09,
Key_9, //KC_9 = 0x0A,
Key_0, //KC_0 = 0x0B,
Key_Subtract, //KC_MINUS = 0x0C, // - on main keyboard
Key_None, //KC_EQUALS = 0x0D,
Key_Back, //KC_BACK = 0x0E, // backspace
Key_Tab, //KC_TAB = 0x0F,
Key_Q, //KC_Q = 0x10,
Key_W, //KC_W = 0x11,
Key_E, //KC_E = 0x12,
Key_R, //KC_R = 0x13,
Key_T, //KC_T = 0x14,
Key_Y, //KC_Y = 0x15,
Key_U, //KC_U = 0x16,
Key_I, //KC_I = 0x17,
Key_O, //KC_O = 0x18,
Key_P, //KC_P = 0x19,
Key_None, //KC_LBRACKET = 0x1A,
Key_None, //KC_RBRACKET = 0x1B,
Key_Return, //KC_RETURN = 0x1C, // Enter on main keyboard
Key_Control, //KC_LCONTROL = 0x1D,
Key_A, //KC_A = 0x1E,
Key_S, //KC_S = 0x1F,
Key_D, //KC_D = 0x20,
Key_F, //KC_F = 0x21,
Key_G, //KC_G = 0x22,
Key_H, //KC_H = 0x23,
Key_J, //KC_J = 0x24,
Key_K, //KC_K = 0x25,
Key_L, //KC_L = 0x26,
Key_None, //KC_SEMICOLON = 0x27,
Key_None, //KC_APOSTROPHE = 0x28,
Key_None, //KC_GRAVE = 0x29, // accent
Key_Shift, //KC_LSHIFT = 0x2A,
Key_None, //KC_BACKSLASH = 0x2B,
Key_Z, //KC_Z = 0x2C,
Key_X, //KC_X = 0x2D,
Key_C, //KC_C = 0x2E,
Key_V, //KC_V = 0x2F,
Key_B, //KC_B = 0x30,
Key_N, //KC_N = 0x31,
Key_M, //KC_M = 0x32,
Key_None, //KC_COMMA = 0x33,
Key_None, //KC_PERIOD = 0x34, // . on main keyboard
Key_None, //KC_SLASH = 0x35, // / on main keyboard
Key_Shift, //KC_RSHIFT = 0x36,
Key_None, //KC_MULTIPLY = 0x37, // * on numeric keypad
Key_Alt, //KC_LMENU = 0x38, // left Alt
Key_Space, //KC_SPACE = 0x39,
Key_None, //KC_CAPITAL = 0x3A,
Key_F1, //KC_F1 = 0x3B,
Key_F2, //KC_F2 = 0x3C,
Key_F3, //KC_F3 = 0x3D,
Key_F4, //KC_F4 = 0x3E,
Key_F5, //KC_F5 = 0x3F,
Key_F6, //KC_F6 = 0x40,
Key_F7, //KC_F7 = 0x41,
Key_F8, //KC_F8 = 0x42,
Key_F9, //KC_F9 = 0x43,
Key_F10, //KC_F10 = 0x44,
Key_NumLock, //KC_NUMLOCK = 0x45,
Key_Scroll, //KC_SCROLL = 0x46, // Scroll Lock
Key_Pad7, //KC_NUMPAD7 = 0x47,
Key_Pad8, //KC_NUMPAD8 = 0x48,
Key_Pad9, //KC_NUMPAD9 = 0x49,
Key_Subtract, //KC_SUBTRACT = 0x4A, // - on numeric keypad
Key_Pad4, //KC_NUMPAD4 = 0x4B,
Key_Pad5, //KC_NUMPAD5 = 0x4C,
Key_Pad6, //KC_NUMPAD6 = 0x4D,
Key_Add, //KC_ADD = 0x4E, // + on numeric keypad
Key_Pad1, //KC_NUMPAD1 = 0x4F,
Key_Pad2, //KC_NUMPAD2 = 0x50,
Key_Pad3, //KC_NUMPAD3 = 0x51,
Key_Pad0, //KC_NUMPAD0 = 0x52,
Key_Decimal, //KC_DECIMAL = 0x53, // . on numeric keypad
Key_None, // 0x54 - Gap
Key_None, // 0x55 - Gap
Key_None, //KC_OEM_102 = 0x56, // < > | on UK/Germany keyboards
Key_F11, //KC_F11 = 0x57,
Key_F12, //KC_F12 = 0x58,
Key_None, // 0x59 - Gap
Key_None, // 0x5A - Gap
Key_None, // 0x5B - Gap
Key_None, // 0x5C - Gap
Key_None, // 0x5D - Gap
Key_None, // 0x5E - Gap
Key_None, // 0x5F - Gap
Key_None, // 0x60 - Gap
Key_None, // 0x61 - Gap
Key_None, // 0x62 - Gap
Key_None, // 0x63 - Gap
Key_F13, //KC_F13 = 0x64, // (NEC PC98)
Key_F14, //KC_F14 = 0x65, // (NEC PC98)
Key_F15, //KC_F15 = 0x66, // (NEC PC98)
Key_None, // 0x67 - Gap
Key_None, // 0x68 - Gap
Key_None, // 0x69 - Gap
Key_None, // 0x6A - Gap
Key_None, // 0x6B - Gap
Key_None, // 0x6C - Gap
Key_None, // 0x6D - Gap
Key_None, // 0x6E - Gap
Key_None, // 0x6F - Gap
Key_None, //KC_KANA = 0x70, // (Japanese keyboard)
Key_None, // 0x71 - Gap
Key_None, // 0x72 - Gap
Key_None, //KC_ABNT_C1 = 0x73, // / ? on Portugese (Brazilian) keyboards
Key_None, // 0x74 - Gap
Key_None, // 0x75 - Gap
Key_None, // 0x76 - Gap
Key_None, // 0x77 - Gap
Key_None, // 0x78 - Gap
Key_None, //KC_CONVERT = 0x79, // (Japanese keyboard)
Key_None, // 0x7A - Gap
Key_None, //KC_NOCONVERT = 0x7B, // (Japanese keyboard)
Key_None, // 0x7C - Gap
Key_None, //KC_YEN = 0x7D, // (Japanese keyboard)
Key_None, //KC_ABNT_C2 = 0x7E, // Numpad . on Portugese (Brazilian) keyboards
Key_None, // 0x7F - Gap
Key_None, // 0x80 - Gap
Key_None, // 0x81 - Gap
Key_None, // 0x82 - Gap
Key_None, // 0x83 - Gap
Key_None, // 0x84 - Gap
Key_None, // 0x85 - Gap
Key_None, // 0x86 - Gap
Key_None, // 0x87 - Gap
Key_None, // 0x88 - Gap
Key_None, // 0x89 - Gap
Key_None, // 0x8A - Gap
Key_None, // 0x8B - Gap
Key_None, // 0x8C - Gap
Key_None, //KC_NUMPADEQUALS= 0x8D, // = on numeric keypad (NEC PC98)
Key_None, // 0x8E - Gap
Key_None, // 0x8F - Gap
Key_None, //KC_PREVTRACK = 0x90, // Previous Track (KC_CIRCUMFLEX on Japanese keyboard)
Key_None, //KC_AT = 0x91, // (NEC PC98)
Key_None, //KC_COLON = 0x92, // (NEC PC98)
Key_None, //KC_UNDERLINE = 0x93, // (NEC PC98)
Key_None, //KC_KANJI = 0x94, // (Japanese keyboard)
Key_None, //KC_STOP = 0x95, // (NEC PC98)
Key_None, //KC_AX = 0x96, // (Japan AX)
Key_None, //KC_UNLABELED = 0x97, // (J3100)
Key_None, // 0x98 - Gap
Key_None, //KC_NEXTTRACK = 0x99, // Next Track
Key_None, // 0x9A - Gap
Key_None, // 0x9B - Gap
Key_None, //KC_NUMPADENTER = 0x9C, // Enter on numeric keypad
Key_Control, //KC_RCONTROL = 0x9D,
Key_None, // 0x9E - Gap
Key_None, // 0x9F - Gap
Key_None, //KC_MUTE = 0xA0, // Mute
Key_None, //KC_CALCULATOR = 0xA1, // Calculator
Key_None, //KC_PLAYPAUSE = 0xA2, // Play / Pause
Key_None, // 0xA3 - Gap
Key_None, //KC_MEDIASTOP = 0xA4, // Media Stop
Key_None, // 0xA5 - Gap
Key_None, // 0xA6 - Gap
Key_None, // 0xA7 - Gap
Key_None, // 0xA8 - Gap
Key_None, // 0xA9 - Gap
Key_None, // 0xAA - Gap
Key_None, // 0xAB - Gap
Key_None, // 0xAC - Gap
Key_None, // 0xAD - Gap
Key_None, //KC_VOLUMEDOWN = 0xAE, // Volume -
Key_None, // 0xAF - Gap
Key_None, //KC_VOLUMEUP = 0xB0, // Volume +
Key_None, // 0xB1 - Gap
Key_None, //KC_WEBHOME = 0xB2, // Web home
Key_None, //KC_NUMPADCOMMA = 0xB3, // , on numeric keypad (NEC PC98)
Key_None, // 0xB4 - Gap
Key_Divide, //KC_DIVIDE = 0xB5, // / on numeric keypad
Key_None, // 0xB6 - Gap
Key_None, //KC_SYSRQ = 0xB7,
Key_Alt, //KC_RMENU = 0xB8, // right Alt
Key_None, // 0xB9 - Gap
Key_None, // 0xBA - Gap
Key_None, // 0xBB - Gap
Key_None, // 0xBC - Gap
Key_None, // 0xBD - Gap
Key_None, // 0xBE - Gap
Key_None, // 0xBF - Gap
Key_None, // 0xC0 - Gap
Key_None, // 0xC1 - Gap
Key_None, // 0xC2 - Gap
Key_None, // 0xC3 - Gap
Key_None, // 0xC4 - Gap
Key_Pause, //KC_PAUSE = 0xC5, // Pause
Key_None, // 0xC6 - Gap
Key_Home, //KC_HOME = 0xC7, // Home on arrow keypad
Key_Up, //KC_UP = 0xC8, // UpArrow on arrow keypad
Key_None, //KC_PGUP = 0xC9, // PgUp on arrow keypad
Key_None, // 0xCA - Gap
Key_Left, //KC_LEFT = 0xCB, // LeftArrow on arrow keypad
Key_None, // 0xCC - Gap
Key_Right, //KC_RIGHT = 0xCD, // RightArrow on arrow keypad
Key_None, // 0xCE - Gap
Key_End, //KC_END = 0xCF, // End on arrow keypad
Key_Down, //KC_DOWN = 0xD0, // DownArrow on arrow keypad
Key_None, //KC_PGDOWN = 0xD1, // PgDn on arrow keypad
Key_Insert, //KC_INSERT = 0xD2, // Insert on arrow keypad
Key_Delete, //KC_DELETE = 0xD3, // Delete on arrow keypad
Key_None, // 0xD4 - Gap
Key_None, // 0xD5 - Gap
Key_None, // 0xD6 - Gap
Key_None, // 0xD7 - Gap
Key_None, // 0xD8 - Gap
Key_None, // 0xD9 - Gap
Key_None, // 0xDA - Gap
Key_None, //KC_LWIN = 0xDB, // Left Windows key
Key_None, //KC_RWIN = 0xDC, // Right Windows key
Key_None, //KC_APPS = 0xDD, // AppMenu key
Key_None, //KC_POWER = 0xDE, // System Power
Key_None, //KC_SLEEP = 0xDF, // System Sleep
Key_None, // 0xE0 - Gap
Key_None, // 0xE1 - Gap
Key_None, // 0xE2 - Gap
Key_None, //KC_WAKE = 0xE3, // System Wake
Key_None, // 0xE4 - Gap
Key_None, //KC_WEBSEARCH = 0xE5, // Web Search
Key_None, //KC_WEBFAVORITES= 0xE6, // Web Favorites
Key_None, //KC_WEBREFRESH = 0xE7, // Web Refresh
Key_None, //KC_WEBSTOP = 0xE8, // Web Stop
Key_None, //KC_WEBFORWARD = 0xE9, // Web Forward
Key_None, //KC_WEBBACK = 0xEA, // Web Back
Key_None, //KC_MYCOMPUTER = 0xEB, // My Computer
Key_None, //KC_MAIL = 0xEC, // Mail
Key_None //KC_MEDIASELECT = 0xED // Media Select
};
In my Noesis_KeyUp and Noesis_KeyDown methods I simply map by doing the following:
Code: Select all
Key nsKey = s_OISKeyMappings[key];
Re: Tab Order / Focus
Hi,
Excellent work! I see that there are more codes in OIS but many of them were intentionally omitted in Noesis. For example KC_LBRACKET and KC_RBRACKET don't correspond to a physical key in a Spanish Keyboard. We tried to avoid those conflicting keys. Although may be we should extend our enumeration like that. Anyway these keys are used for inputs that do not require translation. For text input, we have a another function in our renderer that receive already translated characters in UTF8 :
This is the function that feeds things like the textbox.
As I told I think that the current abstraction of the bindings is not correct. Anyway I will update the github repository as soon as possible. Could you send me your implementation to use as reference?
Excellent work! I see that there are more codes in OIS but many of them were intentionally omitted in Noesis. For example KC_LBRACKET and KC_RBRACKET don't correspond to a physical key in a Spanish Keyboard. We tried to avoid those conflicting keys. Although may be we should extend our enumeration like that. Anyway these keys are used for inputs that do not require translation. For text input, we have a another function in our renderer that receive already translated characters in UTF8 :
Code: Select all
/// Notifies Renderer that a key was translated to the corresponding character
virtual void Char(NsUInt32 ch) = 0;
As I told I think that the current abstraction of the bindings is not correct. Anyway I will update the github repository as soon as possible. Could you send me your implementation to use as reference?
Re: Tab Order / Focus
I just emailed you my current bindings code. I hope it is of some use.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 2 guests