Class: AniRuby::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/aniruby/frame.rb

Overview

A frame has a sprite that’s Gosu::Image and a duration specified in milliseconds

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sprite, duration = 0.1) ⇒ Frame

Create a new frame

Parameters:

  • sprite (Gosu::Image)
  • duration (Float) (defaults to: 0.1)


23
24
25
26
27
28
29
# File 'lib/aniruby/frame.rb', line 23

def initialize(sprite, duration = 0.1)
  @sprite = sprite
  @duration = duration

  @width = @sprite.width
  @height = @sprite.height
end

Instance Attribute Details

#durationFloat

Returns:

  • (Float)


6
7
8
# File 'lib/aniruby/frame.rb', line 6

def duration
  @duration
end

#heightInteger (readonly) Also known as: h

Returns:

  • (Integer)


12
13
14
# File 'lib/aniruby/frame.rb', line 12

def height
  @height
end

#spriteGosu::Image

Returns:

  • (Gosu::Image)


9
10
11
# File 'lib/aniruby/frame.rb', line 9

def sprite
  @sprite
end

#widthInteger (readonly) Also known as: w

Returns:

  • (Integer)


12
13
14
# File 'lib/aniruby/frame.rb', line 12

def width
  @width
end