Example #1
0
        public static string SDLCodetoDx(string sdlCode, KeyboardType keyboardType)
        {
            IKeyboardTranslator kbt = new KeyboardTranslationSDL2(keyboardType);

            if (sdlCode == null || sdlCode == "")
            {
                return("");
            }

            if (keyboardType == KeyboardType.UK)
            {
                var uk = kbt.dxKeys.Where(a => a.SDLK.ToString() == sdlCode.Replace("keyboard 0x0 ", "").TrimEnd()).ToList();
                if (uk.Count == 0)
                {
                    return(sdlCode);
                }

                if (uk.First().DxUK.Contains("SDL_SCANCODE_"))
                {
                    // no dx lookup was found
                    //return "keyboard 0x0 " + uk.First().SDLK;
                }

                return(uk.First().DxUK);
            }

            return(sdlCode);
        }
Example #2
0
        public static string DXtoSDLCode(string dxString, KeyboardType keyboardType)
        {
            IKeyboardTranslator kbt = new KeyboardTranslationSDL2(keyboardType);

            if (keyboardType == KeyboardType.UK)
            {
                var uk = kbt.dxKeys.Where(a => a.DxUK == dxString).ToList();
                if (uk.Count == 0)
                {
                    return(dxString);
                }

                return("keyboard 0x0 " + uk.First().SDLK.ToString());
            }
            return(dxString);
        }