Not much progress, here's some info on sailing

This commit is contained in:
Dane Johnson 2023-11-21 09:55:37 -06:00
parent fe9dd562ec
commit 781c06a987
3 changed files with 18 additions and 3 deletions

View File

@ -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.

View File

@ -14,4 +14,6 @@
(reset! ships [virginia-woolfe revenge])
(show-ui)
@tracked-ship

View File

@ -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])))