Sprites.Ui.Code
A plain code editor: a monospace textarea two-way bound to a reactive string. It knows nothing of any one language, so any editor can hold source in it; the shader editor uses it for both a layer's code and the shared globals. Like the other form controls it forwards the value onto the element and writes the typed text back with Set, so a lens chain over the string settles as usual.
Sprites.Ui.Code.Editor Void
Sprites.Ui.Code.Editor(value)
A code editor bound to a value. The control fills its container's width and stands a comfortable number of rows tall, so it sits inside a resizable window and grows with it. Spellcheck, autocapitalise and autocomplete are off, since this is source, not prose, and whitespace is preserved, so pasted code keeps its shape. Typing writes the whole text back to value through Set.
| Input | Type | Description |
|---|---|---|
value | Sprites.Reactive.Value | The two-way string the textarea shows and writes back on input. |
Returns nothing.
const source = Sprites.Reactive.Binding'vec4 LayerMain() {\n return vec4(Unit, 0.0, 1.0);\n}');
Sprites.Ui.Code.Editor(source);
const length = Sprites.Text.Length(source);
Sprites.Ui.Content.Text('Characters: ', length);