Skip to main content

Module ui

Module ui 

Source
Expand description

Editor chrome shared by all modes: the red tab bar, the status bar, mouse state and the cursor. Everything is drawn with the runtime’s fantasy-console primitives — no native widgets anywhere.

Structs§

Mouse
Mouse state in virtual-screen coordinates.
StatusMsg
A transient bottom-bar message with a frame countdown; falls back to a static hint once it expires. Callers pass text already sized for the bar.

Constants§

CIRCLE
The palette’s display-mode circle toggle (lavender), lifted from PICO-8.
FLOW
Flow-control flags (loop-start, loop-back, stop), lifted from PICO-8.
ICON_PENCIL
The pencil glyph, sampled pixel-for-pixel from PICO-8 (shared by the sprite and map editors).
PALETTE
The 8 SFX waveform-graph palette boxes (box 0 red/selected here), lifted from PICO-8. 8 = red box, 6 = grey box, 7 = white graph line.
STATUS_TTL
Frames a transient status message stays up (~2.5s at 60fps).
WAVEI
The header default-waveform wave icon (lavender), lifted from PICO-8.

Functions§

arrow_l
Left-pointing arrow (apex at left).
arrow_r
Right-pointing arrow (apex at right).
blit
Paint a pixel grid (one hex palette index per cell; . = black/0; 5 = the dark-grey editor background, treated as transparent so it shows through).
code_filename
Draw the code editor’s current filename in the top-left of the tab bar, in peach to match the highlighted code tab. Truncated to stay clear of the tab icons; empty when no project file is open (a loaded cart), so nothing shows.
draw_cursor
Draw the mouse cursor on top of everything.
draw_icon8
Blit an Icon8 at (x, y) in the given colour; unset bits are left untouched.
draw_tab_bar
Top bar: the red strip and the five editor tab icons, right-aligned. Per-editor top-left content (the code filename, the SFX mode buttons) is drawn by the shell on top of this.
filename_clicked
Whether a left-press landed on the top-left filename (the click target that opens the file picker). False for an empty name; the region is clamped clear of the tab icons so one click never routes to both.
mode_buttons
The two top-left view-mode buttons: a bar-chart (pitch) and a 3x3 dot grid (tracker). The active one is peach, the other dark-purple.
note_cell
One tracker note cell at (x, y), in PICO-8’s field layout/colours: letter (white) · # accidental · octave (light grey) · instrument (pink, or green when a custom instrument) · volume (blue) · effect (grey . / orange digit). A silent step (volume 0) renders as a faint dotted line.
pat_sfx_toggle
The music grid’s Pat/Sfx toggle, drawn in the top bar: two labels flanking a slide switch whose raised knob sits on the active side (the active label is white). The whole switch is one click target (handled by the music editor).
pencil
The “edit this SFX” pencil glyph (lavender).
radio
A channel enable toggle: a 5x5 light-grey box with a white centre when on.
status_bar
Bottom status bar with a single line of text.
tab_bar_click
Which tab (index into EDITOR_MODES) was clicked this frame, if any.
tab_bar_hover
The tab the cursor hovers in the top bar, if any (for the bottom-bar hint).
tab_name
Display name for tab i, in TABS order.
view_buttons
The two top-left view buttons for the sprite/map editors: a panelled layout glyph (normal, a box with a divider strip) and a hollow box (fullscreen). The active one is peach, the other dark-purple. Hit regions match mode_buttons: over(4, 0, 12, 7) for normal, over(13, 0, 22, 7) for fullscreen.

Type Aliases§

Icon8
An 8×8 one-bit icon: each byte is a row, MSB is the left pixel.