Example #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);
        }
Example #2
0
 /// <summary>
 /// Destroys the given keyboard.  The keyboard will be disposed after this function
 /// call and you will no longer be able to use it.
 /// </summary>
 /// <param name="keyboard">The keyboard to destroy.</param>
 public abstract void destroyKeyboard(KeyboardHardware keyboard);