feat: motion control - direct mapping from gyro to mouse or controller sticks, with on-screen button "gyro" for toggling

This commit is contained in:
TrueZhuanjia committed 2025-10-07 23:09:06 +08:00
1 parent 99a2a4ca1a
commit 16a210efa2
29 files changed
+1952 -515

No files matched your search

+17 -1
View File
@@ -16,15 +16,31 @@ NS_ASSUME_NONNULL_BEGIN
#define DEFAULT_TEMPLATE_NAME1 @"控件模板 / Widget templates"
#define DEFAULT_TEMPLATE_NAME2 @"旧版控件 / Legacy widgets"
typedef NS_ENUM(NSInteger, MapGyroTo) {
mapGyroToMouse,
mapGyroToControllerStick,
driftCorrection
};
/**
This object contains information pertaining to any of the user created, custom on screen controller layout configurations, or 'profiles.' The object contains a 'name' property for easy reference, as well as an 'isSelected' property which is used to determine whether this particular custom OSC layout should show on screen during game stream view. Only one 'OSCProfile' is set to 'isSelected' at any given time. The object also contains an array of 'OnScreenButtonStates' which provides information that allows us to move and hide/unhide each of the 19 on screen buttons. Note that the 'buttonStates' property should contain an NSMutableArray of ENCODED 'OnScreenButtonState' objects. This allows us to save the 'OSCProfile' object to NSUserDefaults.
Additionally the 'OSCProfile' object adopts encoding and decoding protocols so that we can encode the object before saving it to NSUserDefaults. By saving this object to NSUserDefaults we allow the user to save and load their custom on screen controller button layouts between app launches
*/
@interface OSCProfile : NSObject <NSCoding, NSSecureCoding>
@interface OSCProfile : NSObject <NSCoding, NSSecureCoding, NSMutableCopying>
@property NSString *name;
@property NSMutableArray <NSData *> *buttonStatesEncoded;
@property BOOL isSelected;
@property (nonatomic, assign) MapGyroTo mapGyroTo;
@property (nonatomic, assign) bool yawPitchToRightStick;
@property (nonatomic, assign) bool rollToLeftStick;
@property (nonatomic, assign) CGFloat gyroSensitivityYaw;
@property (nonatomic, assign) CGFloat gyroSensitivityPitch;
@property (nonatomic, assign) CGFloat gyroSensitivityRoll;
@property (nonatomic, assign) CGFloat accelSensitivityX;
@property (nonatomic, assign) CGFloat accelSensitivityY;
@property (nonatomic, assign) CGFloat accelSensitivityZ;
- (id) initWithName:(NSString*)name buttonStates:(NSMutableArray*)buttonStates isSelected:(BOOL)isSelected;