minor changes
This commit is contained in:
1 parent
c3b7814542
commit
ea98fe1fbf
4 files changed
+21
-21
No files matched your search
@@ -17,12 +17,11 @@ static NSMutableDictionary *pointerObjDict;
|
|||||||
static CGFloat pointerVelocityFactor;
|
static CGFloat pointerVelocityFactor;
|
||||||
static CGFloat pointerVelocityDivider;
|
static CGFloat pointerVelocityDivider;
|
||||||
static CGFloat pointerVelocityDividerLocationByPoints;
|
static CGFloat pointerVelocityDividerLocationByPoints;
|
||||||
static CGFloat screenHeightInPoints;
|
static CGFloat streamViewHeight;
|
||||||
static CGFloat screenWidthInPoints;
|
static CGFloat streamViewWidth;
|
||||||
static CGFloat fixedResetCoordX;
|
static CGFloat fixedResetCoordX;
|
||||||
static CGFloat fixedResetCoordY;
|
static CGFloat fixedResetCoordY;
|
||||||
|
static StreamView* _streamView;
|
||||||
StreamView *streamView;
|
|
||||||
|
|
||||||
@implementation NativeTouchPointer{
|
@implementation NativeTouchPointer{
|
||||||
CGPoint initialPoint;
|
CGPoint initialPoint;
|
||||||
@@ -35,15 +34,15 @@ StreamView *streamView;
|
|||||||
|
|
||||||
- (instancetype)initWithTouch:(UITouch *)touch{
|
- (instancetype)initWithTouch:(UITouch *)touch{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
self->initialPoint = [touch locationInView:streamView];
|
self->initialPoint = [touch locationInView:_streamView];
|
||||||
self->latestPoint = self->initialPoint;
|
self->latestPoint = self->initialPoint;
|
||||||
self->latestRelativePoint = self->initialPoint;
|
self->latestRelativePoint = self->initialPoint;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)doesNeedResetCoords{
|
- (bool)doesNeedResetCoords{
|
||||||
bool boundaryReached = (latestRelativePoint.x > screenWidthInPoints || latestRelativePoint.x < 0.0f || latestRelativePoint.y > screenHeightInPoints || latestRelativePoint.y < 0.0f);
|
bool boundaryReached = (latestRelativePoint.x > streamViewWidth || latestRelativePoint.x < 0.0f || latestRelativePoint.y > streamViewHeight || latestRelativePoint.y < 0.0f);
|
||||||
bool withinExcludedArea = (initialPoint.x > screenWidthInPoints * (0.75) && initialPoint.x < screenWidthInPoints) && (initialPoint.y > screenHeightInPoints * (0.8) && initialPoint.y < screenHeightInPoints);
|
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;
|
_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)
|
// 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.
|
// must exclude touch pointer that uses native coords instead of relative ones.
|
||||||
@@ -54,7 +53,7 @@ StreamView *streamView;
|
|||||||
|
|
||||||
- (void)updatePointerCoords:(UITouch *)touch{
|
- (void)updatePointerCoords:(UITouch *)touch{
|
||||||
previousPoint = latestPoint;
|
previousPoint = latestPoint;
|
||||||
latestPoint = [touch locationInView:streamView];
|
latestPoint = [touch locationInView:_streamView];
|
||||||
previousRelativePoint = latestRelativePoint;
|
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)
|
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;
|
previousRelativePoint.x = fixedResetCoordX;
|
||||||
@@ -65,11 +64,12 @@ StreamView *streamView;
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (void)initContextWithView:(StreamView *)view {
|
+ (void)initContextWithView:(StreamView *)view {
|
||||||
streamView = view;
|
_streamView = view;
|
||||||
screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
streamViewWidth = _streamView.frame.size.width;
|
||||||
fixedResetCoordX = screenWidthInPoints * 0.3;
|
fixedResetCoordX = streamViewWidth * 0.3;
|
||||||
screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
|
streamViewHeight = _streamView.frame.size.height;
|
||||||
fixedResetCoordY = screenHeightInPoints * 0.4;
|
fixedResetCoordY = streamViewHeight * 0.4;
|
||||||
|
NSLog(@"stream wdith %f, stream height %f", streamViewWidth, streamViewHeight);
|
||||||
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);
|
||||||
@@ -116,7 +116,7 @@ StreamView *streamView;
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
pointer -> useRelativeCoords = false;
|
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="onscreenControls" attributeType="Integer 32" defaultValueString="1" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="optimizeGames" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" 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="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="preferredCodec" attributeType="Integer 32" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
|
||||||
<attribute name="showKeyboardToolbar" attributeType="Boolean" defaultValueString="NO" 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"/>
|
<attribute name="statsOverlay" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
|
||||||
|
|||||||
@@ -890,19 +890,19 @@
|
|||||||
"zh-Hans" : {
|
"zh-Hans" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hant" : {
|
"zh-Hant" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-HK" : {
|
"zh-HK" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2102,19 +2102,19 @@
|
|||||||
"zh-Hans" : {
|
"zh-Hans" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hant" : {
|
"zh-Hant" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-HK" : {
|
"zh-HK" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "允许竖屏 (启用后只允许在应用视图中转屏)"
|
"value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user