Add screenshot code to olive scriptless demo
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
|
import org.openrndr.Extension
|
||||||
import org.openrndr.Program
|
import org.openrndr.Program
|
||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.color.ColorRGBa
|
import org.openrndr.color.ColorRGBa
|
||||||
|
import org.openrndr.extensions.SingleScreenshot
|
||||||
import org.openrndr.extra.olive.Olive
|
import org.openrndr.extra.olive.Olive
|
||||||
import org.openrndr.math.IntVector2
|
import org.openrndr.math.IntVector2
|
||||||
|
|
||||||
@@ -13,6 +15,21 @@ fun main() {
|
|||||||
}
|
}
|
||||||
program {
|
program {
|
||||||
extend(Olive<Program>()) {
|
extend(Olive<Program>()) {
|
||||||
|
// -- 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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
script = "orx-olive/src/demo/kotlin/DemoOliveScriptless01.kt"
|
script = "orx-olive/src/demo/kotlin/DemoOliveScriptless01.kt"
|
||||||
program {
|
program {
|
||||||
extend {
|
extend {
|
||||||
|
|||||||
Reference in New Issue
Block a user