-
Notifications
You must be signed in to change notification settings - Fork 37
/
DemoOliveFromScript01.kt
37 lines (34 loc) · 1.23 KB
/
DemoOliveFromScript01.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
import org.openrndr.Extension
import org.openrndr.Program
import org.openrndr.application
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.olive.Olive
/**
* Live-coding with [Olive], an older, not recommended, way to do things
*/
fun main() = application {
configure {
width = 768
height = 576
}
program {
extend(Olive<Program>()) {
script = "orx-olive/src/demo/kotlin/demo-olive-01.kts"
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
scriptLoaded.listen {
// -- this is a bit of hack, we need to push the screenshot extension in front of the olive one
fun <T : Extension> Program.extendHead(extension: T, configure: T.() -> Unit): T {
extensions.add(0, extension)
extension.configure()
extension.setup(this)
return extension
}
extendHead(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
}
}
}
}