class PF::Sprite

Included Modules

Defined in:

sprite.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(width : Int, height : Int) #

[View source]
def self.new(path : String) #

[View source]
def self.new(surface : SDL::Surface) #

[View source]

Class Method Detail

def self.load_tiles(path, tile_width, tile_height) #

[View source]

Instance Method Detail

def convert(other : SDL::Surface) #

Convert the color mode of this sprite to another for optimization


[View source]
def convert(other : Sprite) #

ditto


[View source]
def draw_point(x, y, value : UInt32 | Pixel) #

Implements PF2d::Drawable(UInt32)


[View source]
def draw_string(string : String, x : Number, y : Number, font : Pixelfont::Font, pixel) #

[View source]
def draw_string(string : String, pos : PF2d::Vec, font : Pixelfont::Font, pixel) #

[View source]
def draw_to(sprite : Sprite, source : PF2d::Vec, size : PF2d::Vec, dest : PF2d::Vec) #

Draw this sprite to another given a source rect and destination


[View source]
def draw_to(surface : SDL::Surface, x : Int = 0, y : Int = 0) #

Draw this sprite to another


[View source]
def draw_to(sprite : Sprite, x : Int = 0, y : Int = 0) #

ditto


[View source]
def draw_to(dest : SDL::Surface | Sprite, at : PF2d::Vec) #

ditto


[View source]
def fill(color : PF::Pixel) #

Fill a sprite with a color


[View source]
def fill(*args, **options) #

[View source]
def fill(*args, **options, &) #

[View source]
def format(*args, **options) #

[View source]
def format(*args, **options, &) #

[View source]
def get_point(x : Number, y : Number) : Pixel #
Description copied from module PF2d::Viewable(PF::Pixel)

To be implemented by the including class


[View source]
def height #

[View source]
def lock(*args, **options) #

[View source]
def lock(*args, **options, &) #

[View source]
def peak(x : Int, y : Int) #

Peak at a raw pixel value at (x, y)


[View source]
def peak(point : PF2d::Vec) #

ditto


[View source]
def pixel_pointer(x : Int32, y : Int32) #

Get the pointer to a pixel


[View source]
def pixels #

Raw access to the pixels as a Slice


[View source]
def sample(x : Int, y : Int, alpha : Bool) #

Sample a color with alhpa


[View source]
def sample(x : Int, y : Int) #

Sample a color at an x and y position


[View source]
def sample(point : PF2d::Vec, alpha : Bool) #

ditto


[View source]
def sample(point : PF2d::Vec) #

ditto


[View source]
def size : PF2d::Vec2 #

[View source]
def surface : SDL::Surface #

[View source]
def surface=(surface : SDL::Surface) #

[View source]
def width #

[View source]