Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4403 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
May 30, 2005, 6:19:25 PM (19 years ago)
Author:
patrick
Message:

cleaned and finished up the key mapper class

Location:
orxonox/trunk/src/util/event
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/event/key_mapper.cc

    r4402 r4403  
    7373{
    7474   this->setClassID(CL_KEY_MAPPER, "KeyMapper");
    75    this->keyAliases = NULL;
    7675}
    7776
     
    9796  PRINTF(4)("Loading key bindings from %s\n", fileName);
    9897 
    99   // remove old bindings if present
    100   if( this->keyAliases != NULL)
    101     {
    102       free (this->keyAliases);
    103       this->keyAliases = NULL;
    104     }
    105  
    10698  // create parser
    10799  IniParser parser(fileName);
     
    112104    }
    113105  // allocate empty lookup table
    114   this->keyAliases = (KeyBindings*) calloc (1, sizeof (KeyBindings));
    115106 
    116107  char namebuf[256];
     
    124115      PRINTF(3)("Keys: Parsing %s, %s now.\n", namebuf, valuebuf);
    125116      index = nameToIndex (valuebuf);
    126 
     117      this->mapKeys(namebuf, index[1]);
     118
     119      /*
    127120      switch( index[0])
    128121        {
    129122        case 0:
    130           PRINTF(3)("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), namebuf);
    131           strcpy (this->keyAliases->keys[index[1]], namebuf);
    132123          this->mapKeys(namebuf, index[1]);
    133124          break;
    134125        case 1:
    135           PRINTF(3)("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), namebuf);
    136           strcpy (this->keyAliases->buttons[index[1]], namebuf);
     126          this->mapKeys(namebuf, index[1]);
    137127          break;
    138128        default:
    139129          break;
    140130        }
     131      */
    141132      memset (namebuf, 0, 256);
    142133      memset (valuebuf, 0, 256);
     
    155146      PRINTF(3)("MISC: Parsing %s, %s now.\n", namebuf, valuebuf);
    156147      index = nameToIndex (valuebuf);     
    157 
     148      this->mapKeys(namebuf, index[1]);
     149      /*
    158150      switch( index[0])
    159151        {
    160152        case 0:
    161           PRINTF(3)("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), namebuf);
    162           strcpy (keyAliases->keys[index[1]], namebuf);
     153          this->mapKeys(namebuf, index[1]);
    163154          break;
    164155        case 1:
    165           PRINTF(3)("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), namebuf);
    166           strcpy (keyAliases->buttons[index[1]], namebuf);
     156        this->mapKeys(namebuf, index[1]);
    167157          break;
    168158        default:
    169159          break;
    170160        }
     161      */
    171162      memset (namebuf, 0, 256);
    172163      memset (valuebuf, 0, 256);
     
    208199{
    209200  //PRINT(0)("\n==========================| KeyMapper::debug() |===\n"); 
    210   PRINT(0)("PEV_UP = %i\n", PEV_UP);
    211   PRINT(0)("PEV_DOWN = %i\n", PEV_DOWN);
    212   PRINT(0)("PEV_LEFT = %i\n", PEV_LEFT);
    213   PRINT(0)("PEV_RIGHT = %i\n", PEV_RIGHT);
     201
     202  for(int i = 0; map[i].pValue != NULL; ++i)
     203    {
     204      PRINT(0)("%s = %i\n",map[i].pName, *map[i].pValue);
     205    }
    214206
    215207  //PRINT(0)("=======================================================\n");       
  • orxonox/trunk/src/util/event/key_mapper.h

    r4402 r4403  
    6767
    6868 private:
    69   KeyBindings* keyAliases;
    7069  Sint32 coord[2];
    7170};
Note: See TracChangeset for help on using the changeset viewer.