class RbSDL2::Mouse::MouseWheel
Constants
- MOUSE_WHEEL_EVENT_WATCH
Attributes
timestamp[R]
x[R]
y[R]
Public Class Methods
new()
click to toggle source
# File lib/rb_sdl2/mouse/mouse_wheel.rb, line 35 def initialize @timestamp = @x = @y = 0 end
wheel=(bool)
click to toggle source
# File lib/rb_sdl2/mouse/mouse_wheel.rb, line 21 def wheel=(bool) @mutex.synchronize do if bool Event.add_watch_callback(MOUSE_WHEEL_EVENT_WATCH) else Event.remove_watch_callback(MOUSE_WHEEL_EVENT_WATCH) end end end
Public Instance Methods
position(= [x, y])
click to toggle source
# File lib/rb_sdl2/mouse/mouse_wheel.rb, line 39 def position = [x, y] def update if @timestamp != MouseWheel.timestamp @x, @y, @timestamp = MouseWheel.x, MouseWheel.y, MouseWheel.timestamp else @x, @y = 0, 0 end self end attr_reader :x, :y end
update()
click to toggle source
# File lib/rb_sdl2/mouse/mouse_wheel.rb, line 41 def update if @timestamp != MouseWheel.timestamp @x, @y, @timestamp = MouseWheel.x, MouseWheel.y, MouseWheel.timestamp else @x, @y = 0, 0 end self end