Skip to content

Kotlin DSL #358

@Lyzev

Description

@Lyzev

I would like to add Kotlin DSL support to make the lib more usable for Kotlin users, similar to what https://github.com/kotlin-graphics/imgui (this lib is not maintained thats why it would be nice to add this feature to this lib) does.

This would allow Kotlin code like this:

with(ImGui) {
    text("Hello, world %d", 123)
    button("Save") {
        // do stuff
    }
    inputText("string", buf)
    sliderFloat("float", ::f, 0f, 1f)
}

I am not quite sure if a PR like this would be accepted since it requires adding the Kotlin Gradle plugin, which adds bloat (Kotlin lib). I considered implementing it in Java to avoid this, but Kotlin's inline functions don't translate well to Java and the code would be unreadable/unmaintainable.

I'm happy to submit a PR for this if you're open to it. Otherwise, feel free to close this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions