Beispiel #1
0
        internal bool ProcessInput(InputArgs args)
        {
            if (MouseMove != null)
            {
                var eArgs = args as MouseMoveInputArgs;

                if (eArgs != null)
                    return MouseMove(eArgs);
            }

            if (MouseWheel != null)
            {
                var eArgs = args as MouseWheelInputArgs;

                if (eArgs != null)
                    return MouseWheel(eArgs);
            }

            if (Text != null)
            {
                var eArgs = args as TextInputArgs;

                if (eArgs != null)
                    return Text(eArgs);
            }

            var keyArgs = args as KeyInputArgs;
            if (keyArgs != null)
            {
                KeyEvent e;
                if (Key.TryGetValue(keyArgs.Key, out e))
                    return e(keyArgs);
            }

            var mouseArgs = args as MouseButtonInputArgs;
            if (mouseArgs != null)
            {
                MouseButtonEvent e;
                if (MouseButton.TryGetValue(mouseArgs.Button, out e))
                    return e(mouseArgs);
            }

            return false;
        }
Beispiel #2
0
        internal bool ProcessInput(InputArgs args)
        {
            if (MouseMove != null && args is MouseMoveInputArgs)
            {
                var eArgs = (MouseMoveInputArgs)args;
                return MouseMove(eArgs);
            }

            if (args is KeyInputArgs)
            {
                var eArgs = (KeyInputArgs)args;
                KeyEvent e;

                if (Key.TryGetValue(eArgs.Key, out e))
                    return e(eArgs);
            }
            else if (Text != null && args is TextInputArgs)
            {
                var tArgs = (TextInputArgs)args;
                return Text(tArgs);
            }
            else if (args is MouseButtonInputArgs)
            {
                var eArgs = (MouseButtonInputArgs)args;
                MouseButtonEvent e;

                if (MouseButton.TryGetValue(eArgs.Button, out e))
                    return e(eArgs);
            }
            else if (MouseWheel != null && args is MouseWheelInputArgs)
            {
                var eArgs = (MouseWheelInputArgs)args;
                return MouseWheel(eArgs);
            }

            return false;
        }
Beispiel #3
0
        private static void DispatchEvent(InputArgs args)
        {
            for (var i = states.Count - 1; i >= 0; i--)
            {
                var state = states[i];

                args.View = state.Camera.View;
                if (states[i].ProcessEvent(args))
                    return;
            }
        }
Beispiel #4
0
        private static void DispatchEvent(InputArgs args)
        {
            for (var i = StateStack.Count - 1; i >= 0; i--)
            {
                var state = StateStack[i];

                args.View = state.Camera.View;
                if ((state.IsActive || state.InactiveMode.HasFlag(State.UpdateMode.Input)) && state.ProcessEvent(args))
                    return;
            }
        }
Beispiel #5
0
 internal bool ProcessEvent(InputArgs args)
 {
     if (input != null && input.ProcessInput(args))
         return true;
     return Entities.ProcessInput(args);
 }
Beispiel #6
0
 public bool ProcessInput(InputArgs args)
 {
     return(inputEntities.Any(e => e.Input.ProcessInput(args)));
 }