Class: Moon::MouseMoveEvent

Inherits:
Event show all
Includes:
MouseEvent
Defined in:
lib/moon/packages/std/event.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#id, #type

Instance Method Summary collapse

Methods inherited from Event

make_filter

Constructor Details

#initialize(x, y, screen_rect) ⇒ MouseMoveEvent

Returns a new instance of MouseMoveEvent.


130
131
132
133
134
135
# File 'lib/moon/packages/std/event.rb', line 130

def initialize(x, y, screen_rect)
  @screen_rect = screen_rect
  @position = Vector2.new(x, y)
  @relative = Vector2.new(x, y)
  super :mousemove
end

Instance Attribute Details

#positionObject

Returns the value of attribute position


127
128
129
# File 'lib/moon/packages/std/event.rb', line 127

def position
  @position
end

#relativeObject

Returns the value of attribute relative


128
129
130
# File 'lib/moon/packages/std/event.rb', line 128

def relative
  @relative
end

#screen_rectObject

Returns the value of attribute screen_rect


126
127
128
# File 'lib/moon/packages/std/event.rb', line 126

def screen_rect
  @screen_rect
end

Instance Method Details

#normalize_positionObject


137
138
139
# File 'lib/moon/packages/std/event.rb', line 137

def normalize_position
  @position / [@screen_rect.w, @screen_rect.h]
end