Extended Scroll() and OnScroll() to also take in magnitude as one of its parameters. magnitude is currently used in the deck editor to figure out how many cards to rotate around per swipe as function of velocity and the number of cards displayed on the screen.

fixed a compiler warning in SimplePopup in the constructor declaration
===DECK Editor changes ===
Added two touch buttons , one for "Sell Card", the other to switch between Deck and Collection.
changed swipe Left/Right to rotate card collection; removing the previous action which was to swap between deck/collection viewing

Note: GameStateDeckViewer isn't a JGuiController so can't leverage off the mButtons vector.  Thus, the buttons have to be handled by this class separately. (setButtonState, userPressedButton)
This commit is contained in:
techdragon.nguyen@gmail.com
2012-01-26 13:53:03 +00:00
parent dda048c616
commit a2179017d4
20 changed files with 159 additions and 75 deletions

View File

@@ -388,6 +388,15 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170
g_engine->ResetInput();
}
- (int) distanceBetweenPointA: (CGPoint) cp1 andPointB: (CGPoint) cp2
{
int xDist = cp1.x - cp2.x;
int yDist = cp1.y - cp2.y;
int distance = (int) sqrt( (float) ((xDist * xDist) + (yDist + yDist)));
return distance;
}
- (void)handlePanMotion: (UIPanGestureRecognizer *) panGesture
{
@@ -410,21 +419,14 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170
else
{
CGPoint v2 = [panGesture velocityInView: self];
g_engine->Scroll( static_cast<int>(v2.x), static_cast<int>(v2.y));
[self performSelector: @selector(resetInput) withObject: nil afterDelay: 0.1];
int magnitude = [self distanceBetweenPointA: currentLocation andPointB: v2];
g_engine->Scroll( 0 - static_cast<int>(v2.x), 0 - static_cast<int>(v2.y), static_cast<int>(magnitude));
[self performSelector: @selector(resetInput) withObject: nil afterDelay: 0.5];
}
}
}
- (int) distanceBetweenPointA: (CGPoint) cp1 andPointB: (CGPoint) cp2
{
int xDist = cp1.x - cp2.x;
int yDist = cp1.y - cp2.y;
int distance = (int) sqrt( (float) ((xDist * xDist) + (yDist + yDist)));
NSLog(@"distance between Point A: %@ and Point B: %@ is %i", NSStringFromCGPoint(cp1), NSStringFromCGPoint(cp2), distance);
return distance;
}
- (void)handleSingleTap: (UITapGestureRecognizer *) recognizer {
[[[recognizer view] layer] removeAllAnimations];