diff --git a/sparrow/src/Classes/SPButton.m b/sparrow/src/Classes/SPButton.m index 3ebcba1e..a0391248 100644 --- a/sparrow/src/Classes/SPButton.m +++ b/sparrow/src/Classes/SPButton.m @@ -25,7 +25,7 @@ @implementation SPButton { - SPTexture *_upState; + SPTexture *__nonnull _upState; SPTexture *_downState; SPTexture *_disabledState; @@ -221,7 +221,7 @@ - (void)onTouch:(SPTouchEvent *)touchEvent #pragma mark Private -- (void)setStateTexture:(SPTexture *)texture +- (void)setStateTexture:(SPTexture * _Nonnull)texture { _body.texture = texture ?: _upState; } diff --git a/sparrow/src/Classes/SPFrameBuffer.h b/sparrow/src/Classes/SPFrameBuffer.h index 8a2bf143..47502a2e 100644 --- a/sparrow/src/Classes/SPFrameBuffer.h +++ b/sparrow/src/Classes/SPFrameBuffer.h @@ -42,7 +42,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)present; /// Draws the framebuffer to an image. -- (UIImage *)drawToImageInRegion:(SPRectangle *)region; +- (UIImage *)drawToImageInRegion:(nullable SPRectangle *)region; /// Returns the framebuffer's drawable object or nil if this a texture based framebuffer. @property (nonatomic, readonly, nullable) id drawable; diff --git a/sparrow/src/Classes/SPViewController.m b/sparrow/src/Classes/SPViewController.m index e13bfcd2..1f13adf1 100644 --- a/sparrow/src/Classes/SPViewController.m +++ b/sparrow/src/Classes/SPViewController.m @@ -228,6 +228,7 @@ - (void)updateViewPort:(BOOL)forceUpdate SPEvent *resizeEvent = [[SPResizeEvent alloc] initWithType:SPEventTypeResize width:newWidth height:newHeight]; [_stage broadcastEvent:resizeEvent]; + [resizeEvent release]; } } } @@ -517,6 +518,8 @@ - (void)loadView - (void)viewDidLoad { + [super viewDidLoad]; + if (!_overlayView) { _overlayView = [[SPOverlayView alloc] initWithFrame:_internalView.frame]; @@ -628,16 +631,23 @@ - (void)processTouchEvent:(UIEvent *)event touch.previousGlobalY = previousLocation.y * yConversion; touch.tapCount = (int)uiTouch.tapCount; touch.phase = (SPTouchPhase)uiTouch.phase; -#pragma clang diagnostic push -#pragma ide diagnostic ignored "UnavailableInDeploymentTarget" - if ([uiTouch respondsToSelector:@selector(force)] && uiTouch.maximumPossibleForce > 0) { + touch.touchID = (size_t)uiTouch; + + #pragma clang diagnostic push + #pragma ide diagnostic ignored "UnavailableInDeploymentTarget" + + if ([uiTouch respondsToSelector:@selector(force)] && + uiTouch.maximumPossibleForce > 0) + { touch.forceFactor = uiTouch.force / uiTouch.maximumPossibleForce; - } else { + } + else + { touch.forceFactor = 0; } -#pragma clang diagnostic pop - touch.touchID = (size_t)uiTouch; - + + #pragma clang diagnostic pop + [_touchProcessor enqueueTouch:touch]; } @@ -706,6 +716,7 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interf SPEvent *resizeEvent = [[SPResizeEvent alloc] initWithType:SPEventTypeResize width:newWidth height:newHeight animationTime:duration]; [_stage broadcastEvent:resizeEvent]; + [resizeEvent release]; } }