A wx panel that draws text items on a dark canvas and hands its keys to its owner — the screens a game puts around its worlds, drawn as a game draws them rather than built from widgets.
text = Cauldron2D.Wx.Text.new(frame, owner: self(), backdrop: &MyGame.Wx.stars/3)
Cauldron2D.Wx.Text.show(text, [{{:centre, 640}, 200, "DOTS", {127, 214, 255}, :title}, {60, 300, "Enter play", {228, 231, 243}, :big}])An item is {x, y, text, colour, size} — x a left edge in pixels or {:centre, x},
colour an RGB triple, size one of :small, :normal, :big, :title — with an
optional sixth element, an action: a click on the item's text sends the owner
{:cauldron_wx_text, :action, action}. The owner also receives
{:cauldron_wx_text, :key, code} for every key that goes down (wx key codes) and
{:cauldron_wx_text, :char, char} for every character typed, and draws by calling
show/2 again.
Options: :owner (default the caller); :backdrop, a function of the DC, the width
and the height that draws behind the text, after the canvas is cleared to
:background (default {5, 6, 15}); :fonts — points for :small, :normal,
:big, :title (default 12, 15, 20, 48).
Summary
Functions
Give the panel the keyboard.
The panel under parent.
Draw these items from now on.
The canvas's size in pixels.
The panel's wx window.
Types
Functions
@spec focus(term()) :: :ok
Give the panel the keyboard.
The panel under parent.
Draw these items from now on.
@spec size(term()) :: {pos_integer(), pos_integer()}
The canvas's size in pixels.
The panel's wx window.