-
Notifications
You must be signed in to change notification settings - Fork 37
/
DemoOptions01.kt
39 lines (35 loc) · 1.02 KB
/
DemoOptions01.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.gui.GUI
import org.openrndr.extra.parameters.Description
import org.openrndr.extra.parameters.OptionParameter
/**
* A simple demonstration of a GUI with a drop down menu
*/
enum class BackgroundColors {
Pink,
Black,
Yellow
}
fun main() = application {
program {
val gui = GUI()
gui.compartmentsCollapsedByDefault = false
val settings = @Description("Settings") object {
@OptionParameter("Background color")
var option = BackgroundColors.Pink
}
gui.add(settings)
extend(gui)
gui.onChange { name, value ->
println("$name: $value")
}
extend {
when (settings.option) {
BackgroundColors.Pink -> drawer.clear(ColorRGBa.PINK)
BackgroundColors.Black -> drawer.clear(ColorRGBa.BLACK)
BackgroundColors.Yellow -> drawer.clear(ColorRGBa.YELLOW)
}
}
}
}