void
XWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
{
	char keys[32];
	XQueryKeymap(m_display, keys);
	for (UInt32 i = 0; i < 32; ++i) {
		for (UInt32 j = 0; j < 8; ++j) {
			if ((keys[i] & (1u << j)) != 0) {
				pressedKeys.insert(8 * i + j);
			}
		}
	}
}
void
CMSWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
{
	BYTE keyState[256];
	if (!GetKeyboardState(keyState)) {
		LOG((CLOG_ERR "GetKeyboardState returned false on pollPressedKeys"));
		return;
	}
	for (KeyButton i = 1; i < 256; ++i) {
		if ((keyState[i] & 0x80) != 0) {
			pressedKeys.insert(i);
		}
	}
}
Beispiel #3
0
void
OSXKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
{
	::KeyMap km;
	GetKeys(km);
	const UInt8* m = reinterpret_cast<const UInt8*>(km);
	for (UInt32 i = 0; i < 16; ++i) {
		for (UInt32 j = 0; j < 8; ++j) {
			if ((m[i] & (1u << j)) != 0) {
				pressedKeys.insert(mapVirtualKeyToKeyButton(8 * i + j));
			}
		}
	}
}