Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImGuiStyle serialization/deserialization #61

Closed
ebriney opened this issue Oct 25, 2014 · 6 comments
Closed

ImGuiStyle serialization/deserialization #61

ebriney opened this issue Oct 25, 2014 · 6 comments

Comments

@ebriney
Copy link

ebriney commented Oct 25, 2014

Hi Omar.

There is no way to save/restore style, a cool feature !!!

In a separate file or in .ini would be fine.

@ebriney ebriney changed the title InGuiStyle serialization/deserialization ImGuiStyle serialization/deserialization Oct 25, 2014
@ocornut
Copy link
Owner

ocornut commented Oct 25, 2014

I'm not quite sure to understand the underlying desire here.
Do you mean you are exposing the style editor pane to the end-user and you want them to be able to load/save settings.

I'd like eventually to add ImGui primitives to persistently store the kind of data that are used by tools. Simple end-user options, equivalent to making e.g. a Checkbox value persistent. So style may end up using that system. For now you could just dump the binary structure to a file using fwrite/fread, or use your own serialisation system.

@ebriney
Copy link
Author

ebriney commented Oct 25, 2014

Yes, this is for the end-user and also I want to provide a default layout in my resources by copying imgui.ini.
If i could have a modified style directly from the ini file, it will avoid me to write some code :)
But that's just a suggestion. The default style is very clean for now.

@ocornut
Copy link
Owner

ocornut commented Oct 25, 2014

I agree there is a lack of features to manipulate window size/pos from code, it hasn't occurred to me but I suppose some people may be trying to steer away from the floating-windows size by enforcing certain size/pos. I'll add some primitives for that.
Serialization is less urgent and less likely for now.

@ebriney
Copy link
Author

ebriney commented Oct 25, 2014

I agree for windows manipulation.

@ocornut
Copy link
Owner

ocornut commented Dec 28, 2014

Resurrect old topic, the better window manipulation API was added in this commit:
e9e0e36

You have 6 calls, and the condition flag allows to set a value only once per session, or once if the data doesn't exist in .ini file, or always.

void SetWindowPos(const ImVec2& pos, ImGuiSetCondition cond = 0); // set current window position.
void SetWindowSize(const ImVec2& size, ImGuiSetCondition cond = 0); // set current window size. set to ImVec2(0,0) to force an auto-fit
void SetWindowCollapsed(bool collapsed, ImGuiSetCondition cond = 0); // set current window collapsed state.
void SetNextWindowPos(const ImVec2& pos, ImGuiSetCondition cond = 0); // set next window position.
void SetNextWindowSize(const ImVec2& size, ImGuiSetCondition cond = 0); // set next window size. set to ImVec2(0,0) to force an auto-fit
void SetNextWindowCollapsed(bool collapsed, ImGuiSetCondition cond = 0); // set next window collapsed state.

@ocornut
Copy link
Owner

ocornut commented Dec 30, 2014

I am closing this issue seeing this one contains the same info
#101

Short answer - I am hesitant about encouraging the programmer to encourage the user to persistently manipulate their style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants