Upgrade to OPENRNDR 0.4 snapshot
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.loadFont
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.parameters.*
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.math.Vector4
|
||||
|
||||
|
||||
suspend fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
}
|
||||
|
||||
program {
|
||||
// -- this block is for automation purposes only
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
val rabbit = RabbitControlServer()
|
||||
val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 20.0)
|
||||
val settings = object {
|
||||
@TextParameter("A string")
|
||||
var s: String = "Hello"
|
||||
|
||||
@DoubleParameter("A double", 0.0, 10.0)
|
||||
var d: Double = 10.0
|
||||
|
||||
@BooleanParameter("A bool")
|
||||
var b: Boolean = true
|
||||
|
||||
@ColorParameter("A fill color")
|
||||
var fill = ColorRGBa.PINK
|
||||
|
||||
@ColorParameter("A stroke color")
|
||||
var stroke = ColorRGBa.WHITE
|
||||
|
||||
@Vector2Parameter("A vector2")
|
||||
var v2 = Vector2(200.0,200.0)
|
||||
|
||||
@Vector3Parameter("A vector3")
|
||||
var v3 = Vector3(200.0, 200.0, 200.0)
|
||||
|
||||
@Vector4Parameter("A vector4")
|
||||
var v4 = Vector4(200.0, 200.0, 200.0, 200.0)
|
||||
|
||||
@ActionParameter("Action test")
|
||||
fun clicked() {
|
||||
println("Clicked from RabbitControl")
|
||||
}
|
||||
}
|
||||
|
||||
rabbit.add(settings)
|
||||
extend(rabbit)
|
||||
extend {
|
||||
drawer.clear(if (settings.b) ColorRGBa.BLUE else ColorRGBa.BLACK)
|
||||
drawer.fontMap = font
|
||||
drawer.fill = settings.fill
|
||||
drawer.stroke = settings.stroke
|
||||
drawer.circle(settings.v2, settings.d)
|
||||
drawer.text(settings.s, 10.0, 20.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import org.openrndr.KEY_HOME
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.parameters.*
|
||||
|
||||
|
||||
suspend fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
}
|
||||
|
||||
program {
|
||||
// -- this block is for automation purposes only
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
76
orx-jvm/orx-rabbit-control/src/demo/kotlin/DemoRabbitHole.kt
Normal file
76
orx-jvm/orx-rabbit-control/src/demo/kotlin/DemoRabbitHole.kt
Normal file
@@ -0,0 +1,76 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.loadFont
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.parameters.*
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.math.Vector4
|
||||
|
||||
|
||||
suspend fun main() = application {
|
||||
configure {
|
||||
width = 800
|
||||
height = 800
|
||||
}
|
||||
|
||||
program {
|
||||
// -- this block is for automation purposes only
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start RabbitControlServer with a Rabbithole with key 'orxtest'
|
||||
* Please visit https://rabbithole.rabbitcontrol.cc for more information.
|
||||
*
|
||||
* Rabbithole allows you to access your exposed parameter from the internet.
|
||||
* To use it with this example just use 'orxtest' as tunnel-name on the main page.
|
||||
*/
|
||||
val rabbit = RabbitControlServer(false, 10000, 8080, "wss://rabbithole.rabbitcontrol.cc/public/rcpserver/connect?key=orxtest")
|
||||
val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 20.0)
|
||||
val settings = object {
|
||||
@TextParameter("A string")
|
||||
var s: String = "Hello"
|
||||
|
||||
@DoubleParameter("A double", 0.0, 10.0)
|
||||
var d: Double = 10.0
|
||||
|
||||
@BooleanParameter("A bool")
|
||||
var b: Boolean = true
|
||||
|
||||
@ColorParameter("A fill color")
|
||||
var fill = ColorRGBa.PINK
|
||||
|
||||
@ColorParameter("A stroke color")
|
||||
var stroke = ColorRGBa.WHITE
|
||||
|
||||
@Vector2Parameter("A vector2")
|
||||
var v2 = Vector2(200.0,200.0)
|
||||
|
||||
@Vector3Parameter("A vector3")
|
||||
var v3 = Vector3(200.0, 200.0, 200.0)
|
||||
|
||||
@Vector4Parameter("A vector4")
|
||||
var v4 = Vector4(200.0, 200.0, 200.0, 200.0)
|
||||
|
||||
@ActionParameter("Action test")
|
||||
fun clicked() {
|
||||
println("Clicked from RabbitControl")
|
||||
}
|
||||
}
|
||||
|
||||
rabbit.add(settings)
|
||||
extend(rabbit)
|
||||
extend {
|
||||
drawer.clear(if (settings.b) ColorRGBa.BLUE else ColorRGBa.BLACK)
|
||||
drawer.fontMap = font
|
||||
drawer.fill = settings.fill
|
||||
drawer.stroke = settings.stroke
|
||||
drawer.circle(settings.v2, settings.d)
|
||||
drawer.text(settings.s, 10.0, 20.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user