Add optional QR-code overlay for orx-rabbit-control

* Optional QR-code overlay for orx-rabbit-control
* Animate the QR-code overlay
* Changed orx-rabbit-control to the new demo structure
* Changed orx-rabbit-control README.MD
This commit is contained in:
Rein van der Woerd
2020-04-07 17:04:35 +02:00
committed by GitHub
parent b98d1b7369
commit 5d3eadd156
6 changed files with 177 additions and 11 deletions

View File

@@ -0,0 +1,45 @@
import org.openrndr.KEY_HOME
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.parameters.*
fun main() = application {
configure {
width = 800
height = 800
}
program {
val rabbit = RabbitControlServer(showQRUntilClientConnects = false)
val settings = object {
@BooleanParameter("White on black")
var whiteOnBlack: Boolean = true
}
rabbit.add(settings)
extend(rabbit)
/**
* Example: only show the QR code when the [KEY_HOME] button is pressed
*/
keyboard.keyDown.listen {
when (it.key) {
KEY_HOME -> rabbit.showQRCode = true
}
}
keyboard.keyUp.listen {
when (it.key) {
KEY_HOME -> rabbit.showQRCode = false
}
}
extend {
drawer.background(if (settings.whiteOnBlack) ColorRGBa.BLACK else ColorRGBa.WHITE)
drawer.fill = if (settings.whiteOnBlack) ColorRGBa.WHITE else ColorRGBa.BLACK
drawer.circle(drawer.bounds.center, 250.0)
}
}
}