UI construction for new TouchPad profile settings

This commit is contained in:
TrueZhuangjia committed 2025-01-27 22:44:45 +08:00
1 parent 87208b07a5
commit 18fe545533
9 files changed
+264 -125

No files matched your search

+20 -6
View File
@@ -867,24 +867,30 @@ ICAgICAgICAgICAgICA
<constraint firstItem="YLK-IE-ajS" firstAttribute="centerX" secondItem="fZU-G0-fgM" secondAttribute="centerX" id="xm7-a0-8G7"/> <constraint firstItem="YLK-IE-ajS" firstAttribute="centerX" secondItem="fZU-G0-fgM" secondAttribute="centerX" id="xm7-a0-8G7"/>
</constraints> </constraints>
</view> </view>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="Efn-Si-TPp" userLabel="Button Size Slider"> <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="Efn-Si-TPp" userLabel="Widget Size Slider">
<rect key="frame" x="205" y="87" width="420" height="31"/> <rect key="frame" x="205" y="87" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/> <color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider> </slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="ZOF-sL-e7p" userLabel="Button Height Slider"> <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="3.8999999999999999" id="ZOF-sL-e7p" userLabel="Widget Height Slider">
<rect key="frame" x="205" y="122" width="420" height="31"/> <rect key="frame" x="205" y="122" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/> <color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider> </slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.83299999999999996" minValue="0.23000000000000001" maxValue="0.999" id="ZLL-pE-iZh" userLabel="Button Alpha Slider"> <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.83299999999999996" minValue="0.23000000000000001" maxValue="0.999" id="ZLL-pE-iZh" userLabel="Widget Alpha Slider">
<rect key="frame" x="205" y="157" width="420" height="31"/> <rect key="frame" x="205" y="157" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/> <color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider> </slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="3.5" id="FRZ-xP-x2r">
<rect key="frame" x="205" y="192" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Profile:" textAlignment="center" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" id="cRV-Xw-CVi"> <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Profile:" textAlignment="center" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" id="cRV-Xw-CVi">
<rect key="frame" x="632" y="87" width="163" height="102"/> <rect key="frame" x="632" y="87" width="163" height="102"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
@@ -894,6 +900,12 @@ ICAgICAgICAgICAgICA
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="120" minValue="0.0" maxValue="350" id="oc7-kh-RVH">
<rect key="frame" x="205" y="227" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
</subviews> </subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>
@@ -905,17 +917,19 @@ ICAgICAgICAgICAgICA
<toolbarItems/> <toolbarItems/>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/> <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections> <connections>
<outlet property="buttonAndControllerAlphaSlider" destination="ZLL-pE-iZh" id="5OX-P6-YKt"/>
<outlet property="buttonAndControllerHeightSlider" destination="ZOF-sL-e7p" id="OHK-5i-3RY"/>
<outlet property="buttonAndControllerSizeSlider" destination="Efn-Si-TPp" id="CgK-cC-Yo0"/>
<outlet property="chevronImageView" destination="iVZ-Fd-dY7" id="403-Nj-wRx"/> <outlet property="chevronImageView" destination="iVZ-Fd-dY7" id="403-Nj-wRx"/>
<outlet property="chevronView" destination="hKp-ds-86I" id="Og9-aT-zNH"/> <outlet property="chevronView" destination="hKp-ds-86I" id="Og9-aT-zNH"/>
<outlet property="currentProfileLabel" destination="cRV-Xw-CVi" id="Zrb-zn-ptp"/> <outlet property="currentProfileLabel" destination="cRV-Xw-CVi" id="Zrb-zn-ptp"/>
<outlet property="sensitivityFactorSlider" destination="FRZ-xP-x2r" id="Vah-oh-eMp"/>
<outlet property="stickIndicatorOffsetSlider" destination="oc7-kh-RVH" id="f5k-n0-7DM"/>
<outlet property="toolbarRootView" destination="fZU-G0-fgM" id="txP-M2-GKi"/> <outlet property="toolbarRootView" destination="fZU-G0-fgM" id="txP-M2-GKi"/>
<outlet property="toolbarStackView" destination="YLK-IE-ajS" id="j4o-Kp-7Z8"/> <outlet property="toolbarStackView" destination="YLK-IE-ajS" id="j4o-Kp-7Z8"/>
<outlet property="toolbarTopConstraintiPad" destination="Ppb-J1-lXg" id="laN-Zh-lHm"/> <outlet property="toolbarTopConstraintiPad" destination="Ppb-J1-lXg" id="laN-Zh-lHm"/>
<outlet property="trashCanButton" destination="qJs-n8-eV7" id="ubK-qm-Cox"/> <outlet property="trashCanButton" destination="qJs-n8-eV7" id="ubK-qm-Cox"/>
<outlet property="undoButton" destination="F7X-l4-cl3" id="vAI-XQ-hZw"/> <outlet property="undoButton" destination="F7X-l4-cl3" id="vAI-XQ-hZw"/>
<outlet property="widgetAlphaSlider" destination="ZLL-pE-iZh" id="5OX-P6-YKt"/>
<outlet property="widgetHeightSlider" destination="ZOF-sL-e7p" id="OHK-5i-3RY"/>
<outlet property="widgetSizeSlider" destination="Efn-Si-TPp" id="CgK-cC-Yo0"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dev-Ck-vTF" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="dev-Ck-vTF" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+3 -3
View File
@@ -907,9 +907,6 @@ ICAgICAgICAgICAgIA
</constraints> </constraints>
</view> </view>
<connections> <connections>
<outlet property="buttonAndControllerAlphaSlider" destination="P6S-oW-Ewb" id="cTe-T8-LwU"/>
<outlet property="buttonAndControllerHeightSlider" destination="VLi-Mk-ESg" id="6O9-gp-VFZ"/>
<outlet property="buttonAndControllerSizeSlider" destination="DGw-22-vUn" id="iEF-jl-gJ0"/>
<outlet property="chevronImageView" destination="76O-3K-aa8" id="yGv-fM-Ohf"/> <outlet property="chevronImageView" destination="76O-3K-aa8" id="yGv-fM-Ohf"/>
<outlet property="chevronView" destination="Zll-IP-PFt" id="MGR-C0-h57"/> <outlet property="chevronView" destination="Zll-IP-PFt" id="MGR-C0-h57"/>
<outlet property="currentProfileLabel" destination="yJC-bq-EOU" id="6Sn-El-zPG"/> <outlet property="currentProfileLabel" destination="yJC-bq-EOU" id="6Sn-El-zPG"/>
@@ -918,6 +915,9 @@ ICAgICAgICAgICAgIA
<outlet property="toolbarTopConstraintiPhone" destination="wNr-7F-S0i" id="iXe-d3-R7i"/> <outlet property="toolbarTopConstraintiPhone" destination="wNr-7F-S0i" id="iXe-d3-R7i"/>
<outlet property="trashCanButton" destination="dhG-Fo-0GK" id="dv6-TN-2Bj"/> <outlet property="trashCanButton" destination="dhG-Fo-0GK" id="dv6-TN-2Bj"/>
<outlet property="undoButton" destination="Pdg-l4-BvF" id="emD-GI-v2v"/> <outlet property="undoButton" destination="Pdg-l4-BvF" id="emD-GI-v2v"/>
<outlet property="widgetAlphaSlider" destination="P6S-oW-Ewb" id="cTe-T8-LwU"/>
<outlet property="widgetHeightSlider" destination="VLi-Mk-ESg" id="6O9-gp-VFZ"/>
<outlet property="widgetSizeSlider" destination="DGw-22-vUn" id="iEF-jl-gJ0"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ORo-HP-JDj" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="ORo-HP-JDj" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+3 -1
View File
@@ -75,7 +75,9 @@ import UIKit
"OSCR2" : 0] "OSCR2" : 0]
@objc public static let touchPadCmds: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD", "MOUSEPAD", "DPAD", "WASDPAD", "ARROWPAD"] @objc public static let touchPadCmds: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD", "MOUSEPAD", "DPAD", "WASDPAD", "ARROWPAD"]
@objc public static let stickTouchPads: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD"]
@objc public static let nonVectorStickPads: [String] = ["LSPAD", "RSPAD"]
static let keyboardButtonMappings: [String: Int16] = [ static let keyboardButtonMappings: [String: Int16] = [
// Windows Key Codes // Windows Key Codes
"CTRL": 0x11, // VK_CONTROL "CTRL": 0x11, // VK_CONTROL
@@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) NSTimeInterval timestamp; @property (nonatomic, assign) NSTimeInterval timestamp;
@property (nonatomic, assign) CGFloat widthFactor; // for OnScreenButtonView @property (nonatomic, assign) CGFloat widthFactor; // for OnScreenButtonView
@property (nonatomic, assign) CGFloat heightFactor; // for OnScreenButtonView @property (nonatomic, assign) CGFloat heightFactor; // for OnScreenButtonView
@property (nonatomic, assign) CGFloat velocityFactor; // for OnScreenButtonView
@property (nonatomic, assign) CGFloat oscLayerSizeFactor; // for OnScreenController CALayer @property (nonatomic, assign) CGFloat oscLayerSizeFactor; // for OnScreenController CALayer
@property (nonatomic, assign) CGFloat backgroundAlpha; // for OnScreenController CALayer @property (nonatomic, assign) CGFloat backgroundAlpha; // for OnScreenController CALayer
@@ -35,6 +35,7 @@
[encoder encodeBool:self.isHidden forKey:@"isHidden"]; [encoder encodeBool:self.isHidden forKey:@"isHidden"];
[encoder encodeFloat:self.widthFactor forKey:@"widthFactor"]; [encoder encodeFloat:self.widthFactor forKey:@"widthFactor"];
[encoder encodeFloat:self.heightFactor forKey:@"heightFactor"]; [encoder encodeFloat:self.heightFactor forKey:@"heightFactor"];
[encoder encodeFloat:self.velocityFactor forKey:@"velocityFactor"];
[encoder encodeFloat:self.oscLayerSizeFactor forKey:@"oscLayerSizeFactor"]; [encoder encodeFloat:self.oscLayerSizeFactor forKey:@"oscLayerSizeFactor"];
[encoder encodeFloat:self.backgroundAlpha forKey:@"backgroundAlpha"]; [encoder encodeFloat:self.backgroundAlpha forKey:@"backgroundAlpha"];
} }
@@ -49,6 +50,7 @@
self.isHidden = [decoder decodeBoolForKey:@"isHidden"]; self.isHidden = [decoder decodeBoolForKey:@"isHidden"];
self.widthFactor = [decoder decodeFloatForKey:@"widthFactor"]; self.widthFactor = [decoder decodeFloatForKey:@"widthFactor"];
self.heightFactor = [decoder decodeFloatForKey:@"heightFactor"]; self.heightFactor = [decoder decodeFloatForKey:@"heightFactor"];
self.velocityFactor = [decoder decodeFloatForKey:@"velocityFactor"];
self.oscLayerSizeFactor = [decoder decodeFloatForKey:@"oscLayerSizeFactor"]; self.oscLayerSizeFactor = [decoder decodeFloatForKey:@"oscLayerSizeFactor"];
self.backgroundAlpha = [decoder decodeFloatForKey:@"backgroundAlpha"]; self.backgroundAlpha = [decoder decodeFloatForKey:@"backgroundAlpha"];
} }
+52 -26
View File
@@ -8,7 +8,6 @@
import UIKit import UIKit
@objc class OnScreenButtonView: UIView, InstanceProviderDelegate { @objc class OnScreenButtonView: UIView, InstanceProviderDelegate {
// receiving the OnScreenControls instance from delegate // receiving the OnScreenControls instance from delegate
@objc func getOnScreenControlsInstance(_ sender: Any) { @objc func getOnScreenControlsInstance(_ sender: Any) {
@@ -26,16 +25,17 @@ import UIKit
@objc public var keyString: String @objc public var keyString: String
@objc public var timestamp: TimeInterval @objc public var timestamp: TimeInterval
@objc public var pressed: Bool @objc public var pressed: Bool
@objc public var widthFactor: CGFloat @objc public var widthFactor: CGFloat = 1.0
@objc public var heightFactor: CGFloat @objc public var heightFactor: CGFloat = 1.0
@objc public var backgroundAlpha: CGFloat @objc public var backgroundAlpha: CGFloat = 0.5
@objc public var latestTouchLocation: CGPoint @objc public var latestTouchLocation: CGPoint
@objc public var selfViewOnTheRight: Bool = false
private let appWindow: UIView private let appWindow: UIView
private var touchLockedForMoveEvent: UITouch private var touchLockedForMoveEvent: UITouch
// for LSVPAD, RSVPAD // for LSVPAD, RSVPAD
@objc public var deltaX: CGFloat @objc public var deltaX: CGFloat
@objc public var deltaY: CGFloat @objc public var deltaY: CGFloat
@@ -43,21 +43,25 @@ import UIKit
// for LSPAD, RSPAD // for LSPAD, RSPAD
@objc public var offSetX: CGFloat @objc public var offSetX: CGFloat
@objc public var offSetY: CGFloat @objc public var offSetY: CGFloat
// this is for all stick pads and mouse Pad
@objc public var sensitivityFactor: CGFloat = 1.0
// for LSVPAD, RSVPAD, LSPAD, RSPAD // for LSVPAD, RSVPAD, LSPAD, RSPAD
private let crossMarkColor: CGColor = UIColor(white: 1, alpha: 0.7).cgColor private let crossMarkColor: CGColor = UIColor(white: 1, alpha: 0.7).cgColor
private let stickBallColor: CGColor = UIColor(white: 1, alpha: 0.75).cgColor private let stickBallColor: CGColor = UIColor(white: 1, alpha: 0.75).cgColor
private var stickInputScale: CGFloat = 30 private var stickInputScale: CGFloat = 35
private var l3r3Indicator = CAShapeLayer() private var l3r3Indicator = CAShapeLayer()
private var crossMarkLayer = CAShapeLayer() @objc public var crossMarkLayer = CAShapeLayer()
private var stickBallLayer = CAShapeLayer() @objc public var stickBallLayer = CAShapeLayer()
@objc public var stickIndicatorXOffset: CGFloat = 120
// check quick double tap: // check quick double tap:
private var quickDoubleTapDetected: Bool private var quickDoubleTapDetected: Bool
private var touchTapTimeInterval: TimeInterval private var touchTapTimeInterval: TimeInterval
private var touchTapTimeStamp: TimeInterval private var touchTapTimeStamp: TimeInterval
private let QUICK_TAP_TIME_INTERVAL = 0.2 private let QUICK_TAP_TIME_INTERVAL = 0.2
@objc public var stickIndicatorXOffset: CGFloat = 120
// for all LRUD pads // for all LRUD pads
private var upIndicator = CAShapeLayer() private var upIndicator = CAShapeLayer()
@@ -75,7 +79,7 @@ import UIKit
private let label: UILabel private let label: UILabel
// first touch location within the button or pad view (self) // first touch location within the button or pad view (self)
private var touchBeganLocation: CGPoint = .zero @objc public var touchBeganLocation: CGPoint = .zero
// for mousePad // for mousePad
private var mousePointerMoved: Bool private var mousePointerMoved: Bool
@@ -97,9 +101,11 @@ import UIKit
// self.originalBackgroundColor = UIColor(white: 0.2, alpha: 0.7) // self.originalBackgroundColor = UIColor(white: 0.2, alpha: 0.7)
self.timestamp = 0 self.timestamp = 0
self.pressed = false self.pressed = false
self.widthFactor = 1.0 // self.widthFactor = 1.0
self.heightFactor = 1.0 // self.heightFactor = 1.0
self.backgroundAlpha = 0.5 // self.backgroundAlpha = 0.5
// self.velocityFactor = 1.0
self.latestTouchLocation = CGPoint(x: 0, y: 0) self.latestTouchLocation = CGPoint(x: 0, y: 0)
self.deltaX = 0 self.deltaX = 0
self.deltaY = 0 self.deltaY = 0
@@ -294,19 +300,21 @@ import UIKit
//================================================================================================ //================================================================================================
//Indicator overlay for on-screen game controller left or right sticks (non-velocity mode) //Indicator overlay for on-screen game controller left or right sticks (non-vector mode)
// create stick indicator: the crossMark & stickBall: // create stick indicator: the crossMark & stickBall:
private func showStickIndicator(){ @objc public func showStickIndicator(){
// tell if the self button is located on the left or right // tell if the self button is located on the left or right
if(self.storedLocation.x + self.frame.width/2 > self.appWindow.frame.width*0.5){ self.selfViewOnTheRight = (self.storedLocation.x + self.frame.width/2 > self.appWindow.frame.width*0.5)
self.stickIndicatorXOffset = -abs(self.stickIndicatorXOffset) let offsetSign = selfViewOnTheRight ? -1 : 1
let stickMarkerRelativeLocation:CGPoint
if !OnScreenButtonView.editMode {
stickMarkerRelativeLocation = CGPointMake(touchBeganLocation.x + CGFloat(offsetSign) * self.stickIndicatorXOffset, touchBeganLocation.y)
} }
else{ else{
self.stickIndicatorXOffset = abs(self.stickIndicatorXOffset) stickMarkerRelativeLocation = CGPointMake(touchBeganLocation.x, touchBeganLocation.y)
} }
let stickMarkerRelativeLocation = CGPointMake(touchBeganLocation.x + self.stickIndicatorXOffset, touchBeganLocation.y)
self.crossMarkLayer = createAndShowCrossMarkOnTouchPoint(at: stickMarkerRelativeLocation) self.crossMarkLayer = createAndShowCrossMarkOnTouchPoint(at: stickMarkerRelativeLocation)
self.stickBallLayer = createAndShowStickBall(at: stickMarkerRelativeLocation) self.stickBallLayer = createAndShowStickBall(at: stickMarkerRelativeLocation)
} }
@@ -365,11 +373,19 @@ import UIKit
return stickBallLayer return stickBallLayer
} }
private func updateStickBallPosition(){ @objc public func updateStickBallPosition(){
CATransaction.begin() CATransaction.begin()
CATransaction.setDisableActions(true) CATransaction.setDisableActions(true)
self.stickBallLayer.removeAllAnimations() self.stickBallLayer.removeAllAnimations()
self.stickBallLayer.position = CGPointMake(CGRectGetMidX(self.crossMarkLayer.frame) + touchInputToStickBallCoord(input: offSetX), CGRectGetMinY(self.crossMarkLayer.frame) + touchInputToStickBallCoord(input: offSetY)) if !OnScreenButtonView.editMode {
self.stickBallLayer.position = CGPointMake(CGRectGetMidX(self.crossMarkLayer.frame) + touchInputToStickBallCoord(input: offSetX), CGRectGetMinY(self.crossMarkLayer.frame) + touchInputToStickBallCoord(input: offSetY))
}
else{
// illustrate offset distance in edit mode
let offsetSign = self.selfViewOnTheRight ? -1 : 1
let illlustrationPoint = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMaxY(self.frame)/4)
self.stickBallLayer.position = CGPointMake(CGRectGetMidX(self.crossMarkLayer.frame) + CGFloat(offsetSign) * stickIndicatorXOffset, CGRectGetMinY(self.crossMarkLayer.frame))
}
CATransaction.commit() CATransaction.commit()
} }
@@ -775,6 +791,11 @@ import UIKit
center = CGPoint(x: center.x + offsetX, y: center.y + offsetY) center = CGPoint(x: center.x + offsetX, y: center.y + offsetY)
//NSLog("x coord: %f, y coord: %f", self.frame.origin.x, self.frame.origin.y) //NSLog("x coord: %f, y coord: %f", self.frame.origin.x, self.frame.origin.y)
storedLocation = currentLocation // Update initial center for next movement storedLocation = currentLocation // Update initial center for next movement
}
if CommandManager.nonVectorStickPads.contains(self.keyString) {
self.stickBallLayer.removeFromSuperlayer()
self.crossMarkLayer.removeFromSuperlayer()
} }
} }
} }
@@ -791,18 +812,18 @@ import UIKit
switch self.keyString{ switch self.keyString{
case "MOUSEPAD": case "MOUSEPAD":
LiSendMouseMoveEvent(Int16(truncatingIfNeeded: Int(deltaX)), Int16(truncatingIfNeeded: Int(deltaY))) LiSendMouseMoveEvent(Int16(truncatingIfNeeded: Int(deltaX * 1.7 * sensitivityFactor)), Int16(truncatingIfNeeded: Int(deltaY * 1.7 * sensitivityFactor)))
break break
case "LSPAD": case "LSPAD":
self.sendLeftStickTouchPadEvent(inputX: offSetX, inputY: offSetY) self.sendLeftStickTouchPadEvent(inputX: offSetX * sensitivityFactor, inputY: offSetY*sensitivityFactor)
updateStickBallPosition() updateStickBallPosition()
case "RSPAD": case "RSPAD":
self.sendRightStickTouchPadEvent(inputX: offSetX, inputY: offSetY); self.sendRightStickTouchPadEvent(inputX: offSetX * sensitivityFactor, inputY: offSetY * sensitivityFactor);
updateStickBallPosition() updateStickBallPosition()
case "LSVPAD": case "LSVPAD":
self.sendLeftStickTouchPadEvent(inputX: deltaX, inputY: deltaY) self.sendLeftStickTouchPadEvent(inputX: deltaX*1.5167*sensitivityFactor, inputY: deltaY*1.5167*sensitivityFactor)
case "RSVPAD": case "RSVPAD":
self.sendRightStickTouchPadEvent(inputX: deltaX, inputY: deltaY); self.sendRightStickTouchPadEvent(inputX: deltaX*1.5167*sensitivityFactor, inputY: deltaY*1.5167*sensitivityFactor);
case "DPAD", "WASDPAD", "ARROWPAD": case "DPAD", "WASDPAD", "ARROWPAD":
handleLrudTouchMove() handleLrudTouchMove()
default: default:
@@ -917,6 +938,11 @@ import UIKit
superview.layoutIfNeeded() superview.layoutIfNeeded()
setupView(); //re-setup buttonView style setupView(); //re-setup buttonView style
if CommandManager.nonVectorStickPads.contains(self.keyString) {
self.crossMarkLayer.removeFromSuperlayer()
self.stickBallLayer.removeFromSuperlayer()
self.showStickIndicator()}
} }
} }
} }
@@ -37,9 +37,12 @@ NS_ASSUME_NONNULL_BEGIN
@property (strong, nonatomic) OSCProfilesTableViewController *oscProfilesTableViewController; @property (strong, nonatomic) OSCProfilesTableViewController *oscProfilesTableViewController;
@property (nonatomic, assign) NSString *currentProfileName; @property (nonatomic, assign) NSString *currentProfileName;
@property (strong, nonatomic) IBOutlet UILabel *currentProfileLabel; @property (strong, nonatomic) IBOutlet UILabel *currentProfileLabel;
@property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerSizeSlider; @property (strong, nonatomic) IBOutlet UISlider *widgetSizeSlider;
@property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerHeightSlider; @property (strong, nonatomic) IBOutlet UISlider *widgetHeightSlider;
@property (strong, nonatomic) IBOutlet UISlider *buttonAndControllerAlphaSlider; @property (strong, nonatomic) IBOutlet UISlider *widgetAlphaSlider;
@property (strong, nonatomic) IBOutlet UISlider *sensitivityFactorSlider;
@property (strong, nonatomic) IBOutlet UISlider *stickIndicatorOffsetSlider;
@end @end
@@ -29,10 +29,12 @@
bool controllerLayerSelected; bool controllerLayerSelected;
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPhone; __weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPhone;
__weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPad; __weak IBOutlet NSLayoutConstraint *toolbarTopConstraintiPad;
UILabel *buttonSizeSliderLabel; UILabel *widgetSizeSliderLabel;
UILabel *buttonHeightSliderLabel; UILabel *widgetHeightSliderLabel;
UILabel *buttonAlphaSliderLabel; UILabel *widgetAlphaSliderLabel;
UILabel *sensitivitySliderLabel;
UILabel *stickIndicatorOffsetSliderLabel;
UILabel *stickIndicatorOffsetExplain;
} }
@synthesize trashCanButton; @synthesize trashCanButton;
@@ -92,9 +94,12 @@
isToolbarHidden = NO; // keeps track if the toolbar is hidden up above the screen so that we know whether to hide or show it when the user taps the toolbar's hide/show button isToolbarHidden = NO; // keeps track if the toolbar is hidden up above the screen so that we know whether to hide or show it when the user taps the toolbar's hide/show button
buttonSizeSliderLabel = [[UILabel alloc] init]; widgetSizeSliderLabel = [[UILabel alloc] init];
buttonHeightSliderLabel = [[UILabel alloc] init]; widgetHeightSliderLabel = [[UILabel alloc] init];
buttonAlphaSliderLabel = [[UILabel alloc] init]; widgetAlphaSliderLabel = [[UILabel alloc] init];
sensitivitySliderLabel = [[UILabel alloc] init];
stickIndicatorOffsetSliderLabel = [[UILabel alloc] init];
stickIndicatorOffsetExplain = [[UILabel alloc] init];
/* add curve to bottom of chevron tab view */ /* add curve to bottom of chevron tab view */
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.chevronView.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0, 10.0)]; UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.chevronView.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0, 10.0)];
@@ -138,7 +143,7 @@
object:nil]; object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(setButtonViewSliderValues:) selector:@selector(buttonViewSelected:)
name:@"OnScreenButtonViewSelected" name:@"OnScreenButtonViewSelected"
object:nil]; object:nil];
@@ -375,21 +380,37 @@
} }
} }
- (void)setButtonViewSliderValues: (NSNotification *)notification{ - (void)buttonViewSelected: (NSNotification *)notification{
// receive the selected buttonView obj passed from the notification // receive the selected buttonView obj passed from the notification
OnScreenButtonView* buttonView = (OnScreenButtonView* )notification.object; OnScreenButtonView* buttonView = (OnScreenButtonView* )notification.object;
self->buttonViewSelected = true; self->buttonViewSelected = true;
self->controllerLayerSelected = false; self->controllerLayerSelected = false;
self->selectedButtonView = buttonView; self->selectedButtonView = buttonView;
// setup slider values // setup slider values
[self.buttonAndControllerSizeSlider setValue: self->selectedButtonView.widthFactor]; [self.widgetSizeSlider setValue: self->selectedButtonView.widthFactor];
[self.buttonAndControllerHeightSlider setValue: self->selectedButtonView.heightFactor]; [self.widgetHeightSlider setValue: self->selectedButtonView.heightFactor];
[self.buttonAndControllerAlphaSlider setValue: self->selectedButtonView.backgroundAlpha]; [self.widgetAlphaSlider setValue: self->selectedButtonView.backgroundAlpha];
[buttonSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", self->selectedButtonView.widthFactor]]; NSSet *stickAndMouseTouchpads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", @"LSVPAD", @"RSVPAD", @"MOUSEPAD", nil];
[buttonHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self->selectedButtonView.heightFactor]]; NSSet *nonVectorStickPads = [NSSet setWithObjects:@"LSPAD", @"RSPAD", nil];
[buttonAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self->selectedButtonView.backgroundAlpha]];
bool showSensitivityFactorSlider = [stickAndMouseTouchpads containsObject:self->selectedButtonView.keyString];
bool showStickIndicatorOffsetSlider = [nonVectorStickPads containsObject:self->selectedButtonView.keyString];
self.sensitivityFactorSlider.hidden = self->sensitivitySliderLabel.hidden = !showSensitivityFactorSlider;
self.stickIndicatorOffsetSlider.hidden = self->stickIndicatorOffsetExplain.hidden = self->stickIndicatorOffsetSliderLabel.hidden = !showStickIndicatorOffsetSlider;
if(showSensitivityFactorSlider) [sensitivitySliderLabel setText:[LocalizationHelper localizedStringForKey:@"Sensitivity: %.2f", self->selectedButtonView.sensitivityFactor]];
if(showStickIndicatorOffsetSlider){
// illustrating the indicator offset,
[selectedButtonView.stickBallLayer removeFromSuperlayer];
[selectedButtonView.crossMarkLayer removeFromSuperlayer];
selectedButtonView.touchBeganLocation = CGPointMake(CGRectGetWidth(selectedButtonView.frame)/2, CGRectGetHeight(selectedButtonView.frame)/4);
[selectedButtonView showStickIndicator];// this will create the indicator CAShapeLayers
[stickIndicatorOffsetSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Indicator Offset: %.2f \n", self->selectedButtonView.stickIndicatorXOffset]];
}
[widgetSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", self->selectedButtonView.widthFactor]];
[widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self->selectedButtonView.heightFactor]];
[widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self->selectedButtonView.backgroundAlpha]];
} }
- (void)setControllerCALayerSliderValues: (NSNotification *)notification{ - (void)setControllerCALayerSliderValues: (NSNotification *)notification{
@@ -402,58 +423,78 @@
// setup slider values // setup slider values
CGFloat sizeFactor = [OnScreenControls getControllerLayerSizeFactor:controllerLayer]; // calculated sizeFactor from loaded layer bounds. CGFloat sizeFactor = [OnScreenControls getControllerLayerSizeFactor:controllerLayer]; // calculated sizeFactor from loaded layer bounds.
[self.buttonAndControllerSizeSlider setValue:sizeFactor]; [self.widgetSizeSlider setValue:sizeFactor];
[self.buttonAndControllerHeightSlider setValue:sizeFactor]; [self.widgetHeightSlider setValue:sizeFactor];
CGFloat alpha = [self.layoutOSC getControllerLayerOpacity:controllerLayer]; CGFloat alpha = [self.layoutOSC getControllerLayerOpacity:controllerLayer];
[self.buttonAndControllerAlphaSlider setValue:alpha]; [self.widgetAlphaSlider setValue:alpha];
[buttonSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", sizeFactor]]; [widgetSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", sizeFactor]];
[buttonHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", sizeFactor]]; [widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", sizeFactor]];
[buttonAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", alpha]]; [widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", alpha]];
} }
- (void)buttonAndControllerSizeSliderMoved{ - (void)widgetSizeSliderMoved{
[buttonSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", self.buttonAndControllerSizeSlider.value]]; [widgetSizeSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Size: %.2f", self.widgetSizeSlider.value]];
[buttonHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.buttonAndControllerSizeSlider.value]]; // resizing the whole button [widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetSizeSlider.value]]; // resizing the whole button
[self.buttonAndControllerHeightSlider setValue: self.buttonAndControllerSizeSlider.value]; [self.widgetHeightSlider setValue: self.widgetSizeSlider.value];
if(self->selectedButtonView != nil && self->buttonViewSelected){ if(self->selectedButtonView != nil && self->buttonViewSelected){
self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
// when adjusting width, the buttonView height will be syncronized // when adjusting width, the buttonView height will be syncronized
self->selectedButtonView.widthFactor = self->selectedButtonView.heightFactor = self.buttonAndControllerSizeSlider.value; self->selectedButtonView.widthFactor = self->selectedButtonView.heightFactor = self.widgetSizeSlider.value;
[self->selectedButtonView resizeButtonView]; [self->selectedButtonView resizeButtonView];
} }
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){ if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
[self.layoutOSC resizeControllerLayerWith:self->selectedControllerLayer and:self.buttonAndControllerSizeSlider.value]; [self.layoutOSC resizeControllerLayerWith:self->selectedControllerLayer and:self.widgetSizeSlider.value];
} }
} }
- (void)buttonAndControllerHeightSliderMoved{ - (void)widgetHeightSliderMoved{
[buttonHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.buttonAndControllerHeightSlider.value]]; [widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetHeightSlider.value]];
if(self->selectedButtonView != nil && self->buttonViewSelected){ if(self->selectedButtonView != nil && self->buttonViewSelected){
self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change
self->selectedButtonView.heightFactor = self.buttonAndControllerHeightSlider.value; self->selectedButtonView.heightFactor = self.widgetHeightSlider.value;
[self->selectedButtonView resizeButtonView]; [self->selectedButtonView resizeButtonView];
} }
} }
- (void)buttonAndControllerAlphaSliderMoved{ - (void)widgetAlphaSliderMoved{
[buttonAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self.buttonAndControllerAlphaSlider.value]]; [widgetAlphaSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Alpha: %.2f", self.widgetAlphaSlider.value]];
if(self->selectedButtonView != nil && self->buttonViewSelected){ if(self->selectedButtonView != nil && self->buttonViewSelected){
[self->selectedButtonView adjustButtonTransparencyWithAlpha:self.buttonAndControllerAlphaSlider.value]; [self->selectedButtonView adjustButtonTransparencyWithAlpha:self.widgetAlphaSlider.value];
} }
if(self->selectedControllerLayer != nil && self->controllerLayerSelected){ if(self->selectedControllerLayer != nil && self->controllerLayerSelected){
[self.layoutOSC adjustControllerLayerOpacityWith:self->selectedControllerLayer and:self.buttonAndControllerAlphaSlider.value]; [self.layoutOSC adjustControllerLayerOpacityWith:self->selectedControllerLayer and:self.widgetAlphaSlider.value];
} }
return; return;
} }
- (void)sensitivitySliderMoved{
[sensitivitySliderLabel setText:[LocalizationHelper localizedStringForKey:@"Sensitivity: %.2f", self.sensitivityFactorSlider.value]];
if(self->selectedButtonView != nil && self->buttonViewSelected) self->selectedButtonView.sensitivityFactor = self.sensitivityFactorSlider.value;
return;
}
- (void)stickIndicatorOffsetSliderMoved{
[stickIndicatorOffsetSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Indicator Offset: %.2f", self.stickIndicatorOffsetSlider.value]];
if(self->selectedButtonView != nil && self->buttonViewSelected){
self->selectedButtonView.stickIndicatorXOffset = self.stickIndicatorOffsetSlider.value;
[self->selectedButtonView updateStickBallPosition];
}
return;
}
- (void)showIndicatorOffset{
selectedButtonView.touchBeganLocation = CGPointMake(CGRectGetWidth(selectedButtonView.frame)/2, CGRectGetHeight(selectedButtonView.frame)/4);
[selectedButtonView showStickIndicator];
}
- (void)setupProfileLableAndSliders{ - (void)setupProfileLableAndSliders{
// self.currentProfileLabel.frame = CGRectMake(0, 0, 180, 35); // self.currentProfileLabel.frame = CGRectMake(0, 0, 180, 35);
// CGFloat profileLabelXPosition = self.view.bounds.size.width - self.currentProfileLabel.frame.size.width - 20; // CGFloat profileLabelXPosition = self.view.bounds.size.width - self.currentProfileLabel.frame.size.width - 20;
CGFloat sliderXPosition = (self.view.bounds.size.width - self.buttonAndControllerSizeSlider.frame.size.width)/2 ; CGFloat sliderXPosition = (self.view.bounds.size.width - self.widgetSizeSlider.frame.size.width)/2 ;
CGFloat profileLabelXPosition = self.view.bounds.size.width/2 + (self.buttonAndControllerSizeSlider.frame.size.width)/2 + 8; CGFloat profileLabelXPosition = self.view.bounds.size.width/2 + (self.widgetSizeSlider.frame.size.width)/2 + 8;
// Set the label's frame with the calculated x-position // Set the label's frame with the calculated x-position
self.currentProfileLabel.frame = CGRectMake(profileLabelXPosition, self.currentProfileLabel.frame.origin.y, self.currentProfileLabel.frame.size.width, self.currentProfileLabel.frame.size.height); self.currentProfileLabel.frame = CGRectMake(profileLabelXPosition, self.currentProfileLabel.frame.origin.y, self.currentProfileLabel.frame.size.width, self.currentProfileLabel.frame.size.height);
@@ -467,68 +508,117 @@
[self.currentProfileLabel setText:[LocalizationHelper localizedStringForKey:@"Profile: %@",[profilesManager getSelectedProfile].name]]; // display current profile name when profile is being refreshed. [self.currentProfileLabel setText:[LocalizationHelper localizedStringForKey:@"Profile: %@",[profilesManager getSelectedProfile].name]]; // display current profile name when profile is being refreshed.
// button size sliders // button size sliders
self.buttonAndControllerSizeSlider.hidden = NO; self.widgetSizeSlider.hidden = NO;
self.buttonAndControllerSizeSlider.frame = CGRectMake(sliderXPosition, self.buttonAndControllerSizeSlider.frame.origin.y, self.buttonAndControllerSizeSlider.frame.size.width, self.buttonAndControllerSizeSlider.frame.size.height); self.widgetSizeSlider.frame = CGRectMake(sliderXPosition, self.widgetSizeSlider.frame.origin.y, self.widgetSizeSlider.frame.size.width, self.widgetSizeSlider.frame.size.height);
[self.buttonAndControllerSizeSlider addTarget:self action:@selector(buttonAndControllerSizeSliderMoved) forControlEvents:(UIControlEventValueChanged)]; [self.widgetSizeSlider addTarget:self action:@selector(widgetSizeSliderMoved) forControlEvents:(UIControlEventValueChanged)];
buttonSizeSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Widget Size"]; widgetSizeSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Widget Size"];
buttonSizeSliderLabel.font = [UIFont systemFontOfSize:23]; widgetSizeSliderLabel.font = [UIFont systemFontOfSize:18];
buttonSizeSliderLabel.textColor = [UIColor whiteColor]; widgetSizeSliderLabel.textColor = [UIColor whiteColor];
buttonSizeSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5]; widgetSizeSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
buttonSizeSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout widgetSizeSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
// Add slider and label to the view // Add slider and label to the view
[self.view addSubview:buttonSizeSliderLabel]; [self.view addSubview:widgetSizeSliderLabel];
// Use Auto Layout to position the label relative to the slider // Use Auto Layout to position the label relative to the slider
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
// Position the label to the left of the slider // Position the label to the left of the slider
[buttonSizeSliderLabel.trailingAnchor constraintEqualToAnchor:self.buttonAndControllerSizeSlider.leadingAnchor constant:-10], [widgetSizeSliderLabel.trailingAnchor constraintEqualToAnchor:self.widgetSizeSlider.leadingAnchor constant:-10],
// Align vertically with the slider // Align vertically with the slider
[buttonSizeSliderLabel.centerYAnchor constraintEqualToAnchor:self.buttonAndControllerSizeSlider.centerYAnchor] [widgetSizeSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetSizeSlider.centerYAnchor]
]]; ]];
buttonSizeSliderLabel.hidden = NO; widgetSizeSliderLabel.hidden = NO;
// button height sliders // button height sliders
self.buttonAndControllerHeightSlider.hidden = NO; self.widgetHeightSlider.hidden = NO;
self.buttonAndControllerHeightSlider.frame = CGRectMake(sliderXPosition, self.buttonAndControllerHeightSlider.frame.origin.y, self.buttonAndControllerHeightSlider.frame.size.width, self.buttonAndControllerHeightSlider.frame.size.height); self.widgetHeightSlider.frame = CGRectMake(sliderXPosition, self.widgetHeightSlider.frame.origin.y, self.widgetHeightSlider.frame.size.width, self.widgetHeightSlider.frame.size.height);
[self.buttonAndControllerHeightSlider addTarget:self action:@selector(buttonAndControllerHeightSliderMoved) forControlEvents:(UIControlEventValueChanged)]; [self.widgetHeightSlider addTarget:self action:@selector(widgetHeightSliderMoved) forControlEvents:(UIControlEventValueChanged)];
// button height label // button height label
buttonHeightSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Widget Height"]; widgetHeightSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Widget Height"];
buttonHeightSliderLabel.font = [UIFont systemFontOfSize:23]; widgetHeightSliderLabel.font = [UIFont systemFontOfSize:18];
buttonHeightSliderLabel.textColor = [UIColor whiteColor]; widgetHeightSliderLabel.textColor = [UIColor whiteColor];
buttonHeightSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5]; widgetHeightSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
buttonHeightSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout widgetHeightSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
// Add slider and label to the view // Add slider and label to the view
[self.view addSubview:buttonHeightSliderLabel]; [self.view addSubview:widgetHeightSliderLabel];
// Use Auto Layout to position the label relative to the slider // Use Auto Layout to position the label relative to the slider
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
// Position the label to the left of the slider // Position the label to the left of the slider
[buttonHeightSliderLabel.trailingAnchor constraintEqualToAnchor:self.buttonAndControllerHeightSlider.leadingAnchor constant:-10], [widgetHeightSliderLabel.trailingAnchor constraintEqualToAnchor:self.widgetHeightSlider.leadingAnchor constant:-10],
// Align vertically with the slider // Align vertically with the slider
[buttonHeightSliderLabel.centerYAnchor constraintEqualToAnchor:self.buttonAndControllerHeightSlider.centerYAnchor] [widgetHeightSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetHeightSlider.centerYAnchor]
]]; ]];
buttonHeightSliderLabel.hidden = NO; widgetHeightSliderLabel.hidden = NO;
self.buttonAndControllerAlphaSlider.hidden = NO;
self.buttonAndControllerAlphaSlider.frame = CGRectMake(sliderXPosition, self.buttonAndControllerAlphaSlider.frame.origin.y, self.buttonAndControllerAlphaSlider.frame.size.width, self.buttonAndControllerAlphaSlider.frame.size.height);
[self.buttonAndControllerAlphaSlider addTarget:self action:@selector(buttonAndControllerAlphaSliderMoved) forControlEvents:(UIControlEventValueChanged)];
// button alpha label // button alpha label
self.widgetAlphaSlider.hidden = NO;
buttonAlphaSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Widget Alpha"]; self.widgetAlphaSlider.frame = CGRectMake(sliderXPosition, self.widgetAlphaSlider.frame.origin.y, self.widgetAlphaSlider.frame.size.width, self.widgetAlphaSlider.frame.size.height);
buttonAlphaSliderLabel.font = [UIFont systemFontOfSize:23]; [self.widgetAlphaSlider addTarget:self action:@selector(widgetAlphaSliderMoved) forControlEvents:(UIControlEventValueChanged)];
buttonAlphaSliderLabel.textColor = [UIColor whiteColor]; widgetAlphaSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Widget Alpha"];
buttonAlphaSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5]; widgetAlphaSliderLabel.font = [UIFont systemFontOfSize:18];
buttonAlphaSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout widgetAlphaSliderLabel.textColor = [UIColor whiteColor];
widgetAlphaSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
widgetAlphaSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
// Add slider and label to the view // Add slider and label to the view
[self.view addSubview:buttonAlphaSliderLabel]; [self.view addSubview:widgetAlphaSliderLabel];
// Use Auto Layout to position the label relative to the slider // Use Auto Layout to position the label relative to the slider
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
// Position the label to the left of the slider // Position the label to the left of the slider
[buttonAlphaSliderLabel.trailingAnchor constraintEqualToAnchor:self.buttonAndControllerAlphaSlider.leadingAnchor constant:-10], [widgetAlphaSliderLabel.trailingAnchor constraintEqualToAnchor:self.widgetAlphaSlider.leadingAnchor constant:-10],
// Align vertically with the slider // Align vertically with the slider
[buttonAlphaSliderLabel.centerYAnchor constraintEqualToAnchor:self.buttonAndControllerAlphaSlider.centerYAnchor] [widgetAlphaSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetAlphaSlider.centerYAnchor]
]]; ]];
buttonAlphaSliderLabel.hidden = NO; widgetAlphaSliderLabel.hidden = NO;
// sensivity slider
self.sensitivityFactorSlider.hidden = YES;
self.sensitivityFactorSlider.frame = CGRectMake(sliderXPosition, self.sensitivityFactorSlider.frame.origin.y, self.sensitivityFactorSlider.frame.size.width, self.sensitivityFactorSlider.frame.size.height);
[self.sensitivityFactorSlider addTarget:self action:@selector(sensitivitySliderMoved) forControlEvents:(UIControlEventValueChanged)];
sensitivitySliderLabel.text = [LocalizationHelper localizedStringForKey:@"Sensitivity"];
sensitivitySliderLabel.font = [UIFont systemFontOfSize:18];
sensitivitySliderLabel.textColor = [UIColor whiteColor];
sensitivitySliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
sensitivitySliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
// Add slider and label to the view
[self.view addSubview:sensitivitySliderLabel];
// Use Auto Layout to position the label relative to the slider
[NSLayoutConstraint activateConstraints:@[
// Position the label to the left of the slider
[sensitivitySliderLabel.trailingAnchor constraintEqualToAnchor:self.sensitivityFactorSlider.leadingAnchor constant:-10],
// Align vertically with the slider
[sensitivitySliderLabel.centerYAnchor constraintEqualToAnchor:self.sensitivityFactorSlider.centerYAnchor]
]];
sensitivitySliderLabel.hidden = self.sensitivityFactorSlider.hidden;
// stick indicator offset slider
self.stickIndicatorOffsetSlider.hidden = YES;
self.stickIndicatorOffsetSlider.frame = CGRectMake(sliderXPosition, self.stickIndicatorOffsetSlider.frame.origin.y, self.stickIndicatorOffsetSlider.frame.size.width, self.stickIndicatorOffsetSlider.frame.size.height); // make this label bigger to show some tips
[self.stickIndicatorOffsetSlider addTarget:self action:@selector(stickIndicatorOffsetSliderMoved) forControlEvents:(UIControlEventValueChanged)];
stickIndicatorOffsetSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Indicator Offset"];
stickIndicatorOffsetSliderLabel.font = [UIFont systemFontOfSize:18];
stickIndicatorOffsetSliderLabel.textColor = [UIColor whiteColor];
stickIndicatorOffsetSliderLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
stickIndicatorOffsetSliderLabel.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
// tips for stick indicator
stickIndicatorOffsetExplain.text = [LocalizationHelper localizedStringForKey:@"Cross: assumed touch point. Ball: indicator location"];
//stickIndicatorOffsetExplain.frame = CGRectMake(sliderXPosition, self.stickIndicatorOffsetSlider.frame.origin.y + self.stickIndicatorOffsetSlider.frame.size.height, self.stickIndicatorOffsetSlider.frame.size.width, self.stickIndicatorOffsetSlider.frame.size.height); // label bigger show some tips
stickIndicatorOffsetExplain.font = [UIFont systemFontOfSize:18];
stickIndicatorOffsetExplain.textColor = [UIColor whiteColor];
stickIndicatorOffsetExplain.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
stickIndicatorOffsetExplain.translatesAutoresizingMaskIntoConstraints = NO; // Disable autoresizing mask for Auto Layout
// Add slider and label to the view
[self.view addSubview:stickIndicatorOffsetSliderLabel];
[self.view addSubview:stickIndicatorOffsetExplain];
// Use Auto Layout to position the label relative to the slider
[NSLayoutConstraint activateConstraints:@[
// Position the label to the left of the slider
[stickIndicatorOffsetSliderLabel.trailingAnchor constraintEqualToAnchor:self.stickIndicatorOffsetSlider.leadingAnchor constant:-10],
// Align vertically with the slider
[stickIndicatorOffsetSliderLabel.centerYAnchor constraintEqualToAnchor:self.stickIndicatorOffsetSlider.centerYAnchor],
// Position the explain label
[stickIndicatorOffsetExplain.centerXAnchor constraintEqualToAnchor:self.stickIndicatorOffsetSlider.leadingAnchor constant:-10],
[stickIndicatorOffsetExplain.topAnchor constraintEqualToAnchor:self.stickIndicatorOffsetSlider.bottomAnchor]
]];
stickIndicatorOffsetSliderLabel.hidden = stickIndicatorOffsetExplain.hidden = self.stickIndicatorOffsetSlider.hidden;
} }
@@ -590,12 +680,12 @@
[self OSCLayoutChanged]; // fades the 'Undo Button' out [self OSCLayoutChanged]; // fades the 'Undo Button' out
}; };
self.currentProfileLabel.hidden = YES; // Hide Current Profile display before entering the profile table view self.currentProfileLabel.hidden = YES; // Hide Current Profile display before entering the profile table view
self.buttonAndControllerSizeSlider.hidden = YES; self.widgetSizeSlider.hidden = YES;
self.buttonAndControllerHeightSlider.hidden = YES; self.widgetHeightSlider.hidden = YES;
self.buttonAndControllerAlphaSlider.hidden = YES; self.widgetAlphaSlider.hidden = YES;
buttonSizeSliderLabel.hidden = YES; widgetSizeSliderLabel.hidden = YES;
buttonHeightSliderLabel.hidden = YES; widgetHeightSliderLabel.hidden = YES;
buttonAlphaSliderLabel.hidden = YES; widgetAlphaSliderLabel.hidden = YES;
_oscProfilesTableViewController.currentOSCButtonLayers = self.layoutOSC.OSCButtonLayers; _oscProfilesTableViewController.currentOSCButtonLayers = self.layoutOSC.OSCButtonLayers;
[self presentViewController:_oscProfilesTableViewController animated:YES completion:nil]; [self presentViewController:_oscProfilesTableViewController animated:YES completion:nil];
} }
+5 -5
View File
@@ -2552,30 +2552,30 @@
} }
}, },
"yJC-bq-EOU.text" : { "yJC-bq-EOU.text" : {
"comment" : "Class = \"UILabel\"; text = \"Current Profile:\"; ObjectID = \"yJC-bq-EOU\";", "comment" : "Class = \"UILabel\"; text = \"Profile:\"; ObjectID = \"yJC-bq-EOU\";",
"extractionState" : "extracted_with_value", "extractionState" : "extracted_with_value",
"localizations" : { "localizations" : {
"en" : { "en" : {
"stringUnit" : { "stringUnit" : {
"state" : "new", "state" : "new",
"value" : "Current Profile:" "value" : "Profile:"
} }
}, },
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "当前布局:" "value" : "当前布局:"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "当前布局:" "value" : "当前布局:"
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "当前布局:" "value" : "当前布局:"
} }
} }