class Scar::Components::Sprite
Overview
This component is a wrapper around SF::Sprite
Example usage:
player_sprite = Scar::Components::Sprite.new(Assets.texture "textures/player.png")
player = Scar::Entity.new("player", player_sprite)
Direct Known Subclasses
Defined in:
scar/components/sprite.crConstructors
-
.new(texture : SF::Texture, rect : SF::IntRect | Nil = nil)
Creates a new sprite component.
Instance Method Summary
-
#drawable : SF::Sprite
The
SF::Sprite
associated with this component -
#drawable=(drawable : SF::Sprite)
The
SF::Sprite
associated with this component
Instance methods inherited from module Scar::Drawable
blend_mode : SF::BlendMode
blend_mode,
blend_mode=(blend_mode : SF::BlendMode)
blend_mode=,
drawable : SF::Drawable
drawable,
shader : SF::Shader
shader,
shader=(shader : SF::Shader)
shader=,
texture : SF::Texture
texture,
texture=(texture : SF::Texture)
texture=,
visible=(visible)
visible=,
visible?
visible?
Constructor Detail
def self.new(texture : SF::Texture, rect : SF::IntRect | Nil = nil)
#
Creates a new sprite component. Specify rect if you need to set the sprites texture_rect