mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-02 04:52:38 +02:00
Add an option to enable single-touch A+B combo in iOS, closes #587
This commit is contained in:
@@ -332,6 +332,10 @@ static GB_key_mask_t angleToKeyMask(double angle)
|
||||
else if (CGPointSquaredDistance(point, _layout.selectLocation) <= buttonRadiusSquared) {
|
||||
mask |= GB_KEY_SELECT_MASK;
|
||||
}
|
||||
else if ([[NSUserDefaults standardUserDefaults] boolForKey:@"GBEnableABCombo"] &&
|
||||
CGPointSquaredDistance(point, _layout.abComboLocation) <= buttonRadiusSquared) {
|
||||
mask |= GB_KEY_A_MASK | GB_KEY_B_MASK;
|
||||
}
|
||||
else if (!dpadHandled &&
|
||||
fabs(point.x - _layout.dpadLocation.x) <= dpadRadius &&
|
||||
fabs(point.y - _layout.dpadLocation.y) <= dpadRadius) {
|
||||
|
@@ -85,6 +85,9 @@
|
||||
self.bLocation = (CGPoint){self.bLocation.x + self.cutout, self.bLocation.y};
|
||||
self.startLocation = (CGPoint){self.startLocation.x + self.cutout, self.startLocation.y};
|
||||
self.selectLocation = (CGPoint){self.selectLocation.x + self.cutout, self.selectLocation.y};
|
||||
self.abComboLocation = (CGPoint){(self.aLocation.x + self.bLocation.x) / 2,
|
||||
(self.aLocation.y + self.bLocation.y) / 2};
|
||||
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(resolution, true, 1);
|
||||
[self drawBackground];
|
||||
|
@@ -6,6 +6,7 @@
|
||||
@property (readonly) CGPoint dpadLocation;
|
||||
@property (readonly) CGPoint aLocation;
|
||||
@property (readonly) CGPoint bLocation;
|
||||
@property (readonly) CGPoint abComboLocation;
|
||||
@property (readonly) CGPoint startLocation;
|
||||
@property (readonly) CGPoint selectLocation;
|
||||
- (CGRect)viewRectForOrientation:(UIInterfaceOrientation)orientation;
|
||||
@@ -19,6 +20,7 @@
|
||||
@property CGPoint dpadLocation;
|
||||
@property CGPoint aLocation;
|
||||
@property CGPoint bLocation;
|
||||
@property CGPoint abComboLocation;
|
||||
@property CGPoint startLocation;
|
||||
@property CGPoint selectLocation;
|
||||
@property (readonly) CGSize resolution;
|
||||
|
@@ -321,6 +321,12 @@ static NSString const *typeLightTemp = @"typeLightTemp";
|
||||
return @"Directional input is determined by the touch position.";
|
||||
},
|
||||
},
|
||||
@{
|
||||
@"items": @[
|
||||
@{@"type": typeCheck, @"pref": @"GBEnableABCombo", @"title": @"Single-Touch A+B"},
|
||||
],
|
||||
@"footer": @"Enable this option to allow pressing A+B by touching the space between the two buttons",
|
||||
},
|
||||
@{
|
||||
@"header": @"Horizontal Swipe Behavior",
|
||||
@"items": @[
|
||||
|
@@ -54,6 +54,8 @@
|
||||
round(buttonsCenter.y + buttonsDelta.height / 2)
|
||||
};
|
||||
|
||||
self.abComboLocation = buttonsCenter;
|
||||
|
||||
double controlsTop = self.dpadLocation.y - 80 * self.factor;
|
||||
double middleSpace = self.bLocation.x - buttonRadius - (self.dpadLocation.x + 80 * self.factor);
|
||||
|
||||
|
Reference in New Issue
Block a user