real reactive ui

This commit is contained in:
2022-02-20 20:56:37 +01:00
parent 7b33667e04
commit 829484cb67
6 changed files with 73 additions and 29 deletions

View File

@@ -1,3 +1,4 @@
import lib.ui.Observable;
import lib.ui.TextElement;
import lib.ui.ReactiveUI;
import kernel.Log;
@@ -36,13 +37,20 @@ class Startup {
static function exampleUI() {
var context = WindowManager.instance.createNewContext();
var ui = new ReactiveUI(context);
ui.render([
new TextElement("Hello world"),
new TextElement("Hello world",Green,Red),
var text = new Observable("Hello world");
var ui = new ReactiveUI(context,[
new TextElement(text),
new TextElement(text,Green,Red),
]);
ui.render();
context.clickSignal.on(data -> {
text.set("Holla mundo");
});
WindowManager.instance.focusContextToOutput(context,"main");
}
}