public InputEventKeyboard(KeyboardEvent eventType, WinKeys wParamVirtKeyCode, int lParamKeyData, WinKeys modifiers) : base(modifiers) { m_eventType = eventType; KeyCode = wParamVirtKeyCode; m_KeyDataExtra = lParamKeyData; }
private void OnKeyboardKeyPressed (KeyboardEvent e) { var keyboard = GameState ["keyboard"]; if (keyboard.IsKeyPressed (Keys.Escape)) GameState.Exit (); }
public InputEventKeyboard(KeyboardEvent eventType, WinKeys virtKeyCode, int keyData, WinKeys modifiers) : base(modifiers) { EventType = eventType; KeyCode = virtKeyCode; m_KeyDataExtra = keyData; }
public void OnEvent(KeyboardEvent ev) { // F3 - http://community.bistudio.com/wiki/DIK_KeyCodes /* if (ev.Pressed) { Entry.UserInterace.Chat.Log("Pressed key : " + ev.Key.ToString()); } else { Entry.UserInterace.Chat.Log("Released key : " + ev.Key.ToString()); }*/ if (ev.Key == 0x9D && ev.Pressed) { UIEnabled = !UIEnabled; if (UIEnabled) GlobalContext.Controller.DisableInput(); else GlobalContext.Controller.EnableInput(); } if (UIEnabled) { Overlay.System.InjectKeyboardKey(ev.Key, ev.Pressed); } }
public InputEventKeyboard(KeyboardEvent eventType, InputEventKeyboard parent) : base(parent) { m_eventType = eventType; KeyCode = parent.KeyCode; m_KeyDataExtra = parent.m_KeyDataExtra; }
public GameCom(Game game) { this.game = game; OnKeyDown = new KeyboardEvent(OnKeyDownCode); OnKeyUp = new KeyboardEvent(OnKeyUpCode); OnKeyDownHold = new KeyboardEvent(OnKeyDownHoldCode); EnableAll(); }
// OnGUI is called for rendering and handling GUI events public void OnGUI() { if (GameSettings.Instance.game.showDFScreen) { Event e = Event.current; if (e.isKey) { KeyboardEvent dfEvent = new KeyboardEvent(); switch (e.type) { case EventType.KeyDown: dfEvent.type = 2; dfEvent.state = 0; break; case EventType.KeyUp: dfEvent.type = 3; dfEvent.state = 0; break; } SDL.Mod mod = SDL.Mod.KmodNone; if (e.shift) { mod |= SDL.Mod.KmodShift; } if (e.control) { mod |= SDL.Mod.KmodCtrl; } if (e.alt) { mod |= SDL.Mod.KmodAlt; } if (e.command) { mod |= SDL.Mod.KmodMeta; } if (e.capsLock) { mod |= SDL.Mod.KmodCaps; } dfEvent.mod = (uint)mod; dfEvent.scancode = (uint)e.keyCode; dfEvent.sym = (uint)e.keyCode; dfEvent.unicode = e.character; if (e.keyCode == KeyCode.None && e.character != '\0') { StartCoroutine(DelayedKeyboardEvent(dfEvent)); // Unity doesn't give any keyboard events for character up, but DF expect it. } else { keyPresses.Enqueue(dfEvent); } } } }
public void processKeyboard(KeyboardEvent evt) { EventHorizonBlazorInterop.Func <CachedEntity>( new object[] { new string[] { this.___guid, "processKeyboard" }, evt } ); }
private void InputKeyUp(KeyboardEvent e) { Up.As <Events>().InputUp(e); Down.As <Events>().InputUp(e); Left.As <Events>().InputUp(e); Right.As <Events>().InputUp(e); Cancel.As <Events>().InputUp(e); Button1.As <Events>().InputUp(e); }
public static void onKeyUp(KeyboardEvent evt) { int keyCode = evt.KeyCode; if (__this.PressedButtons.Contains(keyCode)) { __this.PressedButtons.Remove(keyCode); } }
public IEnumerator DelayedKeyboardEvent(KeyboardEvent dfEvent) { keyPresses.Enqueue(dfEvent); yield return(new WaitForSeconds(0.1f)); dfEvent.type = 3; dfEvent.state = 0; keyPresses.Enqueue(dfEvent); }
private void onKeyUp(Event e) { KeyboardEvent ev = (KeyboardEvent)e; if (ev.keyCode == Keyboard.ESCAPE) { dispatchEvent(new StateEvent(this, StateEvent.CHANGE_STATE, "exit")); } }
static void OnKeyDown(KeyboardEvent e) { var tc = CurrentTabCanvas; switch (e.Key) { case "f": tc.GraphCanvas.DoZoomFit(); break; case "-": tc.GraphCanvas.DoZoom(-1, new Box(0.5, 0.5)); break; case "+": tc.GraphCanvas.DoZoom(1, new Box(0.5, 0.5)); break; case "i": tc.GraphCanvas.ToggleVertexIndices(); break; case "I": tc.GraphCanvas.RotateVertexIndices(); break; case "j": tc.GraphCanvas.ToggleEdgeIndices(); break; case "J": tc.GraphCanvas.RotateEdgeIndices(); break; case "r": tc.GraphCanvas.DoReverseSelectedEdges(); break; case "R": tc.GraphCanvas.DoRotateSelectedEdges(); break; case "y": if (e.CtrlKey) { tc.GraphCanvas.DoRedo(); } break; case "z": if (e.CtrlKey) { tc.GraphCanvas.DoUndo(); } break; } }
public ValueTask set_event(KeyboardEvent value) { __event = null; return(EventHorizonBlazorInterop.Set( this.___guid, "event", value )); }
public void RegisterOnKeyUpEvent(Keys key, KeyboardEvent ev) { if (this.upEvents.ContainsKey(key)) { this.upEvents[key] += ev; return; } this.upEvents[key] = ev; }
private void onKeyUp(Event e) { KeyboardEvent ev = (KeyboardEvent)e; if (ev.keyCode == Keyboard.ESCAPE) { dispatchEvent(new StateEvent(this, StateEvent.TURN_OFF)); } }
private void OnRawKeyboardInputProcessed(KeyboardEvent @event) { if (!keyboardEventReceiverRef.TryGetTarget(out var receiver)) { return; } receiver.Receive(@event); }
public async ValueTask processKeyboard(KeyboardEvent evt) { await EventHorizonBlazorInterop.Func <CachedEntity>( new object[] { new string[] { this.___guid, "processKeyboard" }, evt } ); }
public virtual bool keyReleased(KeyboardEvent evt) { bool ret = (SwigDerivedClassHasMethod("keyReleased", swigMethodTypes2) ? BitesPINVOKE.InputListener_keyReleasedSwigExplicitInputListener(swigCPtr, KeyboardEvent.getCPtr(evt)) : BitesPINVOKE.InputListener_keyReleased(swigCPtr, KeyboardEvent.getCPtr(evt))); if (BitesPINVOKE.SWIGPendingException.Pending) { throw BitesPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public override bool keyPressed(KeyboardEvent evt) { bool ret = BitesPINVOKE.InputListenerChain_keyPressed(swigCPtr, KeyboardEvent.getCPtr(evt)); if (BitesPINVOKE.SWIGPendingException.Pending) { throw BitesPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
private void GameFormSDL_KeyDownActions(KeyboardEvent e) { var altReturn = ((KeyCode)e.Keysym.Sym == KeyCode.KReturn) && (((Keymod)e.Keysym.Mod & Keymod.KmodAlt) != 0); var altEnter = ((KeyCode)e.Keysym.Sym == KeyCode.KKPEnter) && (((Keymod)e.Keysym.Mod & Keymod.KmodAlt) != 0); if (altReturn || altEnter) { FullscreenToggle?.Invoke(this, EventArgs.Empty); } }
public void InputDown(KeyboardEvent e) { if (e.KeyCode != _keyCode) { return; } _buttonDown = true; _buttonUp = false; }
private void OnRawKeyboardInputProcessed(KeyboardEvent @event) { if (!_keyboardEventReceiver.TryGetTarget(out var receiver) && UnsetHookOnReceiverDead) { UnsetKeyboardHook(); return; } receiver.Receive(@event); }
public override bool keyReleased(KeyboardEvent evt) { bool ret = BitesPINVOKE.CameraMan_keyReleased(swigCPtr, KeyboardEvent.getCPtr(evt)); if (BitesPINVOKE.SWIGPendingException.Pending) { throw BitesPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
protected override void KeyDownHandler(Event e) { KeyboardEvent ke = (KeyboardEvent)e; if (ke.KeyCode != KeyCode.Space) { return; } _keyboardPressed = true; }
public void SymbolicKeysTranslatorConstructorTest() { var builder = new FakeProcessorsBuilder(new[] { new SymbolicKeysTranslator() }); var converter = new NaturalTextConverter(builder); var events = new [] { KeyboardEvent.FromKeys(Keys.Enter), KeyboardEvent.FromKeys(Keys.Escape) }; var actual = converter.Convert(events, null, null, null); Assert.AreEqual("\u21b5\u238b", actual); }
public bool TryProcessEvent(KeyboardEvent evnt, out string result) { result = null; var k = evnt.Keys; switch (_state) { case 0: if (k.HasFlag(Keys.Control) && k.HasFlag(Keys.K)) { _state = 1; } break; case 1: if (k.HasFlag(Keys.Control) && k.HasFlag(Keys.L)) { _state = 2; _startIndex = _index; } else { _state = 0; } break; case 2: if (k.HasFlag(Keys.Control) && k.HasFlag(Keys.K)) { _state = 3; } else if (_index > _startIndex && _index < _endIndex) { result = "*"; return(true); } break; case 3: if (k.HasFlag(Keys.Control) && k.HasFlag(Keys.L)) { _state = 0; } else { _state = 0; _endIndex = _index; } break; } _index++; return(false); }
public static void RemoveEventListener(KeyboardEvent eventType, Action <string> callback) { if (watchers == null) { return; } var clone = new List <Action <string> >(watchers[eventType]); clone.Remove(callback); watchers[eventType] = clone; }
public void BlockTabEvent(KeyboardEvent ev) { if (ev.keyCode == 9) { if (OnRequestToClose != null) { OnRequestToClose(); } ev.preventDefault(); } }
private void TextDisplayKeyUpHandler(Event e) { //Debug.Log("TextDisplayKeyUpHandler"); KeyboardEvent ke = (KeyboardEvent)e; if (ke.KeyCode == KeyCode.Return) { //Debug.Log("Return"); CommitTextInput(true); } }
public bool TryProcessEvent(KeyboardEvent evnt, out string result) { result = null; if (evnt.IsChar) { result = evnt.Char.ToString(); return(true); } return(false); }
public static async ValueTask <KeyboardInfo> NewKeyboardInfo( decimal type, KeyboardEvent @event ) { var entity = await EventHorizonBlazorInterop.New( new string[] { "BABYLON", "KeyboardInfo" }, type, @event ); return(new KeyboardInfo(entity)); }
public static void SendLetter(char letter, KeyboardEvent direction = KeyboardEvent.Both) { //a=65 if (char.IsLetter(letter) && char.IsLower(letter)) { Send((int)letter - 32, direction); } else if (char.IsLetter(letter) && char.IsUpper(letter)) { Send((int)letter, direction); } }
public KeyboardInfoPre( decimal type, KeyboardEvent @event ) : base() { var entity = EventHorizonBlazorInterop.New( new string[] { "BABYLON", "KeyboardInfoPre" }, type, @event ); ___guid = entity.___guid; }
internal void ProcessKeyboardEvent(KeyboardEvent e) { bool pressed = e.State != 0; var scancode = e.Keysym.Scancode; Key key = Sdl2KeyMap.GetKey(scancode); if (key != Key.Unknown) { state[key] = pressed; } }
public void IgnoreCtrlShiptOnly() { var converter = new NaturalTextConverter(new FakeProcessorsBuilder(new[] { new ShortcutProcessor() })); var events = new[] { KeyboardEvent.FromKeys(Keys.Control | Keys.LShiftKey), }; var actual = converter.Convert(events, null, null, null); Assert.AreEqual("", actual); }
public bool HandleKeyboardEvent(KeyboardEvent type, WinKeys key, bool shift, bool alt, bool ctrl) { foreach (InputEvent e in m_EventsThisFrame) { if (e.Handled || !(e is InputEventKeyboard)) continue; InputEventKeyboard ek = (InputEventKeyboard)e; if (ek.EventType != type || ek.KeyCode != key || ek.Shift != shift || ek.Alt != alt || ek.Control != ctrl) continue; e.Handled = true; return true; } return false; }
public void injectKeyEvent( string charString, string eventType ) { // Create event KeyboardEvent keyEvent = new KeyboardEvent( eventType, true, false ); keyEvent.controlKey = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl); #if UNITY_4_0_1 keyEvent.commandKey = Input.GetKey(KeyCode.LeftCommand) || Input.GetKey(KeyCode.RightCommand); #endif keyEvent.charString = charString.ToString(); // Get string // Send to active focus if( stage.focus != null ) { stage.focus.fireEvent( keyEvent ); // Fire on focus } else { stage.fireEvent( keyEvent ); // Fire on stage } }
public static void Send(int VKey, KeyboardEvent e = KeyboardEvent.Both) { switch (e) { case KeyboardEvent.Both: { keybd_event((byte)VKey, 0, 0, 0); keybd_event((byte)VKey, 0, 2, 0); } break; case KeyboardEvent.Down: keybd_event((byte)VKey, 0, 0, 0); break; case KeyboardEvent.Up: keybd_event((byte)VKey, 0, 2, 0); break; } }
public DefaultCamera(InputManager inputManager, float fov) : base() { this.fov = fov; this.inputManager = inputManager; KeyboardEvent evt_mouseRelease = new KeyboardEvent(InputManager.KeyboardKey.LeftAlt, () => { CenterMouse(); mouseCaptured = !mouseCaptured; // if (camMode == CameraMode.FPSMode) // inputManager.SetMouseVisible(!mouseCaptured); }); inputManager.AddKeyboardEvent(evt_mouseRelease); MouseEvent evt_mouseClick = new MouseEvent(ApexEngine.Input.InputManager.MouseButton.Left, false, () => { // if (camMode == CameraMode.FPSMode) CenterMouse(); mouseDragging = true; mouseCaptured = true; /* if (camMode == CameraMode.DragMode) inputManager.SetMouseVisible(!mouseDragging); else if (camMode == CameraMode.FPSMode) inputManager.SetMouseVisible(!mouseCaptured);*/ }); inputManager.AddMouseEvent(evt_mouseClick); MouseEvent evt_mouseUp = new MouseEvent(ApexEngine.Input.InputManager.MouseButton.Left, true, () => { // if (camMode == CameraMode.FPSMode) CenterMouse(); mouseDragging = false; /*if (camMode == CameraMode.DragMode) inputManager.SetMouseVisible(!mouseDragging); else if (camMode == CameraMode.FPSMode) inputManager.SetMouseVisible(!mouseCaptured);*/ }); inputManager.AddMouseEvent(evt_mouseUp); }
/// <summary> /// Used to remove an event from the GameKeyReleased /// </summary> /// <param name="key">The selected GameKey</param> public void RemoveGameKeyReleased(GameKeys key, KeyboardEvent evt) { _gameKeyReleased[(int)key] -= evt; }
public KeyboardEventArgs(KeyboardEvent ev) { this.Event = ev; if (ev == null) throw new ArgumentNullException ("ev"); }
/// <summary>Creates a new keyboard event for a snapshot point</summary> /// <returns>The new keyboard event</returns> public static KeyboardEvent Snapshot() { var keyboardEvent = new KeyboardEvent(); keyboardEvent.EventType = EventType.Snapshot; return keyboardEvent; }
/// <summary>Creates a new keyboard event for an entered character</summary> /// <param name="character">Character that has been entered</param> /// <returns>The new keyboard event</returns> public static KeyboardEvent CharacterEntry(char character) { var keyboardEvent = new KeyboardEvent(); keyboardEvent.EventType = EventType.Character; keyboardEvent.Character = character; return keyboardEvent; }
/// <summary>Creates a new keyboard event for a key release</summary> /// <param name="key">Key that has been released</param> /// <returns>The new keyboard event</returns> public static KeyboardEvent KeyRelease(Keys key) { var keyboardEvent = new KeyboardEvent(); keyboardEvent.EventType = EventType.KeyRelease; keyboardEvent.Key = key; return keyboardEvent; }
/// <summary>Creates a new keyboard event for a key press</summary> /// <param name="key">Key that has been pressed</param> /// <returns>The new keyboard event</returns> public static KeyboardEvent KeyPress(Keys key) { var keyboardEvent = new KeyboardEvent(); keyboardEvent.EventType = EventType.KeyPress; keyboardEvent.Key = key; return keyboardEvent; }
private INPUT TranslateKeyEvent(KeyboardEvent kevent) { Keys k = GetWKey (kevent.Code); return new INPUT { type = 1, u = new InputUnion { ki = new KEYBDINPUT { wVk = (ushort)k, //todo } } }; }
public void InvokeKeyboardEvent(KeyboardEvent ev) { throw new NotImplementedException(); //INPUT input = TranslateKeyEvent (ev); //Interop.SendInput (1, new[] { input }, ); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { Event = KeyboardEventSerializer.Instance.Deserialize (context, reader); }
public FormBox(Game g) : base(g) { BGTextureBox = new TextureBox(g); ControlBoxes.Add(BGTextureBox); OnFormBoxAppear = new FormBoxEvent(OnFormBoxAppearCode); OnFormBoxDisappear = new FormBoxEvent(OnFormBoxDisappearCode); OnFormBoxFocus = new FormBoxEvent(OnFormBoxFocusCode); OnFormBoxLostFocus = new FormBoxEvent(OnFormBoxLostFocusCode); OnKeyDown = new KeyboardEvent(OnKeyDownCode); OnKeyUp = new KeyboardEvent(OnKeyUpCode); OnKeyDownHold = new KeyboardEvent(OnKeyDownHoldCode); }
private void OnKeyboardEvent(KeyboardEvents kEvent, Keys key) { var ev = KeyboardEvent; if (ev == null) return; KeyboardEventType type; switch (kEvent) { case KeyboardEvents.KeyDown: case KeyboardEvents.SystemKeyDown: type = KeyboardEventType.Down; break; case KeyboardEvents.KeyUp: case KeyboardEvents.SystemKeyUp: type = KeyboardEventType.Up; break; default: return; } var kev = new KeyboardEvent (type, KeyModifiers.None, GetPIKey (key), 1); ev (this, new KeyboardEventArgs (kev)); }
internal void ReceiveKeyboardEvent(KeyboardEvent ke) { switch (ke) { case KeyboardEvent.Down: m_InInitialRepeatPeriod = true; m_State = ActionState.Press; m_SecondsSincePress = 0f; break; case KeyboardEvent.Up: m_State = ActionState.Release; break; // ignore press events - we handle our own presses. } }
private void HandleKeyboardEvent(KeyboardEvent keyboardEvent) { queuedEvents.Add(keyboardEvent); }
public bool HandleKeyboardEvent(KeyboardEvent type, WinKeys key, bool shift, bool alt, bool ctrl) { foreach(InputEvent e in m_EventsThisFrame) { if(!e.Handled && e is InputEventKeyboard) { InputEventKeyboard ek = (InputEventKeyboard)e; if(ek.EventType == type && ek.KeyCode == key && ek.Shift == shift && ek.Alt == alt && ek.Control == ctrl) { e.Handled = true; return true; } } } return false; }
/// <summary> /// Used to add an event to the GameKeyReleased /// </summary> /// <param name="key">The selected GameKey</param> public void AddGameKeyReleased(GameKeys key, KeyboardEvent evt) { _gameKeyReleased[(int)key] += evt; }
public InputEventKB(KeyboardEvent eventType, EventArgsKeyboard args) : base(args) { _eventType = eventType; }
public bool HandleKeyboardEvent(KeyboardEvent type, WinKeys key, bool shift, bool alt, bool ctrl) { List<InputEventKB> events = GetKeyboardEvents(); foreach (InputEventKB e in events) { if (e.EventType == type && e.KeyCode == key && e.Shift == shift && e.Alt == alt && e.Control == ctrl) { e.Handled = true; return true; } } return false; }
private void KeyBoardEventProcessor(KeyboardEvent keyboardEvent) { //int keyCode = KeyboardUtility.AndroidKeyToWindowsKey(dataPacket.KeyboardEvent.KeyCode); int keyCode = keyboardEvent.KeyCode; KeyboardUtility.keybd_event(keyCode, 0, 0, 0); KeyboardUtility.keybd_event(keyCode, 0, 2, 0); }