Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7247 in orxonox.OLD for branches/preferences/src


Ignore:
Timestamp:
Mar 24, 2006, 6:24:41 PM (19 years ago)
Author:
rennerc
Message:

removed several iniParser

Location:
branches/preferences/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/preferences/src/lib/graphics/graphics_engine.cc

    r7221 r7247  
    3030
    3131#include "parser/ini_parser/ini_parser.h"
     32#include "util/preferences.h"
    3233#include "substring.h"
    3334#include "text.h"
     
    154155 * @returns nothing usefull
    155156 */
    156 int GraphicsEngine::initFromIniFile(IniParser* iniParser)
     157int GraphicsEngine::initFromPreferences()
    157158{
    158159  // looking if we are in fullscreen-mode
    159   const std::string fullscreen = iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, "0");
     160  const std::string fullscreen = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO, CONFIG_NAME_FULLSCREEN, "0");
     161
    160162  if (fullscreen[0] == '1' || fullscreen == "true")
    161163    this->fullscreenFlag = SDL_FULLSCREEN;
    162164
    163165  // looking if we are in fullscreen-mode
    164   const std::string textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0");
     166  const std::string textures = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO_ADVANCED, CONFIG_NAME_TEXTURES, "0");
    165167  if (textures[0] == '1' || textures == "true")
    166168    Texture::setTextureEnableState(true);
     
    169171
    170172  // searching for a usefull resolution
    171   SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480").c_str(), 'x'); ///FIXME
     173  SubString resolution(Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO, CONFIG_NAME_RESOLUTION, "640x480").c_str(), 'x'); ///FIXME
    172174  //resolution.debug();
    173175  MultiType x = resolution.getString(0), y = resolution.getString(1);
  • branches/preferences/src/lib/graphics/graphics_engine.h

    r7221 r7247  
    3939
    4040    int init();
    41     int initFromIniFile(IniParser* iniParser);
     41    int initFromPreferences();
    4242
    4343    void setWindowName(const std::string& windowName, const std::string& icon);
  • branches/preferences/src/lib/sound/sound_engine.cc

    r7225 r7247  
    2626#include "util/loading/resource_manager.h"
    2727#include "debug.h"
    28 #include "parser/ini_parser/ini_parser.h"
     28#include "util/preferences.h"
    2929#include "globals.h"
    3030
     
    9797 * @param iniParser the IniParser of the inifile
    9898 */
    99 void SoundEngine::loadSettings(IniParser* iniParser)
    100 {
    101   MultiType channels = iniParser->getVar(CONFIG_NAME_AUDIO_CHANNELS, CONFIG_SECTION_AUDIO, "32");
     99void SoundEngine::loadSettings()
     100{
     101  MultiType channels = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_AUDIO_CHANNELS, "32");
    102102  this->maxSourceCount = channels.getInt();
    103103
    104   MultiType effectsVolume = iniParser->getVar(CONFIG_NAME_EFFECTS_VOLUME, CONFIG_SECTION_AUDIO, "80");
     104  MultiType effectsVolume = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_EFFECTS_VOLUME, "80");
    105105  this->effectsVolume = effectsVolume.getFloat()/100.0;
    106106
    107   MultiType musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "75");
     107  MultiType musicVolume = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_MUSIC_VOLUME, "75");
    108108  this->musicVolume = musicVolume.getFloat()/100.0;
    109109}
  • branches/preferences/src/lib/sound/sound_engine.h

    r7225 r7247  
    3131    inline static SoundEngine* getInstance() { if (!SoundEngine::singletonRef) SoundEngine::singletonRef = new SoundEngine();  return SoundEngine::singletonRef; };
    3232
    33     void loadSettings(IniParser* iniParser);
     33    void loadSettings();
    3434
    3535    SoundSource* createSource(const std::string& fileName, PNode* sourceNode = NULL);
  • branches/preferences/src/orxonox.cc

    r7246 r7247  
    228228  GraphicsEngine::getInstance();
    229229
    230   GraphicsEngine::getInstance()->initFromIniFile(this->iniParser);
     230  GraphicsEngine::getInstance()->initFromPreferences();
    231231
    232232  std::string iconName = ResourceManager::getFullName("pictures/fighter-top-32x32.bmp");
     
    248248  SoundEngine::getInstance();
    249249
    250   SoundEngine::getInstance()->loadSettings(this->iniParser);
     250  SoundEngine::getInstance()->loadSettings();
    251251  SoundEngine::getInstance()->initAudio();
    252252  return 0;
     
    410410  prefs.parse(argc, argv);
    411411 
    412   Preferences::getInstance()->debug();
    413 
    414   assert(false);
     412  //Preferences::getInstance()->debug();
    415413 
    416414  int i;
  • branches/preferences/src/subprojects/framework.cc

    r7193 r7247  
    2323#include "util/loading/resource_manager.h"
    2424#include "camera.h"
    25 #include "parser/ini_parser/ini_parser.h"
     25#include "util/preferences.h"
    2626#include "globals.h"
    2727
     
    3030void Framework::init(void)
    3131{
    32   // create parser
    33   char* configFileName = ResourceManager::homeDirCheck(DEFAULT_CONFIG_FILE);
    34 
    35   IniParser iniParser (configFileName);
    36   delete configFileName;
    37 
    38   GraphicsEngine::getInstance()->initFromIniFile(&iniParser);
     32  GraphicsEngine::getInstance()->initFromPreferences();
    3933
    4034  LightManager::getInstance();
    4135
    4236  const char* dataPath;
    43   if ((dataPath = iniParser.getVar(CONFIG_NAME_DATADIR, CONFIG_SECTION_DATA))!= NULL)
     37  if ((dataPath = Preferences::getInstance()->getString(CONFIG_SECTION_DATA, CONFIG_NAME_DATADIR, ""))!= NULL)
    4438  {
    4539    if (!ResourceManager::getInstance()->setDataDir(dataPath))
Note: See TracChangeset for help on using the changeset viewer.