Exemplo n.º 1
0
	bool InputManager::keyPressed(const OIS::KeyEvent& _arg)
	{
		MyGUI::Char text = (MyGUI::Char)_arg.text;
		MyGUI::KeyCode key = MyGUI::KeyCode::Enum(_arg.key);
		int scan_code = key.toValue();

		if (scan_code > 70 && scan_code < 84)
		{
			static MyGUI::Char nums[13] = { 55, 56, 57, 45, 52, 53, 54, 43, 49, 50, 51, 48, 46 };
			text = nums[scan_code-71];
		}
		else if (key == MyGUI::KeyCode::Divide)
		{
			text = '/';
		}
		else
		{
#if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
			text = (MyGUI::Char)translateWin32Text((int)key.toValue());
#endif
		}

		injectKeyPress(key, text);
		return true;
	}
Exemplo n.º 2
0
    bool DiInputManager::keyPressed(const OIS::KeyEvent& _arg)
    {
        MyGUI::Char text = (MyGUI::Char)_arg.text;
        MyGUI::KeyCode key = MyGUI::KeyCode::Enum(_arg.key);
#if DEMI_PLATFORM == DEMI_PLATFORM_WIN32
        int scan_code = key.toValue();

        if (scan_code > 70 && scan_code < 84)
        {
            static MyGUI::Char nums[13] = { 55, 56, 57, 45, 52, 53, 54, 43, 49, 50, 51, 48, 46 };
            text = nums[scan_code - 71];
        }
        else if (key == MyGUI::KeyCode::Divide)
            text = '/';
        else
            text = translateWin32Text(key);
        injectKeyPress(key, text);
#else
        injectKeyPress(key, text);
#endif

        for (auto it = mKeyPresses.begin(); it != mKeyPresses.end(); ++it)
            if (it->second)
                it->second(_arg);

        return true;
    }