Module: RbSDL2::EventType
- Included in:
- Event
- Defined in:
- lib/rb_sdl2/event/event_type.rb
Constant Summary collapse
- COMMON_EVENT_TYPES =
::SDL::FIRSTEVENT.succ...::SDL::USEREVENT
- USER_EVENT_TYPES =
::SDL::USEREVENT...::SDL::LASTEVENT
- ENTITY_MAP =
Hash.new(&default_klass).merge!(table.map { |a| a.first(2) }.to_h).freeze
- NAME_MAP =
Hash.new.merge!(table.map { |c, _, s| [c, s.freeze] }.to_h).freeze
Class Method Summary collapse
- .disable(num) ⇒ Object
- .enable(num) ⇒ Object
- .ignore?(num) ⇒ Boolean
- .register_events(num) ⇒ Object
- .to_name(num) ⇒ Object
- .to_types(obj) ⇒ Object
Instance Method Summary collapse
- #app_did_enter_background? ⇒ Boolean
- #app_did_enter_foreground? ⇒ Boolean
- #app_low_memory? ⇒ Boolean
- #app_terminating? ⇒ Boolean
- #app_will_enter_background? ⇒ Boolean
- #app_will_enter_foreground? ⇒ Boolean
- #audio_device_added? ⇒ Boolean
- #audio_device_removed? ⇒ Boolean
- #clipboard_update? ⇒ Boolean
- #controller_axis_motion? ⇒ Boolean
- #controller_button_down? ⇒ Boolean
- #controller_button_up? ⇒ Boolean
- #controller_device_added? ⇒ Boolean
- #controller_device_remapped? ⇒ Boolean
- #controller_device_removed? ⇒ Boolean
- #controller_sensor_update? ⇒ Boolean
- #controller_touchpad_down? ⇒ Boolean
- #controller_touchpad_motion? ⇒ Boolean
- #controller_touchpad_up? ⇒ Boolean
- #display_event? ⇒ Boolean
- #dollar_gesture? ⇒ Boolean
- #dollar_record? ⇒ Boolean
- #drop_begin? ⇒ Boolean
- #drop_complete? ⇒ Boolean
- #drop_file? ⇒ Boolean
- #drop_text? ⇒ Boolean
- #finger_down? ⇒ Boolean
- #finger_motion? ⇒ Boolean
- #finger_up? ⇒ Boolean
- #joy_axis_motion? ⇒ Boolean
- #joy_ball_motion? ⇒ Boolean
- #joy_button_down? ⇒ Boolean
- #joy_button_up? ⇒ Boolean
- #joy_device_added? ⇒ Boolean
- #joy_device_removed? ⇒ Boolean
- #joy_hat_motion? ⇒ Boolean
- #key_down? ⇒ Boolean
- #key_up? ⇒ Boolean
- #keymap_changed? ⇒ Boolean
- #locale_changed? ⇒ Boolean
- #mouse_button_down? ⇒ Boolean
- #mouse_button_up? ⇒ Boolean
- #mouse_motion? ⇒ Boolean
- #mouse_wheel? ⇒ Boolean
- #multi_gesture? ⇒ Boolean
- #poll_sentinel? ⇒ Boolean
- #quit? ⇒ Boolean
- #render_device_reset? ⇒ Boolean
- #render_targets_reset? ⇒ Boolean
- #sensor_update? ⇒ Boolean
- #sys_wm_event? ⇒ Boolean
- #text_editing? ⇒ Boolean
- #text_editing_ext? ⇒ Boolean
- #text_input? ⇒ Boolean
- #user_event? ⇒ Boolean
- #window_event? ⇒ Boolean
Class Method Details
.disable(num) ⇒ Object
71 |
# File 'lib/rb_sdl2/event/event_type.rb', line 71 def disable(num) = ::SDL.EventState(num, ::SDL::DISABLE) == ::SDL::ENABLE |
.enable(num) ⇒ Object
73 |
# File 'lib/rb_sdl2/event/event_type.rb', line 73 def enable(num) = ::SDL.EventState(num, ::SDL::ENABLE) == ::SDL::DISABLE |
.ignore?(num) ⇒ Boolean
75 |
# File 'lib/rb_sdl2/event/event_type.rb', line 75 def ignore?(num) = ::SDL.EventState(num, ::SDL::QUERY) == ::SDL::IGNORE |
.register_events(num) ⇒ Object
77 78 79 80 81 |
# File 'lib/rb_sdl2/event/event_type.rb', line 77 def register_events(num) if ::SDL.RegisterEvents(num) == 0xFFFFFFFF raise RbSDL2Error, "unable to register user events because too many requests" end end |
.to_name(num) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/rb_sdl2/event/event_type.rb', line 83 def to_name(num) case num when COMMON_EVENT_TYPES then NAME_MAP[num] when USER_EVENT_TYPES then "SDL_USEREVENT".freeze else nil end end |
.to_types(obj) ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'lib/rb_sdl2/event/event_type.rb', line 91 def to_types(obj) case obj when nil then [::SDL::FIRSTEVENT, ::SDL::LASTEVENT] when Integer then [obj, obj] when Range then obj.minmax else raise ArgumentError end end |
Instance Method Details
#app_did_enter_background? ⇒ Boolean
101 |
# File 'lib/rb_sdl2/event/event_type.rb', line 101 def app_did_enter_background? = ::SDL::APP_DIDENTERBACKGROUND == type |
#app_did_enter_foreground? ⇒ Boolean
103 |
# File 'lib/rb_sdl2/event/event_type.rb', line 103 def app_did_enter_foreground? = ::SDL::APP_DIDENTERFOREGROUND == type |
#app_low_memory? ⇒ Boolean
105 |
# File 'lib/rb_sdl2/event/event_type.rb', line 105 def app_low_memory? = ::SDL::APP_LOWMEMORY == type |
#app_terminating? ⇒ Boolean
107 |
# File 'lib/rb_sdl2/event/event_type.rb', line 107 def app_terminating? = ::SDL::APP_TERMINATING == type |
#app_will_enter_background? ⇒ Boolean
109 |
# File 'lib/rb_sdl2/event/event_type.rb', line 109 def app_will_enter_background? = ::SDL::APP_WILLENTERBACKGROUND == type |
#app_will_enter_foreground? ⇒ Boolean
111 |
# File 'lib/rb_sdl2/event/event_type.rb', line 111 def app_will_enter_foreground? = ::SDL::APP_WILLENTERFOREGROUND == type |
#audio_device_added? ⇒ Boolean
113 |
# File 'lib/rb_sdl2/event/event_type.rb', line 113 def audio_device_added? = ::SDL::AUDIODEVICEADDED == type |
#audio_device_removed? ⇒ Boolean
115 |
# File 'lib/rb_sdl2/event/event_type.rb', line 115 def audio_device_removed? = ::SDL::AUDIODEVICEREMOVED == type |
#clipboard_update? ⇒ Boolean
117 |
# File 'lib/rb_sdl2/event/event_type.rb', line 117 def clipboard_update? = ::SDL::CLIPBOARDUPDATE == type |
#controller_axis_motion? ⇒ Boolean
119 |
# File 'lib/rb_sdl2/event/event_type.rb', line 119 def controller_axis_motion? = ::SDL::CONTROLLERAXISMOTION == type |
#controller_button_down? ⇒ Boolean
121 |
# File 'lib/rb_sdl2/event/event_type.rb', line 121 def = ::SDL::CONTROLLERBUTTONDOWN == type |
#controller_button_up? ⇒ Boolean
123 |
# File 'lib/rb_sdl2/event/event_type.rb', line 123 def = ::SDL::CONTROLLERBUTTONUP == type |
#controller_device_added? ⇒ Boolean
125 |
# File 'lib/rb_sdl2/event/event_type.rb', line 125 def controller_device_added? = ::SDL::CONTROLLERDEVICEADDED == type |
#controller_device_remapped? ⇒ Boolean
127 |
# File 'lib/rb_sdl2/event/event_type.rb', line 127 def controller_device_remapped? = ::SDL::CONTROLLERDEVICEREMAPPED == type |
#controller_device_removed? ⇒ Boolean
129 |
# File 'lib/rb_sdl2/event/event_type.rb', line 129 def controller_device_removed? = ::SDL::CONTROLLERDEVICEREMOVED == type |
#controller_sensor_update? ⇒ Boolean
131 |
# File 'lib/rb_sdl2/event/event_type.rb', line 131 def controller_sensor_update? = ::SDL::CONTROLLERSENSORUPDATE == type |
#controller_touchpad_down? ⇒ Boolean
133 |
# File 'lib/rb_sdl2/event/event_type.rb', line 133 def controller_touchpad_down? = ::SDL::CONTROLLERTOUCHPADDOWN == type |
#controller_touchpad_motion? ⇒ Boolean
135 |
# File 'lib/rb_sdl2/event/event_type.rb', line 135 def controller_touchpad_motion? = ::SDL::CONTROLLERTOUCHPADMOTION == type |
#controller_touchpad_up? ⇒ Boolean
137 |
# File 'lib/rb_sdl2/event/event_type.rb', line 137 def controller_touchpad_up? = ::SDL::CONTROLLERTOUCHPADUP == type |
#display_event? ⇒ Boolean
139 |
# File 'lib/rb_sdl2/event/event_type.rb', line 139 def display_event? = ::SDL::DISPLAYEVENT == type |
#dollar_gesture? ⇒ Boolean
141 |
# File 'lib/rb_sdl2/event/event_type.rb', line 141 def dollar_gesture? = ::SDL::DOLLARGESTURE == type |
#dollar_record? ⇒ Boolean
143 |
# File 'lib/rb_sdl2/event/event_type.rb', line 143 def dollar_record? = ::SDL::DOLLARRECORD == type |
#drop_begin? ⇒ Boolean
145 |
# File 'lib/rb_sdl2/event/event_type.rb', line 145 def drop_begin? = ::SDL::DROPBEGIN == type |
#drop_complete? ⇒ Boolean
147 |
# File 'lib/rb_sdl2/event/event_type.rb', line 147 def drop_complete? = ::SDL::DROPCOMPLETE == type |
#drop_file? ⇒ Boolean
149 |
# File 'lib/rb_sdl2/event/event_type.rb', line 149 def drop_file? = ::SDL::DROPFILE == type |
#drop_text? ⇒ Boolean
151 |
# File 'lib/rb_sdl2/event/event_type.rb', line 151 def drop_text? = ::SDL::DROPTEXT == type |
#finger_down? ⇒ Boolean
153 |
# File 'lib/rb_sdl2/event/event_type.rb', line 153 def finger_down? = ::SDL::FINGERDOWN == type |
#finger_motion? ⇒ Boolean
155 |
# File 'lib/rb_sdl2/event/event_type.rb', line 155 def finger_motion? = ::SDL::FINGERMOTION == type |
#finger_up? ⇒ Boolean
157 |
# File 'lib/rb_sdl2/event/event_type.rb', line 157 def finger_up? = ::SDL::FINGERUP == type |
#joy_axis_motion? ⇒ Boolean
159 |
# File 'lib/rb_sdl2/event/event_type.rb', line 159 def joy_axis_motion? = ::SDL::JOYAXISMOTION == type |
#joy_ball_motion? ⇒ Boolean
161 |
# File 'lib/rb_sdl2/event/event_type.rb', line 161 def joy_ball_motion? = ::SDL::JOYBALLMOTION == type |
#joy_button_down? ⇒ Boolean
163 |
# File 'lib/rb_sdl2/event/event_type.rb', line 163 def = ::SDL::JOYBUTTONDOWN == type |
#joy_button_up? ⇒ Boolean
165 |
# File 'lib/rb_sdl2/event/event_type.rb', line 165 def = ::SDL::JOYBUTTONUP == type |
#joy_device_added? ⇒ Boolean
167 |
# File 'lib/rb_sdl2/event/event_type.rb', line 167 def joy_device_added? = ::SDL::JOYDEVICEADDED == type |
#joy_device_removed? ⇒ Boolean
169 |
# File 'lib/rb_sdl2/event/event_type.rb', line 169 def joy_device_removed? = ::SDL::JOYDEVICEREMOVED == type |
#joy_hat_motion? ⇒ Boolean
171 |
# File 'lib/rb_sdl2/event/event_type.rb', line 171 def joy_hat_motion? = ::SDL::JOYHATMOTION == type |
#key_down? ⇒ Boolean
173 |
# File 'lib/rb_sdl2/event/event_type.rb', line 173 def key_down? = ::SDL::KEYDOWN == type |
#key_up? ⇒ Boolean
175 |
# File 'lib/rb_sdl2/event/event_type.rb', line 175 def key_up? = ::SDL::KEYUP == type |
#keymap_changed? ⇒ Boolean
177 |
# File 'lib/rb_sdl2/event/event_type.rb', line 177 def keymap_changed? = ::SDL::KEYMAPCHANGED == type |
#locale_changed? ⇒ Boolean
179 |
# File 'lib/rb_sdl2/event/event_type.rb', line 179 def locale_changed? = ::SDL::LOCALECHANGED == type |
#mouse_button_down? ⇒ Boolean
183 |
# File 'lib/rb_sdl2/event/event_type.rb', line 183 def = ::SDL::MOUSEBUTTONDOWN == type |
#mouse_button_up? ⇒ Boolean
185 |
# File 'lib/rb_sdl2/event/event_type.rb', line 185 def = ::SDL::MOUSEBUTTONUP == type |
#mouse_motion? ⇒ Boolean
187 |
# File 'lib/rb_sdl2/event/event_type.rb', line 187 def mouse_motion? = ::SDL::MOUSEMOTION == type |
#mouse_wheel? ⇒ Boolean
189 |
# File 'lib/rb_sdl2/event/event_type.rb', line 189 def mouse_wheel? = ::SDL::MOUSEWHEEL == type |
#multi_gesture? ⇒ Boolean
181 |
# File 'lib/rb_sdl2/event/event_type.rb', line 181 def multi_gesture? = ::SDL::MULTIGESTURE == type |
#poll_sentinel? ⇒ Boolean
191 |
# File 'lib/rb_sdl2/event/event_type.rb', line 191 def poll_sentinel? = ::SDL::POLLSENTINEL == type |
#quit? ⇒ Boolean
193 |
# File 'lib/rb_sdl2/event/event_type.rb', line 193 def quit? = ::SDL::QUIT == type |
#render_device_reset? ⇒ Boolean
195 |
# File 'lib/rb_sdl2/event/event_type.rb', line 195 def render_device_reset? = ::SDL::RENDER_DEVICE_RESET == type |
#render_targets_reset? ⇒ Boolean
197 |
# File 'lib/rb_sdl2/event/event_type.rb', line 197 def render_targets_reset? = ::SDL::RENDER_TARGETS_RESET == type |
#sensor_update? ⇒ Boolean
199 |
# File 'lib/rb_sdl2/event/event_type.rb', line 199 def sensor_update? = ::SDL::SENSORUPDATE == type |
#sys_wm_event? ⇒ Boolean
201 |
# File 'lib/rb_sdl2/event/event_type.rb', line 201 def sys_wm_event? = ::SDL::SYSWMEVENT == type |
#text_editing? ⇒ Boolean
203 |
# File 'lib/rb_sdl2/event/event_type.rb', line 203 def text_editing? = ::SDL::TEXTEDITING == type |
#text_editing_ext? ⇒ Boolean
205 |
# File 'lib/rb_sdl2/event/event_type.rb', line 205 def text_editing_ext? = ::SDL::TEXTEDITING_EXT == type |
#text_input? ⇒ Boolean
207 |
# File 'lib/rb_sdl2/event/event_type.rb', line 207 def text_input? = ::SDL::TEXTINPUT == type |
#user_event? ⇒ Boolean
209 |
# File 'lib/rb_sdl2/event/event_type.rb', line 209 def user_event? = USER_EVENT_TYPES === type |
#window_event? ⇒ Boolean
211 |
# File 'lib/rb_sdl2/event/event_type.rb', line 211 def window_event? = ::SDL::WINDOWEVENT == type |