I'm creating a game using the sprite-kit framework. I didn't programe so much for OS X or iOS and i think transition between SKScene and views or screens have many differences.
I created a game menu using Sprite-kit and want to put a progress bar showing progress of level generation and other game operations and after that move to another SKScene with the scenario, hero, enemies, etc.
I found that Cocoa has a progress bar class and UI object. I pick an sample from cocoaControls
I know how to create transitions between SkScenes, there is no problem about that, but looking into the cocoa controls sample code i found a xib file which i don't know how to put into two skscenes and how to load it from the Skscene's game menu.
Related
Using Xcode it is easy to get create a skeleton app for OS X. However, Apple's skeleton code is rather old style with a single view and menu bar. I am looking for skeleton code / best practices which create an app that has the basic pieces such as left navigation panel, toolbar, right panel with format inspector and middle work area. I.e., the new UI style apple deploys with their keynote, pages and numbers.
I have searched but not found a comprehensive example that shows the major components and how these are linked/interacting. I don't see it in the Apple developer area either. I'd rather bootstrap my Mac OS X UI programming skills by learning from others than wading through new territory by myself.
Either Objective-C or Swift would be fine. I am targeting Yosemite.
There's not an Xcode template for this.
You just add an NSToolBar in IB
SUper easy.
Then the details of the rest can vary tremendously.
But, it can easily be a 3 pane NSSplitview with view controllers managing each pane's views.
A navigation pane could easily be an NSTableView or outline view. Or it could be NSCollectionView.
An inspector could be a conglomerate of view controllers swapped in based on context or interaction.
Take a look at github and cocoacontrols.com to find some ideas.
The center pane would most likely be at a minimum an NSScrollView with a custom document view.
I have a post on SO detailing an NSClipView subclass that handles centering right when zoomed out or when the document is smaller.
I'm trying to add a scene/node on top of a paused scene with a transparent background so the active scene view will still be visible.
I pause the scene with scene.view.paused = YES; but that means that everything is paused but the update method.
With Cocos2d one could easily push a new scene on top of an existing one but unfortunately SpriteKit does not have this capability.
Is there a way to pause a scene and add an active scene/node on top of it ?
A solution I've tried :
Creating an additional view controller with the pause-scene content and present it via the active view controller when needed but the background is always black so transparency is not achieved and some other problems occur with the original scene (I'll elaborate on these if needed).
It's all there. You do not have to present a new scene or view.
In a nutshell:
Pause the node where your game content is on that you want to pause. If you do all the processing in the scene class you'll have to refactor it, I'm afraid. The key is having a SKNode that acts as your "game layer" so that you can pause just that particular node. If you receive update: and other regular method calls to the game layer, it should check its self.paused state before doing any processing.
When you have that, pause the game layer node which will pause all the nodes and actions in it.
Now add another "layer" node with whatever UI you need to the scene. That could be your game over or pause layer, and it will be perfectly happy to receive input and run actions while the game layer is paused.
i am migrating my iOS app onto mac. the loading time is a bit long (around 5 seconds) thus i need a splash loading screen (Just like Default.png image for iOS) but the project made from cocos2d template just shows a white screen. not sure about other apps. so is there anyway to set it?
I know that the screen size is not fixed on a mac app. but i have set a default size. and use auto scale in case of full screen mode.
EDIT:
I have tried a light weight loading scene as well but failed since the MainScene itself is light weight as well. I think the major loading time is due to the cocos2d environment set up.
In OS X a window appears when the application launches, it's not designed to use splash screens.You might want to reconsider that choice.
But if the window is still to slow to load or to display its contents, you can still do that but manually, it isn't easy like in iOS.You need to display another view inside the window until it loads.
EDIT
A little more of context: for example you can set in your xib file an image view containing the image do display.
Then you make start another thread that loads all the content that you need.After this, run a selector on the main thread that updates the window.
Based on my tests in Cocos2d 1.0.1 & 2.0 the basic Cocos2d OS X app launches really quickly.
This makes it seem pretty likely that it's something about your first scene that is taking a long time to load, or something else. Instruments can help you gather information about what your app is doing.
I suggest you make an initial lightweight cocos2d scene that will load quickly at startup and then load your second scene and transition to it. Ideally the loading of the assets for your second scene would be asynchronous (at least the ones that are slow). There are numerous blog posts on how to do this. (search for "cocos2d asynchronous loading" and you'll find many, such as this one: How to preload your game assets in a loading scene, though something more recent might be preferable).
i have a tree for AI, and game graphics.
i'd like to display the game graphic on iphone simulator or device, and other graphic (tree) in another window like nslogs.
it is possible?
thanks
I think its not possible, mainly because the iOS SDK and the xCode IDE don't allow you to simulate a hypothetical dual screen App, perhaps you can achieve your requirements putting two NSViews (or OpenGL views) in your App (like a split screen) and render your graph data to the desired view, game graphics in one view and the tree to the another.
I am trying to design a feature in my application for the iPhone that simulates the Springboard feature (Main menu of the iPhone that allows you to view more apps), or the way Weather application works that allows you to flip between views.
Does anyone have any samples of this how I would go about doing this. It's seems very trivial but I am wondering if I am missing something that is already available either as an Apple example or someone who did a tutorial on this.
The image below show how the user would use it.
alt text http://www.agilitesoftware.com/SpringboardExample.png
As they slide their finger to the right (or left) the other image would begin to show up. And it would animate smoothly. The faster you swiped your finger the faster it would move to the next view.
Update: The other feature is that it should mimic the same feel when you slide your hand across the display that is snaps to the current view into place. It should not keep sliding across if there is more than 1 view to the direction you swiping your finger.
I've seen other applications use this so that is why I am asking.
This is accomplished using the UIScrollView with the pagingEnabled property set to true. Just add each of your views, adjust the contentSize, and it will automatically "page" to the width of the screen across the content.
There is a sample app (with code) with exactly this functionality on the iPhone developer site on Apple.com (I believe it's called "PageControl".) - I'd suggest checking it out.
d.
I'm writing an app that uses a similar UI. As NilObject recommended, we're using a UIScrollView with pagingEnabled=YES.
You may also be interested in this example code involving just two child views. I'm trying it out now; it's an interesting technique but I've had to write some additional special-casing code for some odd situations that resulted.
There's also another question on this site that asks about creating a grid of icons like the home screen.
I would check out Joe Hewitt's code from the Three20 project for this. It provides a nice interface and further refinement of the UIScrollView implemented as TTScrollView and TTScrollViewDelegate, TTScrollViewDataSource.