コード例 #1
0
ファイル: InputComponent.cs プロジェクト: Hengle/Engine-Nine
        /// <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();
        }
コード例 #2
0
ファイル: InputComponent.cs プロジェクト: Hengle/Engine-Nine
        /// <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();
        }
コード例 #3
0
        /// <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));
        }
コード例 #4
0
ファイル: InputComponent.cs プロジェクト: Hengle/Engine-Nine
 /// <summary>
 /// Creates a new instance of InputComponent.
 /// </summary>
 public InputComponent()
 {
     Current     = this;
     InputSource = new XnaInputSource();
     InitializeEvents();
 }