Back Original

Jank – The native Clojure dialect with seamless C++ interop

Easy project management

jank's native build system can find your installed native dependencies or build them from source. Adding a new dependency is a one line change.

(defproject imgui+glfw "0.1-SNAPSHOT"
  :dependencies [[org.jank-lang.commons/imgui-glfw-sys "2026.06-6"]
                 [org.jank-lang.commons/imgui-opengl2-sys "2026.06-6"]
                 [org.jank-lang.commons/gl-sys "2026.06-1"]]
  :plugins [[org.jank-lang/lein-jank "2026.06-2"]]
  :middleware [leiningen.jank/middleware]
  :main imgui+glfw.main
  :profiles {:base {:jank {:target-dir "target/debug"
                           :optimization-level 0}}
             :release {:jank {:target-dir "target/release"
                              :optimization-level 3}}})

jank is great for game dev

jank brings functional, immutable data and REPL-driven development to your game development workflow. With jank, you can reach into C++ whenever you want the extra performance. No bridges, no function/type registration, no marshalling, no callbacks.

(ns imgui+glfw.main
  (:include "GLFW/glfw3.h"
            "imgui.h" "imgui_impl_glfw.h" "imgui_impl_opengl2.h"))

(defn -main []
  (cpp/glfwInit)

  (let [window* (cpp/glfwCreateWindow 400 300
                                      "jank"
                                      cpp/nullptr cpp/nullptr)]
    (cpp/glfwMakeContextCurrent window*)
    (cpp/ImGui.CreateContext)
    (cpp/ImGui_ImplGlfw_InitForOpenGL window* true)
    (cpp/ImGui_ImplOpenGL2_Init)

    (while (cpp/! (cpp/glfwWindowShouldClose window*))
      (cpp/glfwPollEvents)
      (cpp/ImGui_ImplOpenGL2_NewFrame)
      (cpp/ImGui_ImplGlfw_NewFrame)
      (cpp/ImGui.NewFrame)

      (when (cpp/ImGui.Begin "jank")
        (cpp/ImGui.Text "Hello, jank and imgui!"))
      (cpp/ImGui.End)

      (cpp/ImGui.Render)
      (cpp/ImGui_ImplOpenGL2_RenderDrawData (cpp/ImGui.GetDrawData))
      (cpp/glfwSwapBuffers window*))

    (cpp/glfwTerminate)))