Reduce duplication in orx build scripts. (#240)
Co-authored-by: hamoid <abe@hamoid.com>
This commit is contained in:
@@ -12,21 +12,16 @@ sourceSets {
|
||||
collectScreenshots(project, demo) { }
|
||||
}
|
||||
|
||||
val openrndrVersion: String by rootProject.extra
|
||||
val openrndrOS: String by rootProject.extra
|
||||
val slf4jVersion:String by rootProject.extra
|
||||
val kotlinVersion:String by rootProject.extra
|
||||
val gsonVersion:String by rootProject.extra
|
||||
val demoImplementation by configurations.getting {}
|
||||
|
||||
val demoRuntimeOnly by configurations.getting {}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
|
||||
demoImplementation("org.openrndr:openrndr-extensions:$openrndrVersion")
|
||||
demoImplementation("org.openrndr:openrndr-dialogs:$openrndrVersion")
|
||||
demoImplementation("com.google.code.gson:gson:$gsonVersion")
|
||||
demoRuntimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion")
|
||||
demoRuntimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion")
|
||||
implementation(libs.kotlin.reflect)
|
||||
demoImplementation(libs.openrndr.extensions)
|
||||
demoImplementation(libs.openrndr.dialogs)
|
||||
demoImplementation(libs.gson)
|
||||
demoRuntimeOnly(libs.openrndr.gl3)
|
||||
demoRuntimeOnly(libs.openrndr.gl3.natives)
|
||||
demoImplementation(sourceSets.getByName("main").output)
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class SequenceEditor : SequenceEditorBase("sequence-editor") {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
open class SequenceEditorBase(type: String = "sequence-editor-base") : Element(ElementType(type)), DisposableElement {
|
||||
override var disposed = false
|
||||
|
||||
@@ -57,8 +58,8 @@ open class SequenceEditorBase(type: String = "sequence-editor-base") : Element(E
|
||||
private val footerHeight = 20.0
|
||||
|
||||
internal class ValueChangedEvent(val source: SequenceEditorBase,
|
||||
val oldValue: List<Double>,
|
||||
val newValue: List<Double>)
|
||||
val oldValue: List<Double>,
|
||||
val newValue: List<Double>)
|
||||
|
||||
internal class Events {
|
||||
val valueChanged = Event<ValueChangedEvent>("sequence-editor-base-value-changed")
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.openrndr.panel.elements
|
||||
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.yield
|
||||
import kotlinx.coroutines.*
|
||||
import mu.KotlinLogging
|
||||
import org.openrndr.*
|
||||
import org.openrndr.draw.Cursor
|
||||
@@ -291,6 +289,7 @@ class Slider : Element(ElementType("slider")), DisposableElement {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
fun Slider.bind(property: KMutableProperty0<Double>) {
|
||||
var currentValue: Double? = null
|
||||
|
||||
@@ -323,6 +322,7 @@ fun Slider.bind(property: KMutableProperty0<Double>) {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
@JvmName("bindInt")
|
||||
fun Slider.bind(property: KMutableProperty0<Int>) {
|
||||
var currentValue: Int? = null
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package org.openrndr.panel.elements
|
||||
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.*
|
||||
import org.openrndr.KEY_BACKSPACE
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.Drawer
|
||||
import org.openrndr.draw.LineCap
|
||||
import org.openrndr.panel.style.*
|
||||
import kotlinx.coroutines.yield
|
||||
import org.openrndr.KeyModifier
|
||||
import org.openrndr.draw.Cursor
|
||||
import org.openrndr.draw.writer
|
||||
@@ -138,6 +136,7 @@ class Textfield : Element(ElementType("textfield")), DisposableElement {
|
||||
override var disposed: Boolean = false
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
fun Textfield.bind(property: KMutableProperty0<String>) {
|
||||
GlobalScope.launch {
|
||||
install@ while (!disposed) {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.openrndr.panel.elements
|
||||
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.*
|
||||
import org.openrndr.draw.Drawer
|
||||
import org.openrndr.draw.FontImageMap
|
||||
import org.openrndr.draw.LineCap
|
||||
import org.openrndr.panel.style.*
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
import kotlinx.coroutines.yield
|
||||
import org.openrndr.draw.Writer
|
||||
import org.openrndr.events.Event
|
||||
import org.openrndr.launch
|
||||
@@ -100,6 +98,7 @@ class Toggle : Element(ElementType("toggle")), DisposableElement {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
fun Toggle.bind(property: KMutableProperty0<Boolean>) {
|
||||
var currentValue = property.get()
|
||||
value = currentValue
|
||||
|
||||
@@ -48,7 +48,7 @@ class Matcher {
|
||||
Combinator.LATER_SIBLING -> if (result == MatchingResult.RESTART_FROM_CLOSEST_DESCENDANT) {
|
||||
return result
|
||||
}
|
||||
Combinator.DESCENDANT -> {
|
||||
Combinator.DESCENDANT, null -> {
|
||||
// intentionally do nothing
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user