resizable on-screen sticks & single layer on-screen controller buttons

This commit is contained in:
TrueZhuangjia committed 2024-10-12 19:32:58 +08:00
1 parent 5db6aa0695
commit fadf023563
6 files changed
+163 -54

No files matched your search

@@ -10,6 +10,7 @@
#import "OnScreenButtonState.h"
#import "Moonlight-Swift.h"
#import "LayoutOnScreenControlsViewController.h"
#import "OnScreenControls.h"
@implementation OSCProfilesManager
@@ -269,6 +270,10 @@ static NSMutableDictionary *onScreenButtonViewsDict;
OnScreenButtonState *buttonState = [[OnScreenButtonState alloc] initWithButtonName:oscButtonLayer.name buttonType:GameControllerButton andPosition:oscButtonLayer.position];
// add hidden attr here
buttonState.isHidden = oscButtonLayer.isHidden;
buttonState.oscLayerSizeFactor = [OnScreenControls getControllerLayerSizeFactor:oscButtonLayer];
NSLog(@"oscLayerName: %@, sizeFactor: %f", oscButtonLayer.name, buttonState.oscLayerSizeFactor);
// buttonState.oscLayerSizeFactor = oscButtonLayer.bounds;
NSData *buttonStateEncoded = [NSKeyedArchiver archivedDataWithRootObject:buttonState requiringSecureCoding:YES error:nil];
[buttonStatesEncoded addObject: buttonStateEncoded];
}