Skip to content

Commit

Permalink
IOS: Better emulation of the right mouse button
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Bénony committed Jan 6, 2016
1 parent 1657b9d commit fae7995
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 3 additions & 6 deletions backends/platform/ios7/ios7_osys_main.cpp
Expand Up @@ -28,6 +28,7 @@
#include <string.h>

#include <sys/time.h>
#include <QuartzCore/QuartzCore.h>

#include "common/scummsys.h"
#include "common/util.h"
Expand Down Expand Up @@ -196,12 +197,8 @@ void OSystem_iOS7::suspendLoop() {
}

uint32 OSystem_iOS7::getMillis(bool skipRecord) {
//printf("getMillis()\n");

struct timeval currentTime;
gettimeofday(&currentTime, NULL);
return (uint32)(((currentTime.tv_sec - _startTime.tv_sec) * 1000) +
((currentTime.tv_usec - _startTime.tv_usec) / 1000)) - _timeSuspended;
CFTimeInterval timeInSeconds = CACurrentMediaTime();
return (uint32) (timeInSeconds * 1000.0);
}

void OSystem_iOS7::delayMillis(uint msecs) {
Expand Down
10 changes: 10 additions & 0 deletions backends/platform/ios7/ios7_video.mm
Expand Up @@ -340,22 +340,32 @@ - (void)setupGestureRecognizers {
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(twoFingersSwipeRight:)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
swipeRight.numberOfTouchesRequired = 2;
swipeRight.delaysTouchesBegan = NO;
swipeRight.delaysTouchesEnded = NO;

UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(twoFingersSwipeLeft:)];
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
swipeLeft.numberOfTouchesRequired = 2;
swipeLeft.delaysTouchesBegan = NO;
swipeLeft.delaysTouchesEnded = NO;

UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(twoFingersSwipeUp:)];
swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
swipeUp.numberOfTouchesRequired = 2;
swipeUp.delaysTouchesBegan = NO;
swipeUp.delaysTouchesEnded = NO;

UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(twoFingersSwipeDown:)];
swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
swipeDown.numberOfTouchesRequired = 2;
swipeDown.delaysTouchesBegan = NO;
swipeDown.delaysTouchesEnded = NO;

UITapGestureRecognizer *doubleTapTwoFingers = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(twoFingersDoubleTap:)];
doubleTapTwoFingers.numberOfTapsRequired = 2;
doubleTapTwoFingers.numberOfTouchesRequired = 2;
doubleTapTwoFingers.delaysTouchesBegan = NO;
doubleTapTwoFingers.delaysTouchesEnded = NO;

[self addGestureRecognizer:swipeRight];
[self addGestureRecognizer:swipeLeft];
Expand Down

0 comments on commit fae7995

Please sign in to comment.