[orx-jvm] Move panel, gui, dnk3, keyframer, triangulation to orx-jvm
This commit is contained in:
57
orx-jvm/orx-gui/src/demo/kotlin/DemoHide01.kt
Normal file
57
orx-jvm/orx-gui/src/demo/kotlin/DemoHide01.kt
Normal file
@@ -0,0 +1,57 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.parameters.*
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Circle
|
||||
|
||||
/**
|
||||
* A simple demonstration of a GUI for drawing some circles
|
||||
*/
|
||||
suspend fun main() = application {
|
||||
program {
|
||||
// -- this block is for automation purposes only
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
val gui = GUI()
|
||||
gui.compartmentsCollapsedByDefault = false
|
||||
|
||||
|
||||
val settings = @Description("Settings") object {
|
||||
@DoubleParameter("radius", 0.0, 100.0)
|
||||
var radius = 50.0
|
||||
|
||||
@Vector2Parameter("position", 0.0, 1.0)
|
||||
var position = Vector2(0.6, 0.5)
|
||||
|
||||
@ColorParameter("color")
|
||||
var color = ColorRGBa.PINK
|
||||
|
||||
@DoubleListParameter("radii", 5.0, 30.0)
|
||||
var radii = mutableListOf(5.0, 6.0, 8.0, 14.0, 20.0, 30.0)
|
||||
}
|
||||
gui.add(settings)
|
||||
extend(gui)
|
||||
|
||||
// note we can only change the visibility after the extend
|
||||
gui.visible = false
|
||||
|
||||
extend {
|
||||
// determine visibility through mouse x-coordinate
|
||||
gui.visible = mouse.position.x < 200.0
|
||||
|
||||
drawer.fill = settings.color
|
||||
drawer.circle(settings.position * drawer.bounds.position(1.0, 1.0), settings.radius)
|
||||
drawer.circles(
|
||||
settings.radii.mapIndexed { i, radius ->
|
||||
Circle(width - 50.0, 60.0 + i * 70.0, radius)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
43
orx-jvm/orx-gui/src/demo/kotlin/DemoOptions01.kt
Normal file
43
orx-jvm/orx-gui/src/demo/kotlin/DemoOptions01.kt
Normal file
@@ -0,0 +1,43 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.parameters.*
|
||||
|
||||
/**
|
||||
* A simple demonstration of a GUI with a drop down menu
|
||||
*/
|
||||
|
||||
enum class BackgroundColors {
|
||||
Pink,
|
||||
Black,
|
||||
Yellow
|
||||
}
|
||||
|
||||
suspend fun main() = application {
|
||||
program {
|
||||
// -- this block is for automation purposes only
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
val gui = GUI()
|
||||
gui.compartmentsCollapsedByDefault = false
|
||||
val settings = @Description("Settings") object {
|
||||
@OptionParameter("Background color")
|
||||
var option = BackgroundColors.Pink
|
||||
}
|
||||
|
||||
gui.add(settings)
|
||||
extend(gui)
|
||||
extend {
|
||||
when(settings.option) {
|
||||
BackgroundColors.Pink -> drawer.clear(ColorRGBa.PINK)
|
||||
BackgroundColors.Black -> drawer.clear(ColorRGBa.BLACK)
|
||||
BackgroundColors.Yellow -> drawer.clear(ColorRGBa.YELLOW)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
72
orx-jvm/orx-gui/src/demo/kotlin/DemoPresets01.kt
Normal file
72
orx-jvm/orx-gui/src/demo/kotlin/DemoPresets01.kt
Normal file
@@ -0,0 +1,72 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.color.mix
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.parameters.*
|
||||
|
||||
/**
|
||||
* Shows how to store and retrieve in-memory gui presets.
|
||||
* Keyboard controls:
|
||||
* [Left Shift] + [0]..[9] => store current gui values to a preset
|
||||
* [0]..[9] => recall a preset
|
||||
*/
|
||||
suspend fun main() = application {
|
||||
program {
|
||||
// -- this block is for automation purposes only
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
val gui = GUI()
|
||||
gui.compartmentsCollapsedByDefault = false
|
||||
|
||||
val presets = MutableList(10) {
|
||||
gui.toObject()
|
||||
}
|
||||
|
||||
val settings = @Description("Settings") object {
|
||||
@IntParameter("a", 1, 10)
|
||||
var a = 7
|
||||
|
||||
@IntParameter("b", 1, 10)
|
||||
var b = 3
|
||||
|
||||
@ColorParameter("foreground")
|
||||
var foreground = ColorRGBa.fromHex("654062")
|
||||
|
||||
@ColorParameter("background")
|
||||
var background = ColorRGBa.fromHex("ff9c71")
|
||||
}
|
||||
gui.add(settings)
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.clear(settings.background)
|
||||
drawer.stroke = settings.background
|
||||
drawer.fill = settings.foreground
|
||||
// Draw a pattern based on modulo
|
||||
for(i in 0 until 100) {
|
||||
if(i % settings.a == 0 || i % settings.b == 0) {
|
||||
val x = (i % 10) * 64.0
|
||||
val y = (i / 10) * 48.0
|
||||
drawer.rectangle(x, y, 64.0, 48.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
keyboard.keyDown.listen {
|
||||
when (it.name) {
|
||||
in "0" .. "9" -> {
|
||||
if(keyboard.pressedKeys.contains("left-shift")) {
|
||||
// 1. Get the current gui state, store it in a list
|
||||
presets[it.name.toInt()] = gui.toObject()
|
||||
} else {
|
||||
// 2. Set the gui state
|
||||
gui.fromObject(presets[it.name.toInt()])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
49
orx-jvm/orx-gui/src/demo/kotlin/DemoSimple01.kt
Normal file
49
orx-jvm/orx-gui/src/demo/kotlin/DemoSimple01.kt
Normal file
@@ -0,0 +1,49 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.parameters.*
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Circle
|
||||
|
||||
/**
|
||||
* A simple demonstration of a GUI for drawing some circles
|
||||
*/
|
||||
suspend fun main() = application {
|
||||
program {
|
||||
// -- this block is for automation purposes only
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
val gui = GUI()
|
||||
gui.compartmentsCollapsedByDefault = false
|
||||
|
||||
val settings = @Description("Settings") object {
|
||||
@DoubleParameter("radius", 0.0, 100.0)
|
||||
var radius = 50.0
|
||||
|
||||
@Vector2Parameter("position", 0.0, 1.0)
|
||||
var position = Vector2(0.6, 0.5)
|
||||
|
||||
@ColorParameter("color")
|
||||
var color = ColorRGBa.PINK
|
||||
|
||||
@DoubleListParameter("radii", 5.0, 30.0)
|
||||
var radii = mutableListOf(5.0, 6.0, 8.0, 14.0, 20.0, 30.0)
|
||||
}
|
||||
gui.add(settings)
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.fill = settings.color
|
||||
drawer.circle(settings.position * drawer.bounds.position(1.0, 1.0), settings.radius)
|
||||
drawer.circles(
|
||||
settings.radii.mapIndexed { i, radius ->
|
||||
Circle(width - 50.0, 60.0 + i * 70.0, radius)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
40
orx-jvm/orx-gui/src/demo/kotlin/DemoXYParameter.kt
Normal file
40
orx-jvm/orx-gui/src/demo/kotlin/DemoXYParameter.kt
Normal file
@@ -0,0 +1,40 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.XYParameter
|
||||
import org.openrndr.math.Vector2
|
||||
|
||||
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 gui = GUI()
|
||||
gui.compartmentsCollapsedByDefault = false
|
||||
|
||||
val settings = @Description("Settings") object {
|
||||
@XYParameter("Position", 0.0, 800.0, 0.0, 800.0,
|
||||
precision = 2,
|
||||
invertY = true,
|
||||
showVector = true)
|
||||
var position: Vector2 = Vector2(0.0,0.0)
|
||||
}
|
||||
|
||||
gui.add(settings)
|
||||
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.circle(settings.position, 50.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user