jvcleave / ofxImGui

Use ImGui in openFrameworks
292 stars 123 forks source link

Fail to load the previously GUI saved state (locale problem) #78

Open lilive opened 5 years ago

lilive commented 5 years ago

Hi,

I discovered a locale related problem when ImGui load the GUI configuration from the disk. I lose my windows positions and size everytime I start the app.

The problem is that ImGui parse the gui.ini file with the function sscanf, which in my case interpret the commas as numeric dots.

i.e. Pos:60,10 is read as

x = 60.10
y = 0.0

instead of

x = 60.0
y = 10.0

I can fix it by adding:

#include <locale.h>
setlocale(LC_NUMERIC, "C");

in my ofApp.cpp, but this seems dirty to me.

I opened a topic about that in the forum: https://forum.openframeworks.cc/t/problem-with-locale-and-sscanf-ofximgui-related/30178

And this is the occasion to thank you for this addon !