Skip to content

Commit b7ee7dc

Browse files
authored
Make GUI instance properties and methods accessible (#345)
1 parent e583227 commit b7ee7dc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

orx-jvm/orx-gui/src/main/kotlin/WindowedGUI.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ class WindowedGUI(
1616
val windowAlwaysOntop: Boolean = false,
1717
) : Extension {
1818
override var enabled: Boolean = true
19+
val gui: GUI = GUI(appearance, defaultStyles)
1920

2021
private val addedObjects = mutableListOf<Pair<Any, String?>>()
22+
2123
fun <T : Any> add(objectWithParameters: T, label: String? = objectWithParameters.title()): T {
2224
addedObjects.add(Pair(objectWithParameters, label))
2325
return objectWithParameters
@@ -58,9 +60,8 @@ class WindowedGUI(
5860

5961
// launch because at this stage Driver.instance.contextID points to the context of the parent window
6062
cw.program.launch {
61-
val gui = GUI(appearance, defaultStyles)
62-
for (o in addedObjects) {
63-
gui.add(o.first, o.second)
63+
for ((obj, label) in addedObjects) {
64+
gui.add(obj, label)
6465
}
6566
cw.program.extend(gui)
6667
program.produceAssets.listen {

0 commit comments

Comments
 (0)