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.cr

Constructors

Instance Method Summary

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


[View source]

Instance Method Detail

def drawable : SF::Sprite #

The SF::Sprite associated with this component


[View source]
def drawable=(drawable : SF::Sprite) #

The SF::Sprite associated with this component


[View source]