/// <summary> /// Creates a new instance of InputComponent using the input system of windows forms. /// </summary> /// <param name="handle">Handle of the game window</param> public InputComponent(IntPtr handle) { Current = this; #if WINDOWS InputSource = new WindowsInputSource(handle); #else InputSource = new XnaInputSource(); #endif InitializeEvents(); }
/// <summary> /// Initializes a new instance of the <see cref="InputComponent"/> class. /// </summary> public InputComponent(IInputSource inputSource) { if (inputSource == null) { throw new ArgumentNullException("inputSource"); } Current = this; this.InputSource = inputSource; InitializeEvents(); }
/// <summary> /// Creates a new instance of Input. /// </summary> public Input(InputComponent component) { if (Nine.Serialization.ContentProperties.IsContentBuild) { return; } if (component == null) { throw new InvalidOperationException( "InputComponent must not be null, do you forget to add an InputComponent to the game's component collection?"); } Component = component; Enabled = true; component.inputs.Add(new WeakReference(this)); }
/// <summary> /// Creates a new instance of InputComponent. /// </summary> public InputComponent() { Current = this; InputSource = new XnaInputSource(); InitializeEvents(); }