diff --git a/orx-gui/build.gradle b/orx-gui/build.gradle index 78e1c41b..4d50f886 100644 --- a/orx-gui/build.gradle +++ b/orx-gui/build.gradle @@ -1,6 +1,21 @@ +sourceSets { + demo { + java { + srcDirs = ["src/demo/kotlin"] + compileClasspath += main.getCompileClasspath() + runtimeClasspath += main.getRuntimeClasspath() + } + } +} + dependencies { api project(":orx-parameters") api project(":orx-panel") implementation "org.openrndr:openrndr-dialogs:$openrndrVersion" implementation "com.google.code.gson:gson:$gsonVersion" + + demoImplementation("org.openrndr:openrndr-core:$openrndrVersion") + demoRuntimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion") + demoRuntimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion") + demoImplementation(sourceSets.getByName("main").output) } \ No newline at end of file diff --git a/orx-gui/src/demo/kotlin/DemoSimple01.kt b/orx-gui/src/demo/kotlin/DemoSimple01.kt new file mode 100644 index 00000000..0254f896 --- /dev/null +++ b/orx-gui/src/demo/kotlin/DemoSimple01.kt @@ -0,0 +1,34 @@ +import org.openrndr.application +import org.openrndr.color.ColorRGBa +import org.openrndr.extra.gui.GUI +import org.openrndr.extra.parameters.ColorParameter +import org.openrndr.extra.parameters.Description +import org.openrndr.extra.parameters.DoubleParameter +import org.openrndr.extra.parameters.Vector2Parameter +import org.openrndr.math.Vector2 + +/** + * A simple demonstration of a GUI for drawing a single circle + */ +fun main() = application { + program { + val gui = GUI() + val settings = @Description("Settings") object { + @DoubleParameter("radius", 0.0, 100.0) + var radius = 50.0 + + @Vector2Parameter("position", 0.0, 1.0) + var position = Vector2.ZERO + + @ColorParameter("color") + var color = ColorRGBa.PINK + + } + gui.add(settings) + extend(gui) + extend { + drawer.fill = settings.color + drawer.circle(settings.position * drawer.bounds.position(1.0, 1.0), settings.radius) + } + } +} \ No newline at end of file