Files
orx/orx-jvm/orx-rabbit-control/src/demo/kotlin/DemoRabbitControlManualOverlay.kt
Abe Pazos 56928057e0 Update boofcv, netty, ktor dependencies
boofcv 1.1.6 to 1.1.7
netty 4.1.114.Final to 4.1.115.Final
ktor 2.3.12 to 3.0.1

Fix related deprecations in orx-rabbit-control
2024-11-14 16:50:03 +01:00

46 lines
1.1 KiB
Kotlin

import org.openrndr.KEY_HOME
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.parameters.BooleanParameter
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.clear(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)
}
}
}