accept a string as a keyconfig.plist value - setting the required key to the first character in the string
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@647 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
595893677f
commit
c21dd5fccd
@ -71,6 +71,6 @@
|
||||
<key>key_previous_target</key>
|
||||
<integer>43</integer>
|
||||
<key>key_custom_view</key>
|
||||
<integer>118</integer>
|
||||
<string>v</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -74,7 +74,27 @@ static Quaternion quaternion_identity = { (GLfloat)1.0, (GLfloat)0.0, (GLfloat)0
|
||||
|
||||
- (void) init_keys
|
||||
{
|
||||
NSDictionary *kdic = [ResourceManager dictionaryFromFilesNamed:@"keyconfig.plist" inFolder:@"Config" andMerge:YES];
|
||||
NSMutableDictionary *kdic = [NSMutableDictionary dictionaryWithDictionary:[ResourceManager dictionaryFromFilesNamed:@"keyconfig.plist" inFolder:@"Config" andMerge:YES]];
|
||||
//
|
||||
// pre-process kdic - replace any strings with an integer representing the ASCII value of the first character
|
||||
//
|
||||
int i;
|
||||
NSArray* keys = [kdic allKeys];
|
||||
for (i = 0; i < [keys count]; i++)
|
||||
{
|
||||
id key = [keys objectAtIndex:i];
|
||||
id value = [kdic objectForKey: key];
|
||||
if ([value isKindOfClass:[NSString class]])
|
||||
{
|
||||
char keychar = 0;
|
||||
NSString* keystring = (NSString*)value;
|
||||
if ([keystring length])
|
||||
keychar = [keystring characterAtIndex: 0] & 0x00ff; // uses lower byte of unichar
|
||||
[kdic setObject:[NSNumber numberWithInt:(int)keychar] forKey:key];
|
||||
}
|
||||
}
|
||||
//
|
||||
// set default keys...
|
||||
//
|
||||
key_roll_left = gvArrowKeyLeft;
|
||||
key_roll_right = gvArrowKeyRight;
|
||||
|
Loading…
x
Reference in New Issue
Block a user