Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 24, 2006, 7:03:22 PM (18 years ago)
Author:
rennerc
Message:

removed some more iniParsers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/preferences/src/lib/event/key_mapper.cc

    r7221 r7248  
    2525#include "globals.h"
    2626#include "parser/ini_parser/ini_parser.h"
     27#include "util/preferences.h"
    2728#include "key_names.h"
    2829#include "debug.h"
     
    145146
    146147  iniParser->firstVar();
    147   while(iniParser->getCurrentName() != "")
     148  while( iniParser->getCurrentName() != "" )
    148149  {
    149150    PRINTF(3)("Keys: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());
     
    164165
    165166  iniParser->firstVar();
    166   while(iniParser->getCurrentName() != "")
     167  while( iniParser->getCurrentName() != "" )
    167168  {
    168169    PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());
     
    170171    this->mapKeys(iniParser->getCurrentName(), index);
    171172    iniParser->nextVar();
     173  }
     174}
     175
     176void KeyMapper::loadKeyBindings()
     177{
     178  if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_PLAYER "1"))
     179  {
     180    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n");
     181    return;
     182  }
     183  int* index;
     184
     185  std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_PLAYER "1");
     186  for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
     187  {
     188    PRINTF(0)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, "").c_str());
     189    // map the name to an sdl index
     190    index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, ""));
     191    // map the index to a internal name
     192    this->mapKeys(*it, index);
     193  }
     194
     195
     196  // PARSE MISC SECTION
     197  if( !Preferences::getInstance()->sectionExists (CONFIG_SECTION_MISC_KEYS))
     198  {
     199    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_MISC_KEYS "\n");
     200    return;
     201  }
     202
     203  keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_MISC_KEYS);
     204  for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
     205  {
     206    PRINTF(3)("MISC: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, "").c_str());
     207    index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, ""));
     208    this->mapKeys(*it, index);
    172209  }
    173210}
Note: See TracChangeset for help on using the changeset viewer.