parin/examples/ui/field.d

22 lines
448 B
D

/// This example shows how to use the text field.
import parin;
Str text;
char[32] textBuffer;
void ready() {
lockResolution(320, 180);
}
bool update(float dt) {
prepareUi();
setUiFocus(0);
// Create the text field and print if enter is pressed. Combos: ctrl+backspace, ctrl+x
if (uiTextField(Rect(resolution), text, textBuffer)) println(text);
return false;
}
void finish() { }
mixin runGame!(ready, update, finish);