class WFC::CharTexture

Overview

A texture made up of characters.

Defined in:

wfc.cr

Constant Summary

EMPTY_CHAR = UInt8.new(' '.ord)

Constructors

Instance Method Summary

Instance methods inherited from class WFC::Texture

bytes_per_cell bytes_per_cell, generate(*arguments) generate, height height, to_bytes : Bytes to_bytes, width width

Constructor methods inherited from class WFC::Texture

new(bytes, width, height) new

Constructor Detail

def self.new(bytes, width, height) #

Initializes the texture from a set of bytes.


[View source]
def self.new(string) #

Initializes the texture from a string.


[View source]
def self.new #

Initializes an empty texture.


[View source]

Instance Method Detail

def bytes_per_cell #

The number of bytes per unit of the texture.


[View source]
def char_at(x, y) #

Returns the codepoint at (x, y) as a Char or throws an IndexError.


[View source]
def char_at?(x, y) #

Returns the codepoint at (x, y) or nil.


[View source]
def get(x, y) #

Returns the codepoint at (x, y) or throws an IndexError.


[View source]
def get?(x, y) #

Returns the codepoint at (x, y) or nil.


[View source]
def height : Int32 #
Description copied from class WFC::Texture

The height of the texture.


[View source]
def load_bytes(bytes, width, height) #

Creates a new texture from bytes.


[View source]
def put(x, y, char : UInt8) #

Sets the character at (x, y) to char.


[View source]
def put(x, y, char : Char) #

Sets the character at (x, y) to char.


[View source]
def to_bytes : Bytes #

Converts the texture to an array of bytes.


[View source]
def to_s(io : IO) #

Prints the texture to an IO.


[View source]
def width : Int32 #
Description copied from class WFC::Texture

The width of the texture.


[View source]