RE: Save/Load Engine Settings
so now i have a blank - black client
/******************************************************************************/
void SetGuiSkin(int skin)
{
UID id;
switch(skin)
{
default: id=UID(1879466926, 1079990496, 2528492206, 1950274427); break;
case 1: id=UID(4199047452, 1270318192, 2111172003, 2181509925); break;
case 2: id=UID(2132192267, 1141018682, 3823891598, 1391707399); break;
case 3: id=UID(4124413388, 1292094117, 1050269881, 3048952337); break;
}
Gui.skin=skin;
GuiStyle &style=*GuiStyles(UID(1879466926, 1079990496, 2528492206, 1950274427)); // all gui objects in the Gui Editor have this style set, so instead of changing each gui object style to another, we can just load this style from another style
style.load(EncodeFileName(id));
Gui.style_window=style;
}
void SetGui()
{
Ms .cursor(UID(663015471, 1113822760, 3536750729, 3160006226));
Gui.kb_lit.zero();
Gui.image_win_bar=UID(1671466887, 1231605943, 3707119495, 2898284887);
Gui.ts_text.color =WHITE;
Gui.ts_text.shadow=255;
Gui.style_msg_box_region=&Gui.style_region;
Gui.style_region= *GuiStyles(UID(1255553995, 1182662655, 3307630495, 3075817986));
Gui.ts_list =*TextStyles(UID(236481518, 1159883855, 2763641477, 3459702660));
FontDefault = Fonts(UID(1701253065, 1174809470, 3221417129, 1213197705));
SetGuiSkin(Gui.skin);
SelectServer.create();
}
/******************************************************************************/
/******************************************************************************/
void SaveSettings(TextData &data)
{
data.getNode("Width" ).value=S+D.x();
data.getNode("Height" ).value=S+D.y();
data.getNode("Fullscreen").value=S+D.full();
}
void LoadSettings(TextData &data)
{
int x=-1, y=-1, full=-1;
if(TextNode *node =data.findNode("Fullscreen"))full=node .asInt();
if(TextNode *width =data.findNode("Width" ))x =width .asInt();
if(TextNode *height=data.findNode("Height" ))y =height.asInt();
D.mode(x, y, full);
}
void SaveSettings(C Str &name="Settings.txt")
{
TextData settings; SaveSettings(settings); settings.save(name);
}
void LoadSettings(C Str &name="Settings.txt")
{
TextData settings; if(settings.load(name))LoadSettings(settings);
}
/******************************************************************************/
void InitPre()
{
EE_INIT();
App.flag|=APP_MAXIMIZABLE|APP_MINIMIZABLE|APP_RESIZABLE|APP_FULL_TOGGLE;
LoadSettings();
}
bool Init()
{
return true;
}
void Shut()
{
SaveSettings();
}
bool Update()
{
if(Kb.bp(KB_ESC))return false;
return true;
}
void Draw()
{
D.clear();
}
/******************************************************************************/
when i just take out ConfigSave(); it works but nothing saves when I close the client and re open it.
(This post was last modified: 10-16-2013 03:27 AM by docrst.)
|