diff --git a/devlog.md b/devlog.md index ca3ddcd..b5ef9f6 100644 --- a/devlog.md +++ b/devlog.md @@ -1,5 +1,10 @@ # Age of Sail Devlog +## Info + +### Physics +- [https://en.wikipedia.org/wiki/Forces_on_sails] + ## TODO ## Log @@ -15,3 +20,8 @@ exactly how navigation will work yet, or if you are going to have to fine-contro Maybe something "Stellaris"-like? That seems appropriate for the scale I am going for. I think priority #1 is _some_ sort of interface. Right now it's just starting parameters and looking some stuff up in a Swing window. + +### 10/21/23 +I think I'm wasting a lot of time on the swing stuff. Today I'm going to focus on the ships. + +UPDATE: Upwind sailing is __so hard__ to wrap my head around. diff --git a/scratches/bootstrap.clj b/scratches/bootstrap.clj index 552c5ee..edb70e8 100644 --- a/scratches/bootstrap.clj +++ b/scratches/bootstrap.clj @@ -14,4 +14,6 @@ (reset! ships [virginia-woolfe revenge]) +(show-ui) + @tracked-ship diff --git a/src/age_of_sail/core.clj b/src/age_of_sail/core.clj index 5a2ebb2..87b308e 100644 --- a/src/age_of_sail/core.clj +++ b/src/age_of_sail/core.clj @@ -8,10 +8,13 @@ (def hardcoded-wind [0.1 3.0]) ;; A strong easternly wind! (defonce ships (atom [])) -(defn list-ships +(defn ship-names + "Gets the names from a list of ships" [ships] (map #(:name @%) ships)) + (defn find-ship + "Finds a ship with the given name" [ships name] (some #(when (= name (:name @%)) %) ships)) @@ -97,8 +100,8 @@ (defn ship-chooser [] - (let [name (combobox :model (list-ships @ships))] - (b/bind ships (b/transform list-ships) (b/property name :model)) + (let [name (combobox :model (ship-names @ships))] + (b/bind ships (b/transform ship-names) (b/property name :model)) (b/bind (b/selection name) (b/transform #(find-ship @ships %)) tracked-ship) (flow-panel :items ["Ship Name" name])))