Upgrade to OPENRNDR 0.4 snapshot
This commit is contained in:
33
orx-jvm/orx-olive/src/demo/kotlin/DemoOlive01.kt
Normal file
33
orx-jvm/orx-olive/src/demo/kotlin/DemoOlive01.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
import org.openrndr.Extension
|
||||
import org.openrndr.Program
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.olive.Olive
|
||||
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
43
orx-jvm/orx-olive/src/demo/kotlin/DemoOliveScriptless01.kt
Normal file
43
orx-jvm/orx-olive/src/demo/kotlin/DemoOliveScriptless01.kt
Normal file
@@ -0,0 +1,43 @@
|
||||
import org.openrndr.Extension
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.olive.OliveScriptHost
|
||||
import org.openrndr.extra.olive.oliveProgram
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
oliveProgram(scriptHost = OliveScriptHost.JSR223) {
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.GRAY)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
for (i in 0 until 100) {
|
||||
drawer.circle(
|
||||
width / 2.0 + cos(seconds + i) * 320.0,
|
||||
i * 7.2,
|
||||
cos(i + seconds * 0.5) * 20.0 + 20.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
// -- this is only needed for the automated screenshots
|
||||
.olive.scriptLoaded.listen {
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
// -- this is a bit of hack, we need to push the screenshot extension in front of the olive one
|
||||
fun <T : Extension> extendHead(extension: T, configure: T.() -> Unit): T {
|
||||
program.extensions.add(0, extension)
|
||||
extension.configure()
|
||||
extension.setup(program)
|
||||
return extension
|
||||
}
|
||||
extendHead(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
orx-jvm/orx-olive/src/demo/kotlin/demo-olive-01.kts
Normal file
14
orx-jvm/orx-olive/src/demo/kotlin/demo-olive-01.kts
Normal file
@@ -0,0 +1,14 @@
|
||||
@file:Suppress("UNUSED_LAMBDA_EXPRESSION")
|
||||
import org.openrndr.Program
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.*
|
||||
|
||||
{ program: Program ->
|
||||
program.apply {
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.GRAY)
|
||||
drawer.fill = ColorRGBa.PINK
|
||||
drawer.circle(width/2.0, height/2.0 ,200.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user