nandi/jolt-nativepublic Fork 0
356d73fda588d31d8a5891e1b597361725c16be8
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Write dvui's shape in jolt, on SDL3, with no shared object 109c7e4 · on 356d73fda588d31d8a5891e1b597361725c16be8 · Veronika Winters · 10d ago
counter.clj · 25 lines · 859 BClojure Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(ns jvui.counter
  "The smallest thing that shows the calling convention: state is an atom the
   caller owns, and a widget answers what the person did to it."
  (:require [jvui.app :as app]
            [jvui.core :as c]
            [jvui.widgets :as w]))

(def n (atom 0))
(def loud? (atom false))

(defn render []
  (w/page {:max-width 420}
    (w/card {}
      (w/title "Counter")
      (w/label (str "Count: " @n (when @loud? "!")))
      (w/hbox {:spacing 8}
        (when (w/button "- 1") (swap! n dec))
        (when (w/button "+ 1" {:kind :primary}) (swap! n inc))
        (when (w/button "reset") (reset! n 0)))
      (w/separator)
      (reset! loud? (w/checkbox @loud? "Exclaim")))))

(defn -main [& args]
  (app/run! render (cond-> {:title "counter"}
                     (some #{"--shot"} args) (assoc :frames 3 :shot "/tmp/jvui-counter.bmp"))))