skview

SpriteKit: why does SKView disappear at one height but appears at another height? What's the maximum height for SKView?

一个人想着一个人 提交于 2019-12-02 18:28:08
问题 The code below shows a SKView until you change skHeight to 2050 or some higher value like 5000. 1) How can you make the SKView appear even at heights of 2050 or 5000? 2) What's the maximum size for SKViews ? To reproduce: 1) Run the code below. You will see the SKView represented as a gray window. 2) Change skHeight to 2050 or 5000. The SKView no longer appears. class TestViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Create SKView let skHeight =

iPhone 5s SpriteKit drawing oddities

拈花ヽ惹草 提交于 2019-12-02 06:59:29
I understand that the iPhone 5s has a pixel resolution of 640 x 1136 and a point resolution of 320 x 568 (for backward compatibility with non-Retina devices). The problem/confusion/oddity seems to come in when I'm working with SpriteKit. Example: I'm drawing a line from bottom-left corner (0, 0) to top-right corner (width, height). The result was that the line was drawn almost halfway. And indeed when i print out the screen size, it should 320 x 568. So i decided to draw from (0, 0) to (width * 2, height * 2). And of course, this printed out 640 x 1136. So the oddity is this: Even though I'm

Significant fps drops when unpausing the view in Spritekit

早过忘川 提交于 2019-12-01 13:21:10
I've noticed significant fps drops (framerate drops between 5-10fps), when unpausing the view in SpriteKit. I tried this with empty project (Spritekit game template). Here is the code: if(!self.view.paused){ self.view.paused = YES; NSLog(@"Paused"); }else{ NSLog(@"Unpaused"); self.view.paused = NO; } If I pause the scene, everything works as expected and frames are steady at 60fps. I am testing this on device. if(!self.paused){ self.paused = YES; NSLog(@"Paused"); }else{ NSLog(@"Unpaused"); self.paused = NO; } This can make a problem with gameplay when unpausing because some frames will be

SpriteKit Pause and Resume SKView

笑着哭i 提交于 2019-12-01 10:41:41
I want to Pause and Unpause a Scene in SpriteKit, with 2 Buttons on the same position. While the Scene is running, I want to show the 'Pause' Button. While the Scene is paused, I want to hide the 'Pause' Button and show the 'Play' Button. In SpriteKit you can use self.scene.view.paused which is defined in SpriteKit. My Code: @implementation MyScene { SKSpriteNode *PauseButton; SKSpriteNode *PlayButton; } -(id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { [self Pause]; } return self; } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { /* Called when a touch

Significant fps drops when unpausing the view in Spritekit

大憨熊 提交于 2019-12-01 10:33:50
问题 I've noticed significant fps drops (framerate drops between 5-10fps), when unpausing the view in SpriteKit. I tried this with empty project (Spritekit game template). Here is the code: if(!self.view.paused){ self.view.paused = YES; NSLog(@"Paused"); }else{ NSLog(@"Unpaused"); self.view.paused = NO; } If I pause the scene, everything works as expected and frames are steady at 60fps. I am testing this on device. if(!self.paused){ self.paused = YES; NSLog(@"Paused"); }else{ NSLog(@"Unpaused");

Integrating a SpriteKit view into a xib view

强颜欢笑 提交于 2019-11-30 21:24:20
I have a view that I already created using a xib file. Now I would like to add some small elements to this view that would make use some of the physics animations from SpriteKit, so now I need an SKView. Is it possible to add an SKView as a Subview of the view that corresponds to my xib view? I tried this and it does not seem to show anything. The following is in the ViewController corresponding to my XIB view: this.myCustomSKView = new CustomSKView() this.View.AddSubview( this.myCustomSKView ); and the ViewController for my custom SKView has: public override void ViewWillLayoutSubviews () {

Integrating a SpriteKit view into a xib view

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 17:08:36
问题 I have a view that I already created using a xib file. Now I would like to add some small elements to this view that would make use some of the physics animations from SpriteKit, so now I need an SKView. Is it possible to add an SKView as a Subview of the view that corresponds to my xib view? I tried this and it does not seem to show anything. The following is in the ViewController corresponding to my XIB view: this.myCustomSKView = new CustomSKView() this.View.AddSubview( this.myCustomSKView

How to take screen shot programmatically (Swift, SpriteKit)

狂风中的少年 提交于 2019-11-30 14:56:56
问题 I tried what ever was suggested but the output was a white,blank screenshot. Which leads me to assume that I haven't added anything to the view. Here's how I'm adding graphics to my view. The addChild method comes with the SpriteKit and it takes in SKSpriteNodes: addChild(background) addChild(rate) addChild(scoreLabel) addChild(share) addChild(playAgain) addChild(highScoreLabel) addChild(scoreBackground) addChild(highScoreBackground) Here's the method that takes the screenshot:

Create \\(Use) SKView as \\(in a) factory \\(static class)

倖福魔咒の 提交于 2019-11-29 12:41:39
I want to make an SKView I can use as a factory to make SKShapeNodes and "render" them to textures. But I can't find how I would initialise such a thing, and am having no luck, at all. How do I make a standalone SKView for this purpose? Or is there a better way to do this that avoids using the gamescene? Here's my FUTILE Effort at making a factory, this complains that texture(from: ) is ambiguous . I have no idea what that means. import SpriteKit class Make: SKView{ static func circle() -> SKSpriteNode { let myShapeNode = SKShapeNode(circleOfRadius: 100) myShapeNode.fillColor = SKColor

SpriteKit - how to correctly pause and resume app

主宰稳场 提交于 2019-11-29 06:58:57
I have huge issue with my newest game for iPhone made with Games by Tutorials book's help. NOTE : method from SpriteKit- the right way to multitask doesn't work. So, in my ViewController.m file, I'm defining private variable SKView *_skView. Then, I do something like this : - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; if(!_skView) { _skView = [[SKView alloc] initWithFrame:self.view.bounds]; _skView.showsFPS = NO; _skView.showsNodeCount = NO; // Create and configure the scene. SKScene * scene = [MainMenuScene sceneWithSize:_skView.bounds.size]; scene.scaleMode =