class TUI::Painter

Overview

Created by the application, passed down the widget tree by using #push to alter relative coordinates

When drawing use #w and #h for actual size

Use #pop after drawing

Defined in:

tui/painter.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(w, h) #

[View source]
def self.new(wh : Tuple(Int32, Int32)) #

[View source]

Instance Method Detail

def [](i, j) : Cell #

[View source]
def []=(i, j, width, str : String) #

Draw a string str

Starting at point [i, j], with maximum width


[View source]
def []=(i, j, val : Cell) #

[View source]
def []=(i, j, val : Char) #

[View source]
def []=(i, j, str : String) #

Draw a string str

Starting at point [i, j], up to maximum width


[View source]
def []?(i, j) : Cell | Nil #

[View source]
def centre(mid, j, str : String) #

[View source]
def centre(j, str) #

[View source]
def circle(x0 : Int32, y0 : Int32, radius : Int32 = 5, ch : Char = '█', debug = false) #

TODO do not set negative coordinate values


[View source]
def clear(rect) : self #

[View source]
def clear : self #

[View source]
def diff(old : Array(Array(Cell)) | Nil = nil, &) : Bool #

[View source]
def each(&) #

[View source]
def each_index(&) #

[View source]
def each_with_index(&) #

[View source]
def h : Int32 #

[View source]
def hline(x0 : Int32, y0 : Int32, len : Int32, ch : Char = '█', debug = false) : self #

[View source]
def line(x0 : Int32, y0 : Int32, x1 : Int32, y1 : Int32, ch : Char = '█', debug = false) : self #

[View source]
def poly(x_points : Array(Int32), y_points : Array(Int32), ch : Char = '█', debug = false) : self #

Draws a polygon with points specified in separate arrays of x and y coordinates


[View source]
def poly(points : Array(Tuple(Int32, Int32)), ch : Char = '█', debug = false) : self #

Draws a polygon with points specified as an array of coordinate tuples


[View source]
def pop : self #

Pop offsets from stack


[View source]
def print(i, j, str : String) #

[View source]
def push(new_x, new_y, new_w = Int32::MAX, new_h = Int32::MAX) : self #

Push new offsets onto stack

Optional arguments can set a maximum width


[View source]
def rect(x0 : Int32, y0 : Int32, x1 : Int32, y1 : Int32, ch : Char = '█', debug = false) : self #

[View source]
def resize(w, h) : self #

[View source]
def surface : Array(Array(Cell)) #

[View source]
def to_s(io : IO) #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]
def vline(x0 : Int32, y0 : Int32, len : Int32, ch : Char = '█', debug = false) : self #

[View source]
def w : Int32 #

[View source]