OPENRNDR 0.3.40 + ORX 0.3.50 released!

Panel, now known as orx-panel, gained a new control called XYPad, that allows you to control a Vector2 value:

fun main() = application {
    configure {
        width = 400
        height = 400
    }

    program {
        val cm = ControlManager()
        var pad: XYPad? = null

        cm.body = layout(cm) {
            pad = xyPad {
                minX = 0.0
                maxX = width.toDouble()
                minY = 0.0
                maxY = height.toDouble()
                invertY = false
            }
        }

        extend(cm)
        extend {
            drawer.background(ColorRGBa.BLACK)
            drawer.circle(pad!!.value, 50.0)
        }
    }
}

It can also be used in orx-gui using XYParameter:

fun main() = application {
    configure {
        width = 800
        height = 800
    }

    program {
        val gui = GUI()

        val settings = @Description("Vector parameter!") 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)
        }
    }
}
1 Like