public IEnumerator TestMouse() { var environment = InputTestEnvironment.Create(); var inputManager = InputManager.Create(environment.Resolution, 2, 0); environment.SetInputManager(inputManager); environment.SetMouses(inputManager.GetMouses().Cast <MouseCursor>()); environment.ListenToState(inputManager.GetMouses().Cast <IInput>()); while (environment.IsRunning) { yield return(null); } }
public IEnumerator Test() { var environment = InputTestEnvironment.Create(); var cursors = new MouseCursor[] { new MouseCursor(KeyCode.Mouse0, environment.Resolution), new MouseCursor(KeyCode.Mouse1, environment.Resolution) }; environment.SetActivatable(cursors); environment.SetMouses(cursors); environment.ListenToState(cursors); while (environment.IsRunning) { yield return(null); } }
public IEnumerator Test() { var environment = InputTestEnvironment.Create(); var keys = new KeyboardKey[] { new KeyboardKey(KeyCode.A), new KeyboardKey(KeyCode.S), new KeyboardKey(KeyCode.D), new KeyboardKey(KeyCode.F), }; environment.ListenToState(keys); environment.SetActivatable(keys); while (environment.IsRunning) { for (int i = 0; i < keys.Length; i++) { keys[i].Process(); } yield return(null); } }
public IEnumerator TestKeyboard() { var environment = InputTestEnvironment.Create(); var inputManager = InputManager.Create(environment.Resolution, 0, 0); environment.SetInputManager(inputManager); environment.ListenToState(inputManager.GetKeys().Cast <IInput>()); while (environment.IsRunning) { if (Input.GetKey(KeyCode.RightShift)) { if (Input.GetKeyDown(KeyCode.Alpha1)) { inputManager.RemoveKey(KeyCode.A); Debug.Log("Removed key A"); } if (Input.GetKeyDown(KeyCode.Alpha2)) { inputManager.RemoveKey(KeyCode.S); Debug.Log("Removed key S"); } if (Input.GetKeyDown(KeyCode.Alpha3)) { inputManager.RemoveKey(KeyCode.D); Debug.Log("Removed key D"); } if (Input.GetKeyDown(KeyCode.Alpha4)) { inputManager.RemoveKey(KeyCode.F); Debug.Log("Removed key F"); } } else { if (Input.GetKeyDown(KeyCode.Alpha1)) { inputManager.AddKey(KeyCode.A); environment.ListenToState(inputManager.GetKeys().Cast <IInput>()); Debug.Log("Added key A"); } if (Input.GetKeyDown(KeyCode.Alpha2)) { inputManager.AddKey(KeyCode.S); environment.ListenToState(inputManager.GetKeys().Cast <IInput>()); Debug.Log("Added key S"); } if (Input.GetKeyDown(KeyCode.Alpha3)) { inputManager.AddKey(KeyCode.D); environment.ListenToState(inputManager.GetKeys().Cast <IInput>()); Debug.Log("Added key D"); } if (Input.GetKeyDown(KeyCode.Alpha4)) { inputManager.AddKey(KeyCode.F); environment.ListenToState(inputManager.GetKeys().Cast <IInput>()); Debug.Log("Added key F"); } } yield return(null); } }