starRail pointer veloc tweak enchancement
This commit is contained in:
1 parent
a441670591
commit
1b5f414c89
4 files changed
+29
-7
No files matched your search
@@ -14,7 +14,9 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface NativeTouchHandler : UIResponder
|
@interface NativeTouchHandler : UIResponder
|
||||||
|
@property (nonatomic, assign) bool XBoundaryReached;
|
||||||
|
@property (nonatomic, assign) bool YBoundaryReached;
|
||||||
|
@property (nonatomic, assign) bool flipFlag;
|
||||||
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings;
|
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -44,8 +44,8 @@
|
|||||||
|
|
||||||
[NativeTouchPointer setPointerVelocityDivider:settings.pointerVelocityModeDivider.floatValue];
|
[NativeTouchPointer setPointerVelocityDivider:settings.pointerVelocityModeDivider.floatValue];
|
||||||
[NativeTouchPointer setPointerVelocityFactor:settings.touchPointerVelocityFactor.floatValue];
|
[NativeTouchPointer setPointerVelocityFactor:settings.touchPointerVelocityFactor.floatValue];
|
||||||
[NativeTouchPointer initContextWithView:streamView];
|
[NativeTouchPointer initContextWithView:self->streamView andNativeTouchHandler:self];
|
||||||
|
_flipFlag = true;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,15 @@
|
|||||||
else targetCoords = [touch locationInView:streamView];
|
else targetCoords = [touch locationInView:streamView];
|
||||||
CGPoint location = [streamView adjustCoordinatesForVideoArea:targetCoords];
|
CGPoint location = [streamView adjustCoordinatesForVideoArea:targetCoords];
|
||||||
CGSize videoSize = [streamView getVideoAreaSize];
|
CGSize videoSize = [streamView getVideoAreaSize];
|
||||||
LiSendTouchEvent(touchType,[self retrievePointerIdFromDict:touch],location.x / videoSize.width, location.y / videoSize.height,(touch.force / touch.maximumPossibleForce) / sin(touch.altitudeAngle),0.0f, 0.0f,[streamView getRotationFromAzimuthAngle:[touch azimuthAngleInView:streamView]]);
|
CGFloat normalizedX = location.x / videoSize.width;
|
||||||
|
CGFloat normalizedY = location.y / videoSize.height;
|
||||||
|
uint8_t pointerId = [self retrievePointerIdFromDict:touch];
|
||||||
|
|
||||||
|
_XBoundaryReached = (normalizedX == 1.0f || normalizedX == 0.f);
|
||||||
|
_YBoundaryReached = (normalizedY == 1.0f || normalizedY == 0.f);
|
||||||
|
//if(_XBoundaryReached || _YBoundaryReached) LiSendTouchEvent(LI_TOUCH_EVENT_UP,pointerId, normalizedX, normalizedY, 0, 0, 0, 0);
|
||||||
|
if(_XBoundaryReached || _YBoundaryReached) LiSendTouchEvent(LI_TOUCH_EVENT_UP,pointerId, normalizedX, normalizedY, 0, 0, 0, 0);
|
||||||
|
else LiSendTouchEvent(touchType, pointerId, normalizedX, normalizedY,(touch.force / touch.maximumPossibleForce) / sin(touch.altitudeAngle),0.0f, 0.0f,[streamView getRotationFromAzimuthAngle:[touch azimuthAngleInView:streamView]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "StreamView.h"
|
#import "StreamView.h"
|
||||||
|
#import "NativeTouchHandler.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface NativeTouchPointer : NSObject
|
@interface NativeTouchPointer : NSObject
|
||||||
|
|
||||||
+ (void)initContextWithView:(StreamView *)view;
|
+ (void)initContextWithView:(StreamView *)view andNativeTouchHandler:(NativeTouchHandler*)handler;
|
||||||
|
|
||||||
+ (void)setPointerVelocityDivider:(CGFloat)dividerLocation;
|
+ (void)setPointerVelocityDivider:(CGFloat)dividerLocation;
|
||||||
+ (void)setPointerVelocityFactor:(CGFloat)velocityFactor;
|
+ (void)setPointerVelocityFactor:(CGFloat)velocityFactor;
|
||||||
+ (void)populatePointerObjIntoDict:(UITouch*)touch;
|
+ (void)populatePointerObjIntoDict:(UITouch*)touch;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "NativeTouchPointer.h"
|
#import "NativeTouchPointer.h"
|
||||||
|
#import "NativeTouchHandler.h"
|
||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
|
|
||||||
// native touch pointer ojbect that stores & manipulates touch coordinates
|
// native touch pointer ojbect that stores & manipulates touch coordinates
|
||||||
@@ -17,6 +18,9 @@ static NSMutableDictionary *pointerObjDict;
|
|||||||
static CGFloat pointerVelocityFactor;
|
static CGFloat pointerVelocityFactor;
|
||||||
static CGFloat pointerVelocityDivider;
|
static CGFloat pointerVelocityDivider;
|
||||||
static CGFloat pointerVelocityDividerLocationByPoints;
|
static CGFloat pointerVelocityDividerLocationByPoints;
|
||||||
|
static NativeTouchHandler* nativeTouchHandler;
|
||||||
|
static CGFloat halfScreenHeightInPoints;
|
||||||
|
static CGFloat halfScreenWidthInPoints;
|
||||||
|
|
||||||
StreamView *streamView;
|
StreamView *streamView;
|
||||||
|
|
||||||
@@ -49,12 +53,20 @@ StreamView *streamView;
|
|||||||
previousPoint = latestPoint;
|
previousPoint = latestPoint;
|
||||||
latestPoint = [touch locationInView:streamView];
|
latestPoint = [touch locationInView:streamView];
|
||||||
previousRelativePoint = latestRelativePoint;
|
previousRelativePoint = latestRelativePoint;
|
||||||
|
if(nativeTouchHandler.XBoundaryReached || nativeTouchHandler.YBoundaryReached){ // reset
|
||||||
|
previousRelativePoint.x = halfScreenWidthInPoints;
|
||||||
|
previousRelativePoint.y = halfScreenHeightInPoints;
|
||||||
|
}
|
||||||
latestRelativePoint.x = previousRelativePoint.x + pointerVelocityFactor * (latestPoint.x - previousPoint.x);
|
latestRelativePoint.x = previousRelativePoint.x + pointerVelocityFactor * (latestPoint.x - previousPoint.x);
|
||||||
latestRelativePoint.y = previousRelativePoint.y + pointerVelocityFactor * (latestPoint.y - previousPoint.y);
|
latestRelativePoint.y = previousRelativePoint.y + pointerVelocityFactor * (latestPoint.y - previousPoint.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)initContextWithView:(StreamView *)view{
|
+ (void)initContextWithView:(StreamView *)view andNativeTouchHandler:(NativeTouchHandler*)handler {
|
||||||
streamView = view;
|
streamView = view;
|
||||||
|
nativeTouchHandler = handler;
|
||||||
|
halfScreenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds])/2;
|
||||||
|
halfScreenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds])/2;
|
||||||
pointerObjDict = [NSMutableDictionary dictionary];
|
pointerObjDict = [NSMutableDictionary dictionary];
|
||||||
pointerVelocityDividerLocationByPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]) * pointerVelocityDivider;
|
pointerVelocityDividerLocationByPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]) * pointerVelocityDivider;
|
||||||
NSLog(@"pointerVelocityDivider: %.2f", pointerVelocityDivider);
|
NSLog(@"pointerVelocityDivider: %.2f", pointerVelocityDivider);
|
||||||
|
|||||||
Reference in new issue
Block a user