public static Event ( int key, bool down ) : void | ||
key | int | |
down | bool | |
Результат | void |
// ClearAllStates static void ClearAllStates() { // send an up event for each key, to make sure the server clears them all for (int i = 0; i < 256; i++) { Key.Event(i, false); } Key.ClearStates(); Input.ClearStates(); }
void Mouse_WheelChanged(object sender, OpenTK.Input.MouseWheelEventArgs e) { if (e.Delta > 0) { Key.Event(Key.K_MWHEELUP, true); Key.Event(Key.K_MWHEELUP, false); } else { Key.Event(Key.K_MWHEELDOWN, true); Key.Event(Key.K_MWHEELDOWN, false); } }
/// <summary> /// IN_MouseEvent /// </summary> public static void MouseEvent(int mstate) { if (_IsMouseActive) { // perform button actions for (int i = 0; i < _MouseButtons; i++) { if ((mstate & (1 << i)) != 0 && (_MouseOldButtonState & (1 << i)) == 0) { Key.Event(Key.K_MOUSE1 + i, true); } if ((mstate & (1 << i)) == 0 && (_MouseOldButtonState & (1 << i)) != 0) { Key.Event(Key.K_MOUSE1 + i, false); } } _MouseOldButtonState = mstate; } }
void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { Key.Event(MapKey(e.Key), true); }
void Keyboard_KeyUp(object sender, OpenTK.Input.KeyboardKeyEventArgs e) { Key.Event(MapKey(e.Key), false); }
void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e) => Key.Event(MapKey(e.Key), true);