Skip to content

Commit

Permalink
Updated to v2 command set
Browse files Browse the repository at this point in the history
  • Loading branch information
thisandagain committed Jul 27, 2011
1 parent f687a7e commit 821483a
Show file tree
Hide file tree
Showing 2 changed files with 583 additions and 692 deletions.
8 changes: 6 additions & 2 deletions Classes/Game.m
Expand Up @@ -111,14 +111,18 @@ - (void)onTouch:(SPTouchEvent *)event
horizontalMove = -100;
}

// UDP command string setup
NSString *verticalString = [NSString stringWithFormat:@"%02.2X", verticalMove];
verticalString = [verticalString substringFromIndex:([verticalString length] - 2)];

NSString *horizontalString = [NSString stringWithFormat:@"%02.2X", horizontalMove];
horizontalString = [horizontalString substringFromIndex:([horizontalString length] - 2)];

NSString *sendString = [NSString stringWithFormat:@"0x42 0x47 0x01 0x40 0x%@ 0x%@", verticalString, horizontalString];

// V1 Command Set:
//NSString *sendString = [NSString stringWithFormat:@"0x42 0x47 0x01 0x40 0x%@ 0x%@", verticalString, horizontalString];
// V2 Command Set:
NSString *sendString = [NSString stringWithFormat:@"BG 0x02 0x88 0x01 0x%@ 0x01 0x%@ 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00", verticalString, horizontalString];

NSData *sendData = [sendString dataUsingEncoding:NSASCIIStringEncoding];

NSLog(@"%@, %@", sendString, sendData);
Expand Down

0 comments on commit 821483a

Please sign in to comment.