D:/Development/Projects/X-Clone/X-Clone/trunk/ConfigOptions.cpp

Go to the documentation of this file.
00001 #include "ConfigOptions.h"
00002 
00003 ConfigOptions::ConfigOptions()
00004 {
00005 
00006 }
00007 
00008 void ConfigOptions::init()
00009 {
00010    createOptionsMap();
00011 }
00012 
00013 void ConfigOptions::deinit()
00014 {
00015 
00016 }
00017 
00018 void ConfigOptions::createOptionsMap() 
00019 {
00020    optionsMap[WIDTH] = "width";
00021    optionsMap[HEIGHT] = "height";
00022    optionsMap[COLOR_DEPTH] = "colorDepth";
00023    optionsMap[FONT] = "font";
00024    optionsMap[MAP] = "map";
00025 }
00026 
00027 bool ConfigOptions::load(string filename)
00028 {
00029    ifstream file(filename.c_str());
00030    po::options_description desc("");
00031    desc.add_options()
00032       (optionsMap[WIDTH], po::value<int>()->default_value(800))
00033       (optionsMap[HEIGHT], po::value<int>()->default_value(600))
00034       (optionsMap[COLOR_DEPTH], po::value<int>()->default_value(16))
00035       (optionsMap[MAP], po::value<string>())
00036       (optionsMap[FONT], po::value<string>());
00037 
00038    po::store(po::parse_config_file(file, desc), _vm);
00039 
00040    return true;
00041 }
00042 

Generated on Fri Sep 22 06:00:26 2006 for X-CLONE by  doxygen 1.4.7