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)


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

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

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

Instance Attribute Details

#durationFloat

Returns:

  • (Float)


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

def duration
  @duration
end

#heightInteger (readonly) Also known as: h

Returns:

  • (Integer)


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

def height
  @height
end

#spriteGosu::Image

Returns:

  • (Gosu::Image)


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

def sprite
  @sprite
end

#widthInteger (readonly) Also known as: w

Returns:

  • (Integer)


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

def width
  @width
end