Class: Hemi::Render::Sprite
- Defined in:
- lib/hemi/render/sprite.rb
Constant Summary collapse
- ERR__IMAGE_NOT_FOUND =
"Image %s not found.".freeze
Constants inherited from Texture
Texture::ERR__INVALID_POSITION
Class Attribute Summary collapse
-
.sprites ⇒ Object
readonly
Returns the value of attribute sprites.
Attributes inherited from Texture
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Sprite
constructor
A new instance of Sprite.
- #render(position: nil, size: nil) ⇒ Object
Methods inherited from Texture
Constructor Details
#initialize(name) ⇒ Sprite
Returns a new instance of Sprite.
7 8 9 10 11 12 |
# File 'lib/hemi/render/sprite.rb', line 7 def initialize(name) @texture = Hemi::Render::Window.renderer.load_texture("assets/img/#{name}.bmp") Sprite.register(name, self) rescue SDL2::Error => _e raise ArgumentError, format(ERR__IMAGE_NOT_FOUND, font_path) end |
Class Attribute Details
.sprites ⇒ Object (readonly)
Returns the value of attribute sprites.
19 20 21 |
# File 'lib/hemi/render/sprite.rb', line 19 def sprites @sprites end |
Class Method Details
.bucket ⇒ Object
21 22 23 |
# File 'lib/hemi/render/sprite.rb', line 21 def bucket :sprites end |