Skip to content

Commit

Permalink
onReady proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Nov 14, 2023
1 parent 5419012 commit 1a4893e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions haxe/ui/backend/flixel/UIRuntimeFragment.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ class UIRuntimeFragment extends UIFragmentBase implements IComponentDelegate { /
root = buildViaRTTI(rtti);
linkViaRTTI(rtti, this, root);
if (root != null) {
root.registerEvent(UIEvent.READY, (_) -> {
onReady();
});
add(root);
}
}

private function onReady() {
}

public var component(get, set):Component;
private function get_component():Component {
return root;
Expand Down
6 changes: 6 additions & 0 deletions haxe/ui/backend/flixel/UIRuntimeState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ class UIRuntimeState extends UIStateBase { // uses rtti to "build" a class with
root = buildViaRTTI(rtti);
linkViaRTTI(rtti, this, root);
if (root != null) {
root.registerEvent(UIEvent.READY, (_) -> {
onReady();
});
Screen.instance.addComponent(root);
}
super.create();
}

private function onReady() {
}

/////////////////////////////////////////////////////////////////////////////////////////////////
// util functions
/////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 6 additions & 0 deletions haxe/ui/backend/flixel/UIRuntimeSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ class UIRuntimeSubState extends UISubStateBase { // uses rtti to "build" a class
root = buildViaRTTI(rtti);
linkViaRTTI(rtti, this, root);
if (root != null) {
root.registerEvent(UIEvent.READY, (_) -> {
onReady();
});
Screen.instance.addComponent(root);
}
super.create();
}

private function onReady() {
}

/////////////////////////////////////////////////////////////////////////////////////////////////
// util functions
/////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 1a4893e

Please sign in to comment.