skview

Swift SpriteKit get visible frame size

女生的网名这么多〃 提交于 2019-12-08 05:22:43
问题 I have been trying to create a simple SpriteKit app using Swift. The purpose is to have a red ball re-locate itself on the screen when clicked on. But the variables self.frame.width and self.frame.height do not return the boundaries of the visible screen. Instead they return boundaries of the whole screen. Because I am choosing the location of the ball at random I need the visible boundaries. Couldn't find an answer after hours of research. How can I achieve this? var dot = SKSpriteNode() let

UIVisualEffectView doesn't blur it's SKView superview

牧云@^-^@ 提交于 2019-12-07 10:28:20
问题 I'm writing a SpriteKit game and faced a problem with blurred view, which lies on the SKView. It is supposed to slide from the right when game is paused and it should blur the content of it's parent view (SKView) just like control center panel in iOS 7. Here is the desired appearance: What I actually get is: In fact the view on the left is not totally black, you can see how highlights from the superview are slightly struggling through almost opaque subview, but no blur is applied. Is it an

Swift SpriteKit get visible frame size

孤者浪人 提交于 2019-12-06 15:48:31
I have been trying to create a simple SpriteKit app using Swift. The purpose is to have a red ball re-locate itself on the screen when clicked on. But the variables self.frame.width and self.frame.height do not return the boundaries of the visible screen. Instead they return boundaries of the whole screen. Because I am choosing the location of the ball at random I need the visible boundaries. Couldn't find an answer after hours of research. How can I achieve this? var dot = SKSpriteNode() let dotScreenHeightPercantage = 10.0 let frameMarginSize = 30.0 override func didMoveToView(view: SKView)

After Closing SKScene, Memory Remains High

泪湿孤枕 提交于 2019-12-05 18:20:55
问题 I use a dispatch_once NSObject to create data pointers. So all game asset pointers are made when the main viewcontroller appears. In order to play a game, the user taps a UIButton corresponding to a particular level on a UIViewController . Let me call it LevelSelectionController. When the game is over, the user will tap a label ( SKLabel ). And all actions and nodes will be removed. [self removeAllActions]; [self removeAllChildren]; [self removeFromParent]; Moreover, an SKScene subclass for a

UIVisualEffectView doesn't blur it's SKView superview

拥有回忆 提交于 2019-12-05 17:15:33
I'm writing a SpriteKit game and faced a problem with blurred view, which lies on the SKView. It is supposed to slide from the right when game is paused and it should blur the content of it's parent view (SKView) just like control center panel in iOS 7. Here is the desired appearance: What I actually get is: In fact the view on the left is not totally black, you can see how highlights from the superview are slightly struggling through almost opaque subview, but no blur is applied. Is it an iOS 8 bug/feature, or is it my mistake/misunderstanding Here is my UIVisualEffectView subclass's

Render/Snapshot SpriteKit Scene to NSImage

萝らか妹 提交于 2019-12-05 14:37:44
问题 Does anyone know how to "snapshot" a complete SKView or SKScene into an NSImage ? We have been able to use the textureFromNode API to create an SKTexture from a node and all its children. But so far we can't figure out a way to extract the image data into say an NSImage . We are building a mixed Cocoa / SpriteKit app where we need to extract small thumbnails of scenes. Again, this seems possible on iOS (to get a UIImage ) using drawViewHierarchyInRect : UIGraphicsBeginImageContextWithOptions

Keeping the game paused after app become active?

余生长醉 提交于 2019-12-05 10:41:43
问题 It is my first post on this forum and I apologize in advance if I am doing something not in the right way ! :) I am making an iphone game with Swift & SpriteKit and I am currently facing a problem. When my app is going to background it calls a function pause (cf. below) but it automatically unpause when the game resumes. I have seen this very interesting post : Spritekit - Keep the game paused when didBecomeActive (and How to keep SpriteKit scene paused when app becomes active?) but I am

After Closing SKScene, Memory Remains High

别等时光非礼了梦想. 提交于 2019-12-04 02:44:32
I use a dispatch_once NSObject to create data pointers. So all game asset pointers are made when the main viewcontroller appears. In order to play a game, the user taps a UIButton corresponding to a particular level on a UIViewController . Let me call it LevelSelectionController. When the game is over, the user will tap a label ( SKLabel ). And all actions and nodes will be removed. [self removeAllActions]; [self removeAllChildren]; [self removeFromParent]; Moreover, an SKScene subclass for a particular level delegates the task of returning the user to LevelSelectionController to the

Keeping the game paused after app become active?

≡放荡痞女 提交于 2019-12-03 21:53:34
It is my first post on this forum and I apologize in advance if I am doing something not in the right way ! :) I am making an iphone game with Swift & SpriteKit and I am currently facing a problem. When my app is going to background it calls a function pause (cf. below) but it automatically unpause when the game resumes. I have seen this very interesting post : Spritekit - Keep the game paused when didBecomeActive (and How to keep SpriteKit scene paused when app becomes active? ) but I am stuck. I don't know how to implement the new SKView class as my View is configured as shown in the below

Difference between paused property of SKScene and SKView

爱⌒轻易说出口 提交于 2019-12-03 06:13:09
I am pausing my SKScene using the following code: self.paused = YES; However, according to this answer by Andrey Gordeev , one can also pause a scene using this line: self.view.paused = YES; I would like to understand what difference it would make to call the either (or both) to pause a scene. Andrey Gordeev Pausing SKView stops calling update: method for SKScene . Pausing SKScene doesn't do that. I usually pause both SKScene and SKView EDIT: As of iOS9 pausing the scene will pause the update: method. The effect is the same. You still have the paused property on the scene because it's a