Changeset 4403 in orxonox.OLD for orxonox/trunk
- Timestamp:
- May 30, 2005, 6:19:25 PM (19 years ago)
- Location:
- orxonox/trunk/src/util/event
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/event/key_mapper.cc
r4402 r4403 73 73 { 74 74 this->setClassID(CL_KEY_MAPPER, "KeyMapper"); 75 this->keyAliases = NULL;76 75 } 77 76 … … 97 96 PRINTF(4)("Loading key bindings from %s\n", fileName); 98 97 99 // remove old bindings if present100 if( this->keyAliases != NULL)101 {102 free (this->keyAliases);103 this->keyAliases = NULL;104 }105 106 98 // create parser 107 99 IniParser parser(fileName); … … 112 104 } 113 105 // allocate empty lookup table 114 this->keyAliases = (KeyBindings*) calloc (1, sizeof (KeyBindings));115 106 116 107 char namebuf[256]; … … 124 115 PRINTF(3)("Keys: Parsing %s, %s now.\n", namebuf, valuebuf); 125 116 index = nameToIndex (valuebuf); 126 117 this->mapKeys(namebuf, index[1]); 118 119 /* 127 120 switch( index[0]) 128 121 { 129 122 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);132 123 this->mapKeys(namebuf, index[1]); 133 124 break; 134 125 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]); 137 127 break; 138 128 default: 139 129 break; 140 130 } 131 */ 141 132 memset (namebuf, 0, 256); 142 133 memset (valuebuf, 0, 256); … … 155 146 PRINTF(3)("MISC: Parsing %s, %s now.\n", namebuf, valuebuf); 156 147 index = nameToIndex (valuebuf); 157 148 this->mapKeys(namebuf, index[1]); 149 /* 158 150 switch( index[0]) 159 151 { 160 152 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]); 163 154 break; 164 155 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]); 167 157 break; 168 158 default: 169 159 break; 170 160 } 161 */ 171 162 memset (namebuf, 0, 256); 172 163 memset (valuebuf, 0, 256); … … 208 199 { 209 200 //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 } 214 206 215 207 //PRINT(0)("=======================================================\n"); -
orxonox/trunk/src/util/event/key_mapper.h
r4402 r4403 67 67 68 68 private: 69 KeyBindings* keyAliases;70 69 Sint32 coord[2]; 71 70 };
Note: See TracChangeset
for help on using the changeset viewer.