diff options
author | Simon Howard | 2006-10-23 18:16:02 +0000 |
---|---|---|
committer | Simon Howard | 2006-10-23 18:16:02 +0000 |
commit | d57d467f53271502ebace92a3ff958ca695cd8e9 (patch) | |
tree | 87f294e492a55c414b792c025bbb6e2c198e0b88 /setup/mainmenu.c | |
parent | 30b2e71c09f4de8d8f1d643da27e06ae6b0ea98e (diff) | |
download | chocolate-doom-d57d467f53271502ebace92a3ff958ca695cd8e9.tar.gz chocolate-doom-d57d467f53271502ebace92a3ff958ca695cd8e9.tar.bz2 chocolate-doom-d57d467f53271502ebace92a3ff958ca695cd8e9.zip |
Load configuration on startup and save on quit. Functional setup
program!
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 720
Diffstat (limited to 'setup/mainmenu.c')
-rw-r--r-- | setup/mainmenu.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/setup/mainmenu.c b/setup/mainmenu.c index 23b9f6df..ca29e9cf 100644 --- a/setup/mainmenu.c +++ b/setup/mainmenu.c @@ -23,6 +23,9 @@ #include "config.h" #include "textscreen.h" +#include "configfile.h" +#include "m_argv.h" + #include "compatibility.h" #include "display.h" #include "keyboard.h" @@ -34,7 +37,7 @@ void DoQuit(void *widget, void *dosave) { if (dosave != NULL) { - printf("Saving config\n"); + M_SaveDefaults(); } exit(0); @@ -101,7 +104,24 @@ void MainMenu(void) TXT_SetWindowAction(window, TXT_HORIZ_LEFT, quit_action); } -int main(int argc, char *argv[]) +// +// Initialise all configuration variables, load config file, etc +// + +static void InitConfig(void) +{ + SetChatMacroDefaults(); + SetPlayerNameDefault(); + + M_SetConfigDir(); + M_LoadDefaults(); +} + +// +// Initialise and run the textscreen GUI. +// + +static void RunGUI(void) { TXT_Init(); TXT_SetDesktopTitle(PACKAGE_NAME " Setup ver " PACKAGE_VERSION); @@ -109,6 +129,15 @@ int main(int argc, char *argv[]) MainMenu(); TXT_GUIMainLoop(); +} + +int main(int argc, char *argv[]) +{ + myargc = argc; + myargv = argv; + + InitConfig(); + RunGUI(); return 0; } |