Пример #1
0
        /// <summary>
        /// Constructor takes the input handler to use and an enumearble over the layer keys in order that they should be processed
        /// </summary>
        /// <param name="inputHandler">The input handler to use.</param>
        public EventManager(InputHandler inputHandler, IEnumerable layerKeys)
        {
            this.inputHandler = inputHandler;
            keyboard          = new Keyboard();
            keyboardHardware  = inputHandler.createKeyboard(keyboard);
            mouse             = new Mouse(this);
            mouseHardware     = inputHandler.createMouse(mouse);
            touches           = new Touches();
            touchHardware     = inputHandler.createTouchHardware(touches);

            pad1         = new Gamepad(this, GamepadId.Pad1);
            pad2         = new Gamepad(this, GamepadId.Pad2);
            pad3         = new Gamepad(this, GamepadId.Pad3);
            pad4         = new Gamepad(this, GamepadId.Pad4);
            pad1Hardware = inputHandler.createGamepad(pad1);
            pad2Hardware = inputHandler.createGamepad(pad2);
            pad3Hardware = inputHandler.createGamepad(pad3);
            pad4Hardware = inputHandler.createGamepad(pad4);

            foreach (object key in layerKeys)
            {
                eventLayers.Add(key, new EventLayer(this));
            }

            DefaultEvents.registerEventManager(this);
        }
Пример #2
0
 public TouchHardware(Touches touches)
 {
     this.touches = touches;
 }
Пример #3
0
 /// <summary>
 /// Create touch hardware for the EventManager, if touch hardware cannot be supported, return null.
 /// </summary>
 /// <param name="touches"></param>
 /// <returns></returns>
 public abstract TouchHardware createTouchHardware(Touches touches);