minor changes
This commit is contained in:
@@ -17,12 +17,11 @@ static NSMutableDictionary *pointerObjDict;
|
||||
static CGFloat pointerVelocityFactor;
|
||||
static CGFloat pointerVelocityDivider;
|
||||
static CGFloat pointerVelocityDividerLocationByPoints;
|
||||
static CGFloat screenHeightInPoints;
|
||||
static CGFloat screenWidthInPoints;
|
||||
static CGFloat streamViewHeight;
|
||||
static CGFloat streamViewWidth;
|
||||
static CGFloat fixedResetCoordX;
|
||||
static CGFloat fixedResetCoordY;
|
||||
|
||||
StreamView *streamView;
|
||||
static StreamView* _streamView;
|
||||
|
||||
@implementation NativeTouchPointer{
|
||||
CGPoint initialPoint;
|
||||
@@ -35,15 +34,15 @@ StreamView *streamView;
|
||||
|
||||
- (instancetype)initWithTouch:(UITouch *)touch{
|
||||
self = [super init];
|
||||
self->initialPoint = [touch locationInView:streamView];
|
||||
self->initialPoint = [touch locationInView:_streamView];
|
||||
self->latestPoint = self->initialPoint;
|
||||
self->latestRelativePoint = self->initialPoint;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (bool)doesNeedResetCoords{
|
||||
bool boundaryReached = (latestRelativePoint.x > screenWidthInPoints || latestRelativePoint.x < 0.0f || latestRelativePoint.y > screenHeightInPoints || latestRelativePoint.y < 0.0f);
|
||||
bool withinExcludedArea = (initialPoint.x > screenWidthInPoints * (0.75) && initialPoint.x < screenWidthInPoints) && (initialPoint.y > screenHeightInPoints * (0.8) && initialPoint.y < screenHeightInPoints);
|
||||
bool boundaryReached = (latestRelativePoint.x > streamViewWidth || latestRelativePoint.x < 0.0f || latestRelativePoint.y > streamViewHeight || latestRelativePoint.y < 0.0f);
|
||||
bool withinExcludedArea = (initialPoint.x > streamViewWidth * (0.75) && initialPoint.x < streamViewWidth) && (initialPoint.y > streamViewHeight * (0.8) && initialPoint.y < streamViewHeight);
|
||||
_needResetCoords = (pointerVelocityFactor > 1.0f) && self->useRelativeCoords && boundaryReached && !withinExcludedArea;
|
||||
// boundary detection & coordinates reset to the specific point for HK:StarTrail(needs a very high pointer velocity)
|
||||
// must exclude touch pointer that uses native coords instead of relative ones.
|
||||
@@ -54,7 +53,7 @@ StreamView *streamView;
|
||||
|
||||
- (void)updatePointerCoords:(UITouch *)touch{
|
||||
previousPoint = latestPoint;
|
||||
latestPoint = [touch locationInView:streamView];
|
||||
latestPoint = [touch locationInView:_streamView];
|
||||
previousRelativePoint = latestRelativePoint;
|
||||
if(_needResetCoords){// boundary detection & coordinates reset to the central screen point for HK:StarTrail(needs a very high pointer velocity); // boundary detection & coordinates reset to specific point for HK:StarTrail(needs a very high pointer velocity)
|
||||
previousRelativePoint.x = fixedResetCoordX;
|
||||
@@ -65,11 +64,12 @@ StreamView *streamView;
|
||||
}
|
||||
|
||||
+ (void)initContextWithView:(StreamView *)view {
|
||||
streamView = view;
|
||||
screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
||||
fixedResetCoordX = screenWidthInPoints * 0.3;
|
||||
screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
|
||||
fixedResetCoordY = screenHeightInPoints * 0.4;
|
||||
_streamView = view;
|
||||
streamViewWidth = _streamView.frame.size.width;
|
||||
fixedResetCoordX = streamViewWidth * 0.3;
|
||||
streamViewHeight = _streamView.frame.size.height;
|
||||
fixedResetCoordY = streamViewHeight * 0.4;
|
||||
NSLog(@"stream wdith %f, stream height %f", streamViewWidth, streamViewHeight);
|
||||
pointerObjDict = [NSMutableDictionary dictionary];
|
||||
pointerVelocityDividerLocationByPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]) * pointerVelocityDivider;
|
||||
NSLog(@"pointerVelocityDivider: %.2f", pointerVelocityDivider);
|
||||
@@ -116,7 +116,7 @@ StreamView *streamView;
|
||||
}
|
||||
else{
|
||||
pointer -> useRelativeCoords = false;
|
||||
return[touch locationInView:streamView];
|
||||
return[touch locationInView:_streamView];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<attribute name="onscreenControls" attributeType="Integer 32" defaultValueString="1" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="optimizeGames" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
|
||||
<attribute name="playAudioOnPC" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||
<attribute name="pointerVelocityModeDivider" optional="YES" attributeType="Float" defaultValueString="1" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="pointerVelocityModeDivider" optional="YES" attributeType="Float" defaultValueString="0.5" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="preferredCodec" attributeType="Integer 32" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
|
||||
<attribute name="showKeyboardToolbar" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||
<attribute name="statsOverlay" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||
|
||||
@@ -890,19 +890,19 @@
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2102,19 +2102,19 @@
|
||||
"zh-Hans" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||
}
|
||||
},
|
||||
"zh-Hant" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||
}
|
||||
},
|
||||
"zh-HK" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
||||
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user