module Scar::Drawable

Overview

This module provides an easy way to use SFML drawables in your application.

If this module is included in your Component or Object, any Objects::Camera in the space containing your entity will draw it to the screen.

Use #visible=, #texture, #shader and #blend_mode to customize drawing. If you want to be able to transform your drawable component, include SF::Transformable.

Instead of using this module, you can also include SF::Drawable and implement the #draw method yourself if you prefer.

Example usage: See Components::Sprite (source), Components::Tilemap (source) or other builtin components.

Included Modules

Direct including types

Defined in:

scar/drawable.cr

Instance Method Summary

Instance Method Detail

def blend_mode : SF::BlendMode #

Set this to use a blend mode while drawing


[View source]
def blend_mode=(blend_mode : SF::BlendMode) #

Set this to use a blend mode while drawing


[View source]
abstract def drawable : SF::Drawable #

Should return the underlying SF::Drawable, e. g. SF::Sprite or SF::Text


[View source]
def shader : SF::Shader #

Set this to use a shader while drawing


[View source]
def shader=(shader : SF::Shader) #

Set this to use a shader while drawing


[View source]
def texture : SF::Texture #

Set this to use a texture while drawing


[View source]
def texture=(texture : SF::Texture) #

Set this to use a texture while drawing


[View source]
def visible=(visible) #

Can be used to disable drawing


[View source]
def visible? #

[View source]