Exemplo n.º 1
0
 /// <summary>
 /// Create a new base instance of an input device. The device manager
 /// needs to be passed in for updates.
 /// </summary>
 /// <param name="deviceManager">The device manager that owns this device.</param>
 /// <param name="inputPoller">The poller to check input state from.</param>
 /// <param name="enabled">If the control should start enabled or not.</param>
 protected InputDevice(IInputDeviceManager deviceManager, IInputPoller inputPoller)
 {
     DeviceManager = deviceManager;
     InputPoller   = inputPoller;
     DeviceManager.OnDeviceUpdate += DeviceManager_OnUpdate;
     Enabled = true;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create a new instance of the keyboard device. Only
 /// one is permitted at any time.
 /// </summary>
 /// <param name="deviceManager">The manager that owns this device.</param>
 /// <param name="inputPoller">The poller to check input state from.</param>
 public Keyboard(IInputDeviceManager deviceManager, IInputPoller inputPoller) : base(deviceManager, inputPoller)
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         throw new Exception("There is already a keyboard instance present. Did you call InputModule.GetDevice<Keyboard>()?");
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Create a new instance of the mouse device. Only one
        /// is permitted at any time.
        /// </summary>
        /// <param name="deviceManager">The manager that owns this device.</param>
        /// <param name="inputPoller">The poller to check input state from.</param>
        public Mouse(IInputDeviceManager deviceManager, IInputPoller inputPoller) : base(deviceManager, inputPoller)
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                throw new Exception("There is already a mouse instance present. Did you call InputModule.GetDevice<Mouse>()?");
            }

            Cursor = inputPoller.Cursor;
        }