Hello, I'm trying to wrap my brain around how you might use odoyle-rules to manage the state of a GUI application built using cljfx. I saw odolye-rum, but the code is above my reading comprehension level at the moment. Could you show me how to do something super simple like a button that shows how many times it has been clicked, but using Odoyle? Here's a minimal version using only cljfx and an atom. My current app is using their fx/create-context function, so it's obviously much more involved. But I'm just trying out with a simple tool to see if I can understand what's going on.
(ns cljfx-odolye-test.core
(:require
[cljfx.api :as fx])
(:gen-class))
(def *state
(atom {:count 0}))
(defn counter-button [{:keys [count]}]
{:fx/type :button
:text (str count)
:on-action (fn [_] (swap! *state assoc :count (inc count)))})
(defn root [{:keys [count]}]
{:fx/type :stage
:showing true
:title "Test App"
:scene {:fx/type :scene
:root {:fx/type :v-box
:children [{:fx/type :label
:text "Counter Button"}
{:fx/type counter-button
:count count}]}}})
(def renderer
(fx/create-renderer
:middleware (fx/wrap-map-desc assoc :fx/type root)))
(defn -main
[]
(fx/mount-renderer *state renderer))
Hello, I'm trying to wrap my brain around how you might use odoyle-rules to manage the state of a GUI application built using cljfx. I saw odolye-rum, but the code is above my reading comprehension level at the moment. Could you show me how to do something super simple like a button that shows how many times it has been clicked, but using Odoyle? Here's a minimal version using only cljfx and an atom. My current app is using their
fx/create-contextfunction, so it's obviously much more involved. But I'm just trying out with a simple tool to see if I can understand what's going on.