jvmMain.PhraseResource.kt Maven / Gradle / Ivy
The newest version!
package org.openrndr.extra.shaderphrases
import org.openrndr.resourceUrl
import java.net.URL
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
/**
* PhraseResource can be used as a delegate
*/
class PhraseResource(private val resourceUrl: String) : ReadOnlyProperty {
override fun getValue(thisRef: R, property: KProperty<*>): String {
return URL(resourceUrl).readText()
}
}
/**
*
* PhraseResource delegate builder function
*/
fun phraseResource(resource: String) : PhraseResource {
return PhraseResource(resourceUrl(resource))
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy