mirror of https://github.com/LIJI32/SameBoy.git
Minor stylistic changes
This commit is contained in:
parent
3bf94d281a
commit
d42aad2b84
|
@ -258,10 +258,9 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a discovery session to gather the capture devices (all back cameras as well as the front camera)
|
// Use a discovery session to gather the capture devices (all back cameras as well as the front camera)
|
||||||
AVCaptureDeviceDiscoverySession *cameraDiscoverySession = [AVCaptureDeviceDiscoverySession
|
AVCaptureDeviceDiscoverySession *cameraDiscoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:deviceTypes
|
||||||
discoverySessionWithDeviceTypes:deviceTypes
|
mediaType:AVMediaTypeVideo
|
||||||
mediaType:AVMediaTypeVideo
|
position:AVCaptureDevicePositionUnspecified];
|
||||||
position:AVCaptureDevicePositionUnspecified];
|
|
||||||
_allCaptureDevices = cameraDiscoverySession.devices;
|
_allCaptureDevices = cameraDiscoverySession.devices;
|
||||||
|
|
||||||
// Filter only the back cameras into a list used for switching between them
|
// Filter only the back cameras into a list used for switching between them
|
||||||
|
@ -306,8 +305,8 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UIImage *rotateImage = [[UIImage imageNamed:@"CameraRotateTemplate"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
UIImage *rotateImage = [[UIImage imageNamed:@"CameraRotateTemplate"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||||
[_cameraPositionButton setImage:rotateImage
|
[_cameraPositionButton setImage:rotateImage
|
||||||
forState:UIControlStateNormal];
|
forState:UIControlStateNormal];
|
||||||
_cameraPositionButton.backgroundColor = [UIColor whiteColor];
|
_cameraPositionButton.backgroundColor = [UIColor whiteColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,7 +742,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
|
||||||
_backgroundView.bounds.size.height - 8 - insets.bottom - 32,
|
_backgroundView.bounds.size.height - 8 - insets.bottom - 32,
|
||||||
32,
|
32,
|
||||||
32);
|
32);
|
||||||
if (_changeCameraButton != nil) {
|
if (_changeCameraButton) {
|
||||||
_changeCameraButton.frame = CGRectMake(insets.left + 8,
|
_changeCameraButton.frame = CGRectMake(insets.left + 8,
|
||||||
_backgroundView.bounds.size.height - 8 - insets.bottom - 32 - 32 - 8,
|
_backgroundView.bounds.size.height - 8 - insets.bottom - 32 - 32 - 8,
|
||||||
32,
|
32,
|
||||||
|
@ -1250,12 +1249,14 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
|
||||||
_cameraPositionButton.alpha = 1;
|
_cameraPositionButton.alpha = 1;
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
if (_changeCameraButton != nil) {
|
if (_changeCameraButton) {
|
||||||
// The change camera button is only available when we are using a capture device on the back of the device
|
// The change camera button is only available when we are using a capture device on the back of the device
|
||||||
int changeCameraButtonAlpha = (_cameraPosition == AVCaptureDevicePositionFront) ? 0 : 1;
|
double changeCameraButtonAlpha = (_cameraPosition == AVCaptureDevicePositionFront) ? 0 : 1;
|
||||||
[UIView animateWithDuration:0.25 animations:^{
|
if (changeCameraButtonAlpha != _changeCameraButton.alpha) {
|
||||||
_changeCameraButton.alpha = changeCameraButtonAlpha;
|
[UIView animateWithDuration:0.25 animations:^{
|
||||||
}];
|
_changeCameraButton.alpha = changeCameraButtonAlpha;
|
||||||
|
}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_disableCameraTimer = [NSTimer scheduledTimerWithTimeInterval:1
|
_disableCameraTimer = [NSTimer scheduledTimerWithTimeInterval:1
|
||||||
|
@ -1266,12 +1267,10 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
|
||||||
_cameraPositionButton.alpha = 0;
|
_cameraPositionButton.alpha = 0;
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
if (_changeCameraButton != nil) {
|
if (_changeCameraButton.alpha) {
|
||||||
if (_changeCameraButton.alpha) {
|
[UIView animateWithDuration:0.25 animations:^{
|
||||||
[UIView animateWithDuration:0.25 animations:^{
|
_changeCameraButton.alpha = 0;
|
||||||
_changeCameraButton.alpha = 0;
|
}];
|
||||||
}];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dispatch_async(_cameraQueue, ^{
|
dispatch_async(_cameraQueue, ^{
|
||||||
[_cameraSession stopRunning];
|
[_cameraSession stopRunning];
|
||||||
|
|
Loading…
Reference in New Issue