class

TUI::Painter

Inherits Reference < Object

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

Constructors

new(w, h)
Source
new(wh : Tuple(Int32, Int32))
Source

Instance methods

[](i, j) : Cell
Source
[]=(i, j, width, str : String)

Draw a string str

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

Source
[]=(i, j, val : Cell)
Source
[]=(i, j, val : Char)
Source
[]=(i, j, str : String)

Draw a string str

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

Source
[]?(i, j) : Cell | Nil
Source
centre(mid, j, str : String)
Source
centre(j, str)
Source
circle(x0 : Int32, y0 : Int32, radius : Int32 = 5, ch : Char = '█', debug = false)

TODO: do not set negative coordinate values

Source
clear(rect) : self
Source
clear
Source
diff(old : Array(Array(Cell)) | Nil = nil, &) : Bool
Source
each
Source
each_index
Source
each_with_index
Source
hline(x0 : Int32, y0 : Int32, len : Int32, ch : Char = '█', debug = false) : self
Source
line(x0 : Int32, y0 : Int32, x1 : Int32, y1 : Int32, ch : Char = '█', debug = false) : self
Source
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

Source
poly(points : Array(Tuple(Int32, Int32)), ch : Char = '█', debug = false) : self

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

Source
pop

Pop offsets from stack

Source
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

Source
rect(x0 : Int32, y0 : Int32, x1 : Int32, y1 : Int32, ch : Char = '█', debug = false) : self
Source
resize(w, h) : self
Source
surface
Source
to_s(io : IO)

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>
Source
vline(x0 : Int32, y0 : Int32, len : Int32, ch : Char = '█', debug = false) : self
Source