Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name='event_struct'>
 ///
 /// </param>
 internal UserEventArgs(SdlSystem.SDL_Event event_struct) : base(event_struct)
 {
 }
Exemple #2
0
 /// <summary>
 /// Creates the event arguments.
 /// </summary>
 /// <returns>
 /// The event arguments.
 /// </returns>
 /// <param name='e'>
 /// The ${ParameterType} instance containing the event data.
 /// </param>
 /// <exception cref='NotImplementedException'>
 /// Is thrown when a requested operation is not implemented for a given type.
 /// </exception>
 public static new UserEventArgs CreateEventArgs(SdlSystem.SDL_Event e)
 {
     return(new UserEventArgs(e));
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Sdl.Core.WindowManagerEventArgs"/> class.
 /// </summary>
 /// <param name='ev'>
 /// Ev.
 /// </param>
 internal WindowManagerEventArgs(SdlSystem.SDL_Event ev) : base(ev)
 {
 }
Exemple #4
0
 /// <summary>
 /// Creates the event arguments.
 /// </summary>
 /// <returns>
 /// The event arguments.
 /// </returns>
 /// <param name='e'>
 /// The ${ParameterType} instance containing the event data.
 /// </param>
 /// <exception cref='NotImplementedException'>
 /// Is thrown when a requested operation is not implemented for a given type.
 /// </exception>
 public static new WindowManagerEventArgs CreateEventArgs(SdlSystem.SDL_Event e)
 {
     return(new WindowManagerEventArgs(e));
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Sdl.Core.ActiveEventArgs"/> class.
 /// </summary>
 /// <param name='ev'>
 /// Ev.
 /// </param>
 internal ActiveEventArgs(SdlSystem.SDL_Event ev) : base(ev)
 {
 }
Exemple #6
0
        /// <summary>
        /// Processes the event.
        /// </summary>
        /// <param name='e'>
        /// E.
        /// </param>
        private static void ProcessEvent(SdlSystem.SDL_Event e)
        {
            switch ((EventTypes)e.type)
            {
            case EventTypes.ActiveEvent:
                OnActiveEvent(ActiveEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.KeyDown:
                OnKeyboardDown(KeyboardEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.KeyUp:
                OnKeyboardUp(KeyboardEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.MouseMotion:
                OnMouseMotion(MouseMotionEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.MouseButtonDown:
                OnMouseButtonDown(MouseButtonEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.MouseButtonUp:
                OnMouseButtonUp(MouseButtonEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.JoystickAxisMotion:
                OnJoystickAxisMotion(JoystickAxisEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.JoystickBallMotion:
                OnJoystickBallMotion(JoystickBallEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.JoystickHatMotion:
                OnJoystickHatMotion(JoystickHatEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.JoystickButtonDown:
                OnJoystickButtonDown(JoystickButtonEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.JoystickButtonUp:
                OnJoystickButtonUp(JoystickButtonEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.VideoResize:
                OnVideoResize(VideoResizeEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.VideoExpose:
                OnVideoExpose(VideoExposeEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.Quit:
                OnQuit(QuitEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.WindowManagerEvent:
                OnWindowManagerEvent(WindowManagerEventArgs.CreateEventArgs(e));
                break;

            case EventTypes.UserEvent:
                OnUserEvent(UserEventArgs.CreateEventArgs(e));
                break;
            }
        }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Sdl.Core.SdlEventArgs"/> class.
 /// </summary>
 /// <param name='event_struct'>
 /// Event_struct.
 /// </param>
 internal SdlEventArgs(SdlSystem.SDL_Event event_struct)
 {
     this.event_struct_ = event_struct;
 }
Exemple #8
0
        public static SdlEventArgs[] Peek(EventMask event_mask, int number_of_events) {
            SdlSystem.SDL_Event[] events = new SdlSystem.SDL_Event[number_of_events];

            SdlSystem.SDL_PumpEvents();

            int ret = SdlSystem.SDL_PeepEvents( out events,
                                                events.Length,
                                                SdlSystem.SDL_eventaction.SDL_PEEKEVENT,
                                                (uint)event_mask );
            if ( ret == (int)NativeFunctionReturnFlags.Error )
                throw SdlException.Generate();

            SdlEventArgs[] eventargs_array = new SdlEventArgs[ret];
            for ( int i = 0; i < eventargs_array.Length; ++ i ) {
                if ( events[i].type == (byte)EventTypes.UserEvent ) {
                    eventargs_array[i] = __user_events[events[i].user.code.ToString()];
                    __user_events.Remove( events[i].user.code.ToString() );
                } else
                    eventargs_array[i] = SdlEventArgs.CreateEventArgs( events[i] );
            }
            return eventargs_array;
        }
Exemple #9
0
        public static void Remove(EventMask event_mask, int number_of_events) {
            SdlSystem.SDL_Event[] events = new SdlSystem.SDL_Event[number_of_events];

            SdlSystem.SDL_PumpEvents();

            int ret = SdlSystem.SDL_PeepEvents( out events,
                                                events.Length,
                                                SdlSystem.SDL_eventaction.SDL_GETEVENT,
                                                (uint)event_mask );
            if ( ret == (int)NativeFunctionReturnFlags.Error )
                throw SdlException.Generate();
        }