Dominaezzz / kotlin-imgui

Kotlin bindings for Dear ImGui
MIT License
83 stars 4 forks source link

Generate DSL #2

Closed Dominaezzz closed 4 years ago

Dominaezzz commented 4 years ago

Convenience DSLs like these should be generated.

inline fun ImGui.menuBar(block: () -> Unit) {
    if (beginMenuBar()) {
        try {
            block()
        } finally {
            endMenuBar()
        }
    }
}
inline fun ImGui.withId(id: Int, block: () -> Unit) {
    pushId(id)
    try {
        block()
    } finally {
        popId()
    }
}
Dominaezzz commented 4 years ago

Merged to master.