Class: Rubydraw::Events::WindowResize

Inherits:
Event show all
Defined in:
lib/rubydraw/events.rb

Overview

Created when the user resizes the window. This can only happen if Rubydraw::Flags::Resizable is passed when the window is created.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

#event?, matches?, wants_to_match?

Constructor Details

#initialize(dimensions) ⇒ WindowResize

Returns a new instance of WindowResize.



271
272
273
# File 'lib/rubydraw/events.rb', line 271

def initialize(dimensions)
  @dimensions = dimensions
end

Instance Attribute Details

#dimensionsObject

Returns the value of attribute dimensions.



269
270
271
# File 'lib/rubydraw/events.rb', line 269

def dimensions
  @dimensions
end

Class Method Details

.from_sdl_event(sdl_event) ⇒ Object



265
266
267
# File 'lib/rubydraw/events.rb', line 265

def self.from_sdl_event(sdl_event)
  self.new(Point[sdl_event.w, sdl_event.h])
end

.matching_sdl_typeObject



261
262
263
# File 'lib/rubydraw/events.rb', line 261

def self.matching_sdl_type
  SDL::VIDEORESIZE
end

Instance Method Details

#heightObject Also known as: y



279
280
281
# File 'lib/rubydraw/events.rb', line 279

def height
  @dimensions.y
end

#widthObject Also known as: x



275
276
277
# File 'lib/rubydraw/events.rb', line 275

def width
  @dimensions.x
end