Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ folder, then executed. A PNG screenshot is saved and pushed into the [`media`](h
together with a link to the source code that produced the screenshot.

This serves two purposes: it can be useful for the user to see images of what the ORX can produce,
while it can also be usefu to detect breaking changes (in case the demo fails to run, or produces a
while it can also be useful to detect breaking changes (in case the demo fails to run or produces a
blank image).

## Gradle tasks
Expand Down
18 changes: 18 additions & 0 deletions orx-jvm/orx-gui/src/main/kotlin/custom/ElementExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ fun Element.uiForParameters(obj: Any): Div {
range = Range(parameter.intRange!!.start.toDouble(), parameter.intRange!!.endInclusive.toDouble())
label = parameter.label
precision = 0
@Suppress("UNCHECKED_CAST")
value = (parameter.property as KMutableProperty1<Any, Int>).get(obj).toDouble()
@Suppress("UNCHECKED_CAST")
bind(obj, parameter.property as KMutableProperty1<Any, Int>)
}
}
Expand All @@ -48,28 +50,38 @@ fun Element.uiForParameters(obj: Any): Div {
range = Range(parameter.doubleRange!!.start, parameter.doubleRange!!.endInclusive)
label = parameter.label
precision = parameter.precision!!
@Suppress("UNCHECKED_CAST")
value = (parameter.property as KMutableProperty1<Any, Double>).get(obj)
@Suppress("UNCHECKED_CAST")

bind(obj, parameter.property as KMutableProperty1<Any, Double>)
}
}
ParameterType.Color -> {
colorpickerButton {
label = parameter.label
@Suppress("UNCHECKED_CAST")
color = (parameter.property as KMutableProperty1<Any, ColorRGBa>).get(obj)
@Suppress("UNCHECKED_CAST")

bind(obj, parameter.property as KMutableProperty1<Any, ColorRGBa>)
}
}
ParameterType.Boolean -> {
toggle {
label = parameter.label
@Suppress("UNCHECKED_CAST")
value = (parameter.property as KMutableProperty1<Any, Boolean>).get(obj)
@Suppress("UNCHECKED_CAST")
bind(obj, parameter.property as KMutableProperty1<Any, Boolean>)
}
}
ParameterType.Text -> {
textfield {
label = parameter.label
@Suppress("UNCHECKED_CAST")
value = (parameter.property as KMutableProperty1<Any, String>).get(obj)
@Suppress("UNCHECKED_CAST")
bind(obj, parameter.property as KMutableProperty1<Any, String>)
}
}
Expand All @@ -79,7 +91,9 @@ fun Element.uiForParameters(obj: Any): Div {
label = parameter.label
range = parameter.doubleRange!!
precision = parameter.precision!!
@Suppress("UNCHECKED_CAST")
value = (parameter.property as KMutableProperty1<Any, Vector2>).get(obj)
@Suppress("UNCHECKED_CAST")
bind(obj, parameter.property as KMutableProperty1<Any, Vector2>)
}
}
Expand All @@ -89,7 +103,9 @@ fun Element.uiForParameters(obj: Any): Div {
label = parameter.label
range = parameter.doubleRange!!
precision = parameter.precision!!
@Suppress("UNCHECKED_CAST")
value = (parameter.property as KMutableProperty1<Any, Vector3>).get(obj)
@Suppress("UNCHECKED_CAST")
bind(obj, parameter.property as KMutableProperty1<Any, Vector3>)
}
}
Expand All @@ -99,7 +115,9 @@ fun Element.uiForParameters(obj: Any): Div {
label = parameter.label
range = parameter.doubleRange!!
precision = parameter.precision!!
@Suppress("UNCHECKED_CAST")
value = (parameter.property as KMutableProperty1<Any, Vector4>).get(obj)
@Suppress("UNCHECKED_CAST")
bind(obj, parameter.property as KMutableProperty1<Any, Vector4>)
}
}
Expand Down
Loading