Skip to content
Michael edited this page Oct 23, 2024 · 24 revisions

Outline of Architecture

app.start/-main

(defn -main []
  (db/load! config/properties)
  (lwjgl3/application (application-listener)
                      config/lwjgl3))
  • So the main parts of the application are:

    • 📜 properties db
    • 🎮 libgdx application

📜 properties db

The component.db namespace handles loading, validating, and managing a database of properties in a Clojure application, using EDN (Extensible Data Notation) for storage. It provides functions to load properties from a file, validate them, and store them in an in-memory db map, where each property is indexed by its property/id. The namespace also includes functionality to update, delete, and fetch properties, as well as migrate and transform properties using schemas and custom edn->value conversion logic. It ensures that data is persisted asynchronously to the original EDN file and can handle nested or related properties via schema-defined relationships.

🎮 libgdx application

Let's have a look at app.start/application-listener:

(defn- application-listener []
  (proxy [ApplicationAdapter] []
    (create []
      (assets/load (app.assets/search config/resources))
      (g/load! config/graphics)
      (vis-ui/load! config/skin-scale)
      (screen/set-screens! [(main-menu/create)
                            (map-editor/create)
                            (property-editor/screen)
                            (world-screen/create)])
      ((world-screen/start-game-fn :worlds/vampire)))

    (dispose []
      (assets/dispose)
      (g/dispose!)
      (vis-ui/dispose!)
      (screen/dispose-all!))

    (render []
      (g/clear-screen)
      (screen/render! (screen/current)))

    (resize [w h]
      (g/resize! [w h]))))
Clone this wiki locally