Devlog #12 - Solid, Boring Progress
I’ve spent the last few days making regular feature updates to PSim.
Here are the highlights:
1. Unload Modules
Until now, if a user loaded a module and didn’t want it anymore, he would have to reopen the app. Additionally, there was no way to unload the built-in modules. I added an options tooltip in the module order GUI that allows the user to unload a module and everything it has registered.
2. Confirm Action Menu
If a user is about to do an action which might lead to loss of data (close the window, override a save file), we want to confirm they know about the potential consequences and accept it. For this, I created an interface for creating a blocking modal that forces the user to either confirm an action or cancel it.
3. Graphics Handlers Behavior Improved
The default should obviously be for graphics callbacks to have what they draw to the screen be projected into the actual intended buffer - that is, not anywhere in the top menu bar or the left-hand control panel. This is also already where particles are drawn, so a particle at 0, 0 is drawn in the top-left corner where the top menu bar and control panel intersect. This math had to be applied to every single thing drawn by a graphics callback, and I decided to fix it by calling graphics callbacks while in a raylib 2D mode that offsets everything so that 0, 0 is where a particle at 0,0 is drawn.
4. DPI Scaling
I switched to a new laptop this week, and went from a 14 Inch 1080p screen to a 14 Inch 1440p screen. Suddenly, the menu became much smaller, because the program was drawing by pixel instead of by the system’s default scaling (which, on my new laptop, is 200%). I fixed this by making Raylib scale everything by the user’s system DPI.
5. Module Internal Serialization
If a module has any internal state that should be preserved when a save file is written, it can now register a callback that returns a std::string and a callback that accepts one, and those can be used to serialize and deserialize its internal state.
6. Extended Module API Documentation
I’ve now written documentation for everything but the feature discussed in point 5.
7. New Particle Target
I’ve added a cross target placed in the position where a new particle would be placed according to the Position buffer, to ease on visualizing the new particle. This cross is customizeable in the settings menu and you can change width, length and color.