Window Positions, ini file


#1

Dear ImGui,

Is there a way for dear imgui to load window positions from the / a preference file… other than at startup?
One that already exists, or how I would go about it?

I want to be able to save the layout in a save file, so the user loads their data along with their last window layout from their saved file.

Any tips would be very welcome :slight_smile:

Cheers,
hippy


Guwhitney Houston – and I…e…I…e…I-mgui, will always love you… ohohohhh.


#2

It’s pretty much just reading and parsing an ini file, then dumping the results into IMGUI. I use json from this:

But there’s also simpler options like:


#3

You can use the SetWindowPos, SetWindowSize function (internals or not) to alter position if you have them stored in some way. Note that this won’t be super compatible with advanced upcoming features such as Docking or Multi-Viewport which will require a little more work to alter externally.