Skip to content

Instantly share code, notes, and snippets.

@wrightwriter
Last active April 28, 2023 18:37
Show Gist options
  • Save wrightwriter/98a7c5cdeaccd28bb599f3561de3a52d to your computer and use it in GitHub Desktop.
Save wrightwriter/98a7c5cdeaccd28bb599f3561de3a52d to your computer and use it in GitHub Desktop.
import com.krab.lazy.*;
import processing.core.PApplet
class Sketch : PApplet() {
companion object {
fun run() {
val art = Sketch()
art.runSketch()
}
}
lateinit var gui: LazyGui
override fun settings() {
size(800,800,P2D)
}
override fun setup() {
this.gui = LazyGui(this)
}
override fun draw() {
background(gui.colorPicker("bg").hex);
}
}
fun main(args: Array<String>) {
Sketch.run()
}
@wrightwriter
Copy link
Author

  1. Create new IntelliJ Kotlin JVM project, without Gradle/Maven
  2. Go to Project Structure and add the processing/core/library/ folder to Libraries
  3. Add LazyGui.jar to Libraries
  4. For processing 4, set SDK under Project to 17. What worked for me is doing "SDK -> Add SDK -> Download JDK -> Amazon Corretto 17"
  5. Paste this code in and run

@wrightwriter
Copy link
Author

This thread has a discussion on Processing under Kotlin - https://discourse.processing.org/t/writing-processing-in-kotlin/3957/30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment