add mouse button function to commandManager & OnScreenButton
This commit is contained in:
1 parent
747997f46c
commit
1d1d4cbddf
10 files changed
+83
-99
No files matched your search
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
+ (OSCProfilesManager *) sharedManager;
|
||||
+ (void) setOnScreenKeyViewsDict:(NSMutableDictionary* )dict;
|
||||
+ (void) setOnScreenButtonViewsDict:(NSMutableDictionary* )dict;
|
||||
|
||||
#pragma mark - Getters
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
@implementation OSCProfilesManager
|
||||
|
||||
static NSMutableDictionary *onScreenKeyViewsDict;
|
||||
static NSMutableDictionary *onScreenButtonViewsDict;
|
||||
|
||||
#pragma mark - Initializer
|
||||
|
||||
@@ -31,8 +31,8 @@ static NSMutableDictionary *onScreenKeyViewsDict;
|
||||
#pragma mark - Class Helper Methods
|
||||
|
||||
|
||||
+ (void) setOnScreenKeyViewsDict:(NSMutableDictionary* )dict{
|
||||
onScreenKeyViewsDict = dict;
|
||||
+ (void) setOnScreenButtonViewsDict:(NSMutableDictionary* )dict{
|
||||
onScreenButtonViewsDict = dict;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,11 +272,11 @@ static NSMutableDictionary *onScreenKeyViewsDict;
|
||||
}
|
||||
|
||||
// save keyboard button as buttonstate, this is for the new onscreen keyboard buttons:
|
||||
[onScreenKeyViewsDict enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) { // this dict is passed from the layout tool VC, as a static obj in this class.
|
||||
OnScreenKeyboardButtonView *keyView = value;
|
||||
OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:keyView.keyString buttonType:KeyboardButton andPosition:keyView.frame.origin];
|
||||
buttonState.alias = keyView.keyLabel;
|
||||
buttonState.timestamp = keyView.timestamp;
|
||||
[onScreenButtonViewsDict enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) { // this dict is passed from the layout tool VC, as a static obj in this class.
|
||||
OnScreenButtonView *buttonView = value;
|
||||
OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:buttonView.keyString buttonType:KeyboardOrMouseButton andPosition:buttonView.frame.origin];
|
||||
buttonState.alias = buttonView.keyLabel;
|
||||
buttonState.timestamp = buttonView.timestamp;
|
||||
NSData *buttonStateEncoded = [NSKeyedArchiver archivedDataWithRootObject:buttonState requiringSecureCoding:YES error:nil];
|
||||
[buttonStatesEncoded addObject: buttonStateEncoded];
|
||||
}];
|
||||
|
||||
@@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, OnScreenButtonType) {
|
||||
GameControllerButton,
|
||||
KeyboardButton
|
||||
KeyboardOrMouseButton
|
||||
};
|
||||
|
||||
- (id) initWithButtonName:(NSString*)name buttonType:(uint8_t)buttonType andPosition:(CGPoint)position;
|
||||
|
||||
Reference in new issue
Block a user