Devlog 11 - Geozi
These two last days were pretty important because I added a lot of stuff, mostly around file handling and one last creative tool:
- File system: new icon in the toolbar, in first position, with a Save/Load submenu. Saving/loading uses the real Windows file picker (
GetSaveFileNameW/GetOpenFileNameW) instead of a custom UI, I had to declare OPENFILENAMEW by hand, a pretty big struct (23 fields) where the field odrer has to match Windows’ ABI exactly or it just breaks silently. Files save as .gsp, a plain text format I made up with one section per object type (POINTS n, CIRCLES n, etc), parsed line by line with no external lib. Split all that into its own storage.rs file.
- Pen tool: last icon in the toolbar, you can draw anywhere on the canvas with a small palette of 8 preset colors (skipped a full RGB slider picker to keep it simple, maybe I can implement it later). Each stroke is just like a polyline of world space points tagged with its color.
- I also moved the hint text (“click the second point” per exemple) from the top-left to the top-right - it was overlapping with the submenus which are all on the left side under their buttons.
The difficult part was making Save/Load play nice with the rest of the app bcz clicking “Save” can’t just fire off the Windows dialog immediately, since I’m still holding a mutable borrow on the app state at that point and the dialog runs its own internal message loop. Same trick I used for the Radius/Sides popups, I set a flag, let the borrow end naturally, then open the dialog after. Also had to bump the toolbar from 7 to 9 buttons so every submenu’s x-position needed shifting