Update Getting Started authored by Moritz Brückner's avatar Moritz Brückner
...@@ -72,23 +72,25 @@ class Main { ...@@ -72,23 +72,25 @@ class Main {
static function initialized(window: kha.Window) { static function initialized(window: kha.Window) {
kha.Assets.loadEverything(function() { kha.Assets.loadEverything(function() {
Koui.init(); Koui.init(() -> {
var button = new Button("Click me!");
button.setPosition(400, 180);
button.onMouseClick(function(e: Event) {
switch (e.state) {
case Active:
button.label = "Clicking";
case Deactivated:
button.label = "Clicked";
default:
button.label = "Click me!";
}
});
Koui.add(button);
});
var button = new Button("Click me!");
button.setPosition(400, 180);
button.onMouseClick(function(e: Event) {
switch (e.state) {
case Active:
button.label = "Clicking";
case Deactivated:
button.label = "Clicked";
default:
button.label = "Click me!";
}
});
Koui.add(button);
}); });
} }
...@@ -117,23 +119,23 @@ class KouiTrait extends iron.Trait { ...@@ -117,23 +119,23 @@ class KouiTrait extends iron.Trait {
super(); super();
notifyOnInit(function() { notifyOnInit(function() {
Koui.init(); Koui.init(() -> {
var button = new Button("Click me!");
var button = new Button("Click me!"); button.setPosition(400, 180);
button.setPosition(400, 180);
button.onMouseClick(function(e: Event) {
button.onMouseClick(function(e: Event) { switch (e.state) {
switch (e.state) { case Active:
case Active: button.label = "Clicking";
button.label = "Clicking"; case Deactivated:
case Deactivated: button.label = "Clicked";
button.label = "Clicked"; default:
default: button.label = "Click me!";
button.label = "Click me!"; }
} });
});
Koui.add(button);
Koui.add(button); });
}); });
} }
} }
... ...
......