Add orx-timer

This commit is contained in:
Edwin Jakobs
2020-04-08 12:43:26 +02:00
parent d6fa5d7fff
commit fa2a2f54ba
7 changed files with 129 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import org.openrndr.application
import org.openrndr.extra.timer.repeat
fun main() = application {
program {
repeat(2.0) {
println("hello there $seconds" )
}
extend {
}
}
}

View File

@@ -0,0 +1,27 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.events.Event
import org.openrndr.extra.timer.repeat
/**
* This demonstrates how to combine `repeat {}` with a postponed event to trigger drawing
*/
fun main() = application {
program {
val event = Event<Any?>().postpone(true)
event.listen {
drawer.circle(width / 2.0, height / 2.0, 200.0)
}
repeat(2.0) {
// -- we can not draw here, so we relay the repeat signal to the event
event.trigger(null)
}
extend {
drawer.background(ColorRGBa.PINK)
// -- by explicitly calling deliver we know that the drawing code in the listener will be
// -- executed exactly here
event.deliver()
}
}
}

View File

@@ -0,0 +1,10 @@
import org.openrndr.application
import org.openrndr.extra.timer.timeOut
fun main() = application {
program {
timeOut(2.0) {
println("hello there $seconds" )
}
}
}