Ejemplo n.º 1
0
        public void GenerateCommands()
        {
            if (Disposed)
            {
                throw new ObjectDisposedException("Attempted to access InputHandler after object is disposed!");
            }

            MouseCommands.Clear();
            KeyCommands.Clear();

            MousePosition = MouseHistory[0].Position;
            for (Byte a = 0; a < MouseListeners.Count; a++)
            {
                switch (MouseListeners[a])
                {
                case MouseKeys.LeftButton:
                    HandleLeftMouseButton();
                    break;

                case MouseKeys.MiddleButton:
                    HandleMiddleMouseButton();
                    break;

                case MouseKeys.RightButton:
                    HandleRightMouseButton();
                    break;
                }
            }
            for (Int16 b = 0; b < KeyboardListeners.Count; b++)
            {
                HandleKeyboardButton(KeyboardListeners[b]);
            }
        }
Ejemplo n.º 2
0
        public void Dispose()
        {
            if (Disposed)
            {
                return;
            }

            MouseHistory.Dispose();
            KeyboardHistory.Dispose();
            MouseListeners.Clear();
            KeyboardListeners.Clear();
            MouseCommands.Clear();
            KeyCommands.Clear();
            Disposed = true;
        }