- feat: vibration available for controller & keyboard direction pad sliding

This commit is contained in:
TrueZhuanjia committed 2025-08-09 23:50:28 +08:00
1 parent c5fc72cc2c
commit 7b5d9cde2e
5 files changed
+20 -10

No files matched your search

+2 -2
View File
@@ -53,7 +53,7 @@ static CGFloat screenWidthInPoints;
} */
_lowestTouchPointHeight = screenHeightInPoints - lowestTouchPointYCoord;
NSLog(@"gen _lowestTouchPointHeight %f markmark", _lowestTouchPointHeight);
// NSLog(@"gen _lowestTouchPointHeight %f markmark", _lowestTouchPointHeight);
if(_immediateTriggering){
lowestTouchPointYCoord = 0.0; //reset for next recoginition
self.state = UIGestureRecognizerStateRecognized;
@@ -81,7 +81,7 @@ static CGFloat screenWidthInPoints;
if((CACurrentMediaTime() - _gestureCapturedTime) < _tapDownTimeThreshold){
lowestTouchPointYCoord = 0.0; //reset for next recognition
self.state = UIGestureRecognizerStateRecognized;
NSLog(@"gen _lowestTouchPointHeight %f markmark touchesEnd", _lowestTouchPointHeight);
// NSLog(@"gen _lowestTouchPointHeight %f markmark touchesEnd", _lowestTouchPointHeight);
}
}
if (allTouchesCount == [touches count]) _isOnScreenControllerBeingPressed = false; // need to reset this flag anyway, when all fingers are lefting
+13 -1
View File
@@ -707,7 +707,15 @@ import UIKit
self.layer.superlayer?.insertSublayer(indicatorLayer, below: self.layer)
// show the indicator based on the touchBeganLocation
indicatorLayer.position = CGPointMake(CGRectGetMinX(self.frame)+touchBeganLocation.x, CGRectGetMinY(self.frame)+touchBeganLocation.y)
let newPosition = CGPointMake(CGRectGetMinX(self.frame)+touchBeganLocation.x, CGRectGetMinY(self.frame)+touchBeganLocation.y)
if indicatorLayer.position != newPosition && vibrationOn {
vibrationGenerator.prepare()
vibrationGenerator.impactOccurred()
// print("vibrationInstance: \(vibrationGenerator)")
}
indicatorLayer.position = newPosition
}
private func handleLrudTouchMove(){
@@ -757,6 +765,7 @@ import UIKit
}
else{
self.upIndicator.removeFromSuperlayer()
self.upIndicator.position = CGPointMake(0, 0)
switch touchPadString {
case "WASDPAD": LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["W"]!,Int8(KEY_ACTION_UP), 0)
case "ARROWPAD": LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["UP_ARROW"]!,Int8(KEY_ACTION_UP), 0)
@@ -775,6 +784,7 @@ import UIKit
}
else{
self.downIndicator.removeFromSuperlayer()
self.downIndicator.position = CGPointMake(0, 0)
switch touchPadString {
case "WASDPAD": LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["S"]!,Int8(KEY_ACTION_UP), 0)
case "ARROWPAD": LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["DOWN_ARROW"]!,Int8(KEY_ACTION_UP), 0)
@@ -793,6 +803,7 @@ import UIKit
}
else{
self.leftIndicator.removeFromSuperlayer()
self.leftIndicator.position = CGPointMake(0, 0)
switch touchPadString {
case "WASDPAD": LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["A"]!,Int8(KEY_ACTION_UP), 0)
case "ARROWPAD": LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["LEFT_ARROW"]!,Int8(KEY_ACTION_UP), 0)
@@ -811,6 +822,7 @@ import UIKit
}
else{
self.rightIndicator.removeFromSuperlayer()
self.rightIndicator.position = CGPointMake(0, 0)
switch touchPadString {
case "WASDPAD": LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["D"]!,Int8(KEY_ACTION_UP), 0)
case "ARROWPAD": LiSendKeyboardEvent(CommandManager.keyboardButtonMappings["RIGHT_ARROW"]!,Int8(KEY_ACTION_UP), 0)
+2 -2
View File
@@ -177,7 +177,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
// we must use [event allTouches] to check if touchLockedForMouseMove is captured, because the UITouch object could be captured by upper layer of UIView(in cases like tap gestures), not passed to the touches callbacks in this class, but still available in [event allTouches]
if(candidateTouch != nil && ![[event allTouches] containsObject:touchLockedForMouseMove]){
touchLockedForMouseMove = candidateTouch;
NSLog(@"Candidate touch for mouse movement locked");
// NSLog(@"Candidate touch for mouse movement locked");
mousePointerTimestamp = CACurrentMediaTime();
initialMousePointerLocation = latestMousePointerLocation = [touchLockedForMouseMove locationInView:streamView];
}
@@ -278,7 +278,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
if(!self->quickTapDetected){
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
}
else NSLog(@"Left mouse button release cancelled, keep pressing down, turning into dragging...");
// else NSLog(@"Left mouse button release cancelled, keep pressing down, turning into dragging...");
// do not release the button if we're still dragging, this will prevent the dragging from being interrupted.
});
+2 -2
View File
@@ -253,7 +253,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
// this method also deals with recovering streamview when local keyboard is turned off
- (void)keyboardWillHide{
NSLog(@"keyboard will hide markmark %f", CACurrentMediaTime());
// NSLog(@"keyboard will hide markmark %f", CACurrentMediaTime());
keyboardToggleRecognizer.numberOfTouchesRequired = settings.keyboardToggleFingers.intValue; // reset this number
if(isInputingText){
@@ -280,7 +280,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void)toggleKeyboard{
NSLog(@"toggleKeyboard markmark, %d", isInputingText);
// NSLog(@"toggleKeyboard markmark, %d", isInputingText);
if (isInputingText) {
Log(LOG_D, @"Closing the keyboard");
[keyInputField resignFirstResponder];
@@ -1566,9 +1566,7 @@ BOOL isCustomResolution(int resolutionSelected) {
}
[self findDynamicLabelFromStack:self.onScreenWidgetStack].text = [self isCustomOswEnabled] ? [LocalizationHelper localizedStringForKey:@"%d finger tap", self->oswLayoutFingers] : @"";
//markmark
[self handleOswGestureChange];
}];
[self handleOswGestureChange];}];
[alertController addAction:cancelAction];
[alertController addAction:okAction];