Demos: ensure all use fun main() = application {
- Adjust some demo window sizes. - Replace Random.double by Double.uniform - Tweak some demos so screenshots look more interesting
This commit is contained in:
@@ -6,28 +6,26 @@ import org.openrndr.drawImage
|
||||
import org.openrndr.extra.propertywatchers.watchingImagePath
|
||||
import org.openrndr.extra.propertywatchers.watchingProperty
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
val state = object {
|
||||
var path = "demo-data/images/image-001.png"
|
||||
val image by watchingImagePath(::path) {
|
||||
drawImage(it.width, it.height) {
|
||||
drawer.drawStyle.colorMatrix = grayscale()
|
||||
drawer.image(it)
|
||||
}
|
||||
}
|
||||
val redImage by watchingProperty(::image, cleaner = { it.destroy() }) {
|
||||
drawImage(it.width, it.height) {
|
||||
drawer.drawStyle.colorMatrix = tint(ColorRGBa.RED)
|
||||
drawer.image(it)
|
||||
}
|
||||
fun main() = application {
|
||||
program {
|
||||
val state = object {
|
||||
var path = "demo-data/images/image-001.png"
|
||||
val image by watchingImagePath(::path) {
|
||||
drawImage(it.width, it.height) {
|
||||
drawer.drawStyle.colorMatrix = grayscale()
|
||||
drawer.image(it)
|
||||
}
|
||||
}
|
||||
|
||||
extend {
|
||||
drawer.image(state.redImage)
|
||||
val redImage by watchingProperty(::image, cleaner = { it.destroy() }) {
|
||||
drawImage(it.width, it.height) {
|
||||
drawer.drawStyle.colorMatrix = tint(ColorRGBa.RED)
|
||||
drawer.image(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extend {
|
||||
drawer.image(state.redImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.propertywatchers.watchingProperty
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
val state = object {
|
||||
val x by watchingProperty(mouse::position) {
|
||||
it.x
|
||||
}
|
||||
|
||||
val xx by watchingProperty(::x) {
|
||||
it * it
|
||||
}
|
||||
fun main() = application {
|
||||
program {
|
||||
val state = object {
|
||||
val x by watchingProperty(mouse::position) {
|
||||
it.x
|
||||
}
|
||||
|
||||
extend {
|
||||
state.x
|
||||
val xx by watchingProperty(::x) {
|
||||
it * it
|
||||
}
|
||||
}
|
||||
|
||||
extend {
|
||||
state.x
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user