Pressing a hotkey anywhere in the game switches to GUI editing mode. In this mode, I can drag any GUI element around. I no longer need to re-launch the game several times and check if I’ve set the correct coordinates. I just move it around with the mouse until it looks right, then press Save and I’m done.
All in about 200 lines of code, with full undo/redo support and SQLite persistence. Glad I took the time to do this. It’s not actually super useful in Superforce because there the layouts are finalized but I’m pretty sure I’ll use it for something later. Like, for real.
Here, buttons are made aware of the GUI editing mode and will ignore input when it is enabled.
The GUI editor just handles the dragging. The layout (x, y, w, h) is then saved to disk and that’s pretty much it.