Module: RbSDL2::Event::EventType
- Included in:
- RbSDL2::Event
- Defined in:
- lib/rb_sdl2/event/event_type.rb
Constant Summary collapse
- RANGE =
::SDL2::SDL_FIRSTEVENT..::SDL2::SDL_LASTEVENT
- EVENT_TYPES =
RANGE.first.succ...::SDL2::SDL_LASTEVENT
- COMMON_EVENT_TYPES =
EVENT_TYPES.first...::SDL2::SDL_USEREVENT
- USER_EVENT_TYPES =
::SDL2::SDL_USEREVENT...EVENT_TYPES.last
- MEMBER_MAP =
Hash.new(&default_type).merge!( ::SDL2::SDL_AUDIODEVICEADDED => :adevice, ::SDL2::SDL_AUDIODEVICEREMOVED => :adevice, ::SDL2::SDL_DISPLAYEVENT => :display, ::SDL2::SDL_KEYDOWN => :key, ::SDL2::SDL_KEYUP => :key, ::SDL2::SDL_CONTROLLERAXISMOTION => :caxis, ::SDL2::SDL_CONTROLLERBUTTONDOWN => :cbutton, ::SDL2::SDL_CONTROLLERBUTTONUP => :cbutton, ::SDL2::SDL_CONTROLLERDEVICEADDED => :cdevice, ::SDL2::SDL_CONTROLLERDEVICEREMAPPED => :cdevice, ::SDL2::SDL_CONTROLLERDEVICEREMOVED => :cdevice, ::SDL2::SDL_CONTROLLERSENSORUPDATE => :csensor, ::SDL2::SDL_CONTROLLERTOUCHPADDOWN => :ctouchpad, ::SDL2::SDL_CONTROLLERTOUCHPADMOTION => :ctouchpad, ::SDL2::SDL_CONTROLLERTOUCHPADUP => :ctouchpad, ::SDL2::SDL_DOLLARGESTURE => :dgesture, ::SDL2::SDL_DOLLARRECORD => :dgesture, ::SDL2::SDL_DROPBEGIN => :drop, ::SDL2::SDL_DROPCOMPLETE => :drop, ::SDL2::SDL_DROPFILE => :drop, ::SDL2::SDL_DROPTEXT => :drop, ::SDL2::SDL_FINGERDOWN => :tfinger, ::SDL2::SDL_FINGERMOTION => :tfinger, ::SDL2::SDL_FINGERUP => :tfinger, ::SDL2::SDL_JOYAXISMOTION => :jaxis, ::SDL2::SDL_JOYBALLMOTION => :jball, ::SDL2::SDL_JOYBUTTONDOWN => :jbutton, ::SDL2::SDL_JOYBUTTONUP => :jbutton, ::SDL2::SDL_JOYDEVICEADDED => :jdevice, ::SDL2::SDL_JOYDEVICEREMOVED => :jdevice, ::SDL2::SDL_JOYHATMOTION => :jhat, ::SDL2::SDL_MOUSEBUTTONDOWN => :button, ::SDL2::SDL_MOUSEBUTTONUP => :button, ::SDL2::SDL_MOUSEMOTION => :motion, ::SDL2::SDL_MOUSEWHEEL => :wheel, ::SDL2::SDL_MULTIGESTURE => :mgesture, ::SDL2::SDL_QUIT => :quit, ::SDL2::SDL_SENSORUPDATE => :sensor, ::SDL2::SDL_SYSWMEVENT => :syswm, ::SDL2::SDL_TEXTEDITING => :edit, ::SDL2::SDL_TEXTINPUT => :text, ::SDL2::SDL_WINDOWEVENT => :window, ).freeze
Class Method Summary collapse
- .define_user_event(name = "user_event") ⇒ Object
- .disable(type) ⇒ Object
- .enable(type) ⇒ Object
- .ignore?(type) ⇒ Boolean
- .minmax ⇒ Object
- .to_name(num) ⇒ Object
- .to_num(obj) ⇒ Object
- .to_type(num) ⇒ 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
- #quit? ⇒ Boolean
- #render_device_reset? ⇒ Boolean
- #render_targets_reset? ⇒ Boolean
- #sensor_update? ⇒ Boolean
- #sys_wm_event? ⇒ Boolean
- #text_editing? ⇒ Boolean
- #text_input? ⇒ Boolean
- #user_event? ⇒ Boolean
- #window_event? ⇒ Boolean
Class Method Details
.define_user_event(name = "user_event") ⇒ Object
132 133 134 135 136 137 138 139 140 141 |
# File 'lib/rb_sdl2/event/event_type.rb', line 132 def define_user_event(name = "user_event") @mutex.synchronize do num = ::SDL2::SDL_RegisterEvents(1) if num == 0xFFFFFFFF raise RbSDL2Error, "unable to register user events because too many requests" end @name_map[num] = name num end end |
.disable(type) ⇒ Object
143 |
# File 'lib/rb_sdl2/event/event_type.rb', line 143 def disable(type) = ::SDL2.SDL_EventState(type, ::SDL2::SDL_DISABLE) == ::SDL2::SDL_ENABLE |
.enable(type) ⇒ Object
145 |
# File 'lib/rb_sdl2/event/event_type.rb', line 145 def enable(type) = ::SDL2.SDL_EventState(type, ::SDL2::SDL_ENABLE) == ::SDL2::SDL_DISABLE |
.ignore?(type) ⇒ Boolean
147 |
# File 'lib/rb_sdl2/event/event_type.rb', line 147 def ignore?(type) = ::SDL2.SDL_EventState(type, ::SDL2::SDL_QUERY) == ::SDL2::SDL_IGNORE |
.minmax ⇒ Object
149 |
# File 'lib/rb_sdl2/event/event_type.rb', line 149 def minmax = RANGE.minmax |
.to_name(num) ⇒ Object
151 |
# File 'lib/rb_sdl2/event/event_type.rb', line 151 def to_name(num) = @name_map[num] |
.to_num(obj) ⇒ Object
153 154 155 156 157 |
# File 'lib/rb_sdl2/event/event_type.rb', line 153 def to_num(obj) num = @name_map.key(obj.to_s) raise ArgumentError unless num num end |
.to_type(num) ⇒ Object
159 |
# File 'lib/rb_sdl2/event/event_type.rb', line 159 def to_type(num) = MEMBER_MAP[num] |
Instance Method Details
#app_did_enter_background? ⇒ Boolean
162 |
# File 'lib/rb_sdl2/event/event_type.rb', line 162 def app_did_enter_background? = ::SDL2::SDL_APP_DIDENTERBACKGROUND == type |
#app_did_enter_foreground? ⇒ Boolean
164 |
# File 'lib/rb_sdl2/event/event_type.rb', line 164 def app_did_enter_foreground? = ::SDL2::SDL_APP_DIDENTERFOREGROUND == type |
#app_low_memory? ⇒ Boolean
166 |
# File 'lib/rb_sdl2/event/event_type.rb', line 166 def app_low_memory? = ::SDL2::SDL_APP_LOWMEMORY == type |
#app_terminating? ⇒ Boolean
168 |
# File 'lib/rb_sdl2/event/event_type.rb', line 168 def app_terminating? = ::SDL2::SDL_APP_TERMINATING == type |
#app_will_enter_background? ⇒ Boolean
170 |
# File 'lib/rb_sdl2/event/event_type.rb', line 170 def app_will_enter_background? = ::SDL2::SDL_APP_WILLENTERBACKGROUND == type |
#app_will_enter_foreground? ⇒ Boolean
172 |
# File 'lib/rb_sdl2/event/event_type.rb', line 172 def app_will_enter_foreground? = ::SDL2::SDL_APP_WILLENTERFOREGROUND == type |
#audio_device_added? ⇒ Boolean
174 |
# File 'lib/rb_sdl2/event/event_type.rb', line 174 def audio_device_added? = ::SDL2::SDL_AUDIODEVICEADDED == type |
#audio_device_removed? ⇒ Boolean
176 |
# File 'lib/rb_sdl2/event/event_type.rb', line 176 def audio_device_removed? = ::SDL2::SDL_AUDIODEVICEREMOVED == type |
#clipboard_update? ⇒ Boolean
178 |
# File 'lib/rb_sdl2/event/event_type.rb', line 178 def clipboard_update? = ::SDL2::SDL_CLIPBOARDUPDATE == type |
#controller_axis_motion? ⇒ Boolean
180 |
# File 'lib/rb_sdl2/event/event_type.rb', line 180 def controller_axis_motion? = ::SDL2::SDL_CONTROLLERAXISMOTION == type |
#controller_button_down? ⇒ Boolean
182 |
# File 'lib/rb_sdl2/event/event_type.rb', line 182 def = ::SDL2::SDL_CONTROLLERBUTTONDOWN == type |
#controller_button_up? ⇒ Boolean
184 |
# File 'lib/rb_sdl2/event/event_type.rb', line 184 def = ::SDL2::SDL_CONTROLLERBUTTONUP == type |
#controller_device_added? ⇒ Boolean
186 |
# File 'lib/rb_sdl2/event/event_type.rb', line 186 def controller_device_added? = ::SDL2::SDL_CONTROLLERDEVICEADDED == type |
#controller_device_remapped? ⇒ Boolean
188 |
# File 'lib/rb_sdl2/event/event_type.rb', line 188 def controller_device_remapped? = ::SDL2::SDL_CONTROLLERDEVICEREMAPPED == type |
#controller_device_removed? ⇒ Boolean
190 |
# File 'lib/rb_sdl2/event/event_type.rb', line 190 def controller_device_removed? = ::SDL2::SDL_CONTROLLERDEVICEREMOVED == type |
#controller_sensor_update? ⇒ Boolean
192 |
# File 'lib/rb_sdl2/event/event_type.rb', line 192 def controller_sensor_update? = ::SDL2::SDL_CONTROLLERSENSORUPDATE == type |
#controller_touchpad_down? ⇒ Boolean
194 |
# File 'lib/rb_sdl2/event/event_type.rb', line 194 def controller_touchpad_down? = ::SDL2::SDL_CONTROLLERTOUCHPADDOWN == type |
#controller_touchpad_motion? ⇒ Boolean
196 |
# File 'lib/rb_sdl2/event/event_type.rb', line 196 def controller_touchpad_motion? = ::SDL2::SDL_CONTROLLERTOUCHPADMOTION == type |
#controller_touchpad_up? ⇒ Boolean
198 |
# File 'lib/rb_sdl2/event/event_type.rb', line 198 def controller_touchpad_up? = ::SDL2::SDL_CONTROLLERTOUCHPADUP == type |
#display_event? ⇒ Boolean
200 |
# File 'lib/rb_sdl2/event/event_type.rb', line 200 def display_event? = ::SDL2::SDL_DISPLAYEVENT == type |
#dollar_gesture? ⇒ Boolean
202 |
# File 'lib/rb_sdl2/event/event_type.rb', line 202 def dollar_gesture? = ::SDL2::SDL_DOLLARGESTURE == type |
#dollar_record? ⇒ Boolean
204 |
# File 'lib/rb_sdl2/event/event_type.rb', line 204 def dollar_record? = ::SDL2::SDL_DOLLARRECORD == type |
#drop_begin? ⇒ Boolean
206 |
# File 'lib/rb_sdl2/event/event_type.rb', line 206 def drop_begin? = ::SDL2::SDL_DROPBEGIN == type |
#drop_complete? ⇒ Boolean
208 |
# File 'lib/rb_sdl2/event/event_type.rb', line 208 def drop_complete? = ::SDL2::SDL_DROPCOMPLETE == type |
#drop_file? ⇒ Boolean
210 |
# File 'lib/rb_sdl2/event/event_type.rb', line 210 def drop_file? = ::SDL2::SDL_DROPFILE == type |
#drop_text? ⇒ Boolean
212 |
# File 'lib/rb_sdl2/event/event_type.rb', line 212 def drop_text? = ::SDL2::SDL_DROPTEXT == type |
#finger_down? ⇒ Boolean
214 |
# File 'lib/rb_sdl2/event/event_type.rb', line 214 def finger_down? = ::SDL2::SDL_FINGERDOWN == type |
#finger_motion? ⇒ Boolean
218 |
# File 'lib/rb_sdl2/event/event_type.rb', line 218 def finger_motion? = ::SDL2::SDL_FINGERMOTION == type |
#finger_up? ⇒ Boolean
216 |
# File 'lib/rb_sdl2/event/event_type.rb', line 216 def finger_up? = ::SDL2::SDL_FINGERUP == type |
#joy_axis_motion? ⇒ Boolean
220 |
# File 'lib/rb_sdl2/event/event_type.rb', line 220 def joy_axis_motion? = ::SDL2::SDL_JOYAXISMOTION == type |
#joy_ball_motion? ⇒ Boolean
222 |
# File 'lib/rb_sdl2/event/event_type.rb', line 222 def joy_ball_motion? = ::SDL2::SDL_JOYBALLMOTION == type |
#joy_button_down? ⇒ Boolean
224 |
# File 'lib/rb_sdl2/event/event_type.rb', line 224 def = ::SDL2::SDL_JOYBUTTONDOWN == type |
#joy_button_up? ⇒ Boolean
226 |
# File 'lib/rb_sdl2/event/event_type.rb', line 226 def = ::SDL2::SDL_JOYBUTTONUP == type |
#joy_device_added? ⇒ Boolean
228 |
# File 'lib/rb_sdl2/event/event_type.rb', line 228 def joy_device_added? = ::SDL2::SDL_JOYDEVICEADDED == type |
#joy_device_removed? ⇒ Boolean
230 |
# File 'lib/rb_sdl2/event/event_type.rb', line 230 def joy_device_removed? = ::SDL2::SDL_JOYDEVICEREMOVED == type |
#joy_hat_motion? ⇒ Boolean
232 |
# File 'lib/rb_sdl2/event/event_type.rb', line 232 def joy_hat_motion? = ::SDL2::SDL_JOYHATMOTION == type |
#key_down? ⇒ Boolean
234 |
# File 'lib/rb_sdl2/event/event_type.rb', line 234 def key_down? = ::SDL2::SDL_KEYDOWN == type |
#key_up? ⇒ Boolean
236 |
# File 'lib/rb_sdl2/event/event_type.rb', line 236 def key_up? = ::SDL2::SDL_KEYUP == type |
#keymap_changed? ⇒ Boolean
238 |
# File 'lib/rb_sdl2/event/event_type.rb', line 238 def keymap_changed? = ::SDL2::SDL_KEYMAPCHANGED == type |
#locale_changed? ⇒ Boolean
240 |
# File 'lib/rb_sdl2/event/event_type.rb', line 240 def locale_changed? = ::SDL2::SDL_LOCALECHANGED == type |
#mouse_button_down? ⇒ Boolean
244 |
# File 'lib/rb_sdl2/event/event_type.rb', line 244 def = ::SDL2::SDL_MOUSEBUTTONDOWN == type |
#mouse_button_up? ⇒ Boolean
246 |
# File 'lib/rb_sdl2/event/event_type.rb', line 246 def = ::SDL2::SDL_MOUSEBUTTONUP == type |
#mouse_motion? ⇒ Boolean
248 |
# File 'lib/rb_sdl2/event/event_type.rb', line 248 def mouse_motion? = ::SDL2::SDL_MOUSEMOTION == type |
#mouse_wheel? ⇒ Boolean
250 |
# File 'lib/rb_sdl2/event/event_type.rb', line 250 def mouse_wheel? = ::SDL2::SDL_MOUSEWHEEL == type |
#multi_gesture? ⇒ Boolean
242 |
# File 'lib/rb_sdl2/event/event_type.rb', line 242 def multi_gesture? = ::SDL2::SDL_MULTIGESTURE == type |
#quit? ⇒ Boolean
252 |
# File 'lib/rb_sdl2/event/event_type.rb', line 252 def quit? = ::SDL2::SDL_QUIT == type |
#render_device_reset? ⇒ Boolean
254 |
# File 'lib/rb_sdl2/event/event_type.rb', line 254 def render_device_reset? = ::SDL2::SDL_RENDER_DEVICE_RESET == type |
#render_targets_reset? ⇒ Boolean
256 |
# File 'lib/rb_sdl2/event/event_type.rb', line 256 def render_targets_reset? = ::SDL2::SDL_RENDER_TARGETS_RESET == type |
#sensor_update? ⇒ Boolean
258 |
# File 'lib/rb_sdl2/event/event_type.rb', line 258 def sensor_update? = ::SDL2::SDL_SENSORUPDATE == type |
#sys_wm_event? ⇒ Boolean
260 |
# File 'lib/rb_sdl2/event/event_type.rb', line 260 def sys_wm_event? = ::SDL2::SDL_SYSWMEVENT == type |
#text_editing? ⇒ Boolean
262 |
# File 'lib/rb_sdl2/event/event_type.rb', line 262 def text_editing? = ::SDL2::SDL_TEXTEDITING == type |
#text_input? ⇒ Boolean
264 |
# File 'lib/rb_sdl2/event/event_type.rb', line 264 def text_input? = ::SDL2::SDL_TEXTINPUT == type |
#user_event? ⇒ Boolean
266 |
# File 'lib/rb_sdl2/event/event_type.rb', line 266 def user_event? = USER_EVENT_TYPES === type |
#window_event? ⇒ Boolean
268 |
# File 'lib/rb_sdl2/event/event_type.rb', line 268 def window_event? = ::SDL2::SDL_WINDOWEVENT == type |