Can anyone say the steps to add cocos2d scene to a uikit project. I am new to cocos2d and not aware how to add the files related to cocos2d and also please explain where to add the eagl view in the ui files.
And also share a link for adding a cocos2d in a uiview and not the other way round.
Thanks
For my mind, it is not a good idea to mix uikit with cocos2d. Examples of creating eaglview you can find in any of cocos2d templates. Here you can read how to install cocos2d templates.
http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:lesson_1._install_test
Related
I am trying to implement a help screen in my cocos2d game, using cocos2d version 2.0. My screen will have a title bar ("Help") at the top and then the rest of the screen below that is where I want to put a scrolling help section. Ideally I would be able to put both text and images into this help window.
The problem is that cocos2d does not have any functionality like UIScrollView, and from what I have seen doing Google searches, every custom solution I have found seems to have problems with various bugs popping up on various devices.
I have tried these solutions thus far:
CCScrollLayer: http://www.cocos2d-iphone.org/forum/topic/17118/page/3
Scrolling CCNode: http://tonyngo.net/2011/11/scrolling-ccnode-in-cocos2d/
CCScrollView: http://bitbattalion.com/2011/09/uikit-uiscrollview-and-cocos2d/
The closest thing I got to work was embedding a UITextView but that seemed to randomly crash after a few scrolls so it seems unreliable to me.
Does anyone know of a good simple robust solution to this problem? It seems like it should be straightforward but it isn't.
I recommend that you make new class say:(HelpViewClass) and implement it with an UIScrollView and add whatever you want to add on UIScrollView and then you can use this as a child to your layer.
Steps
Make a class - inherited with UIView
Add UIScrollView to the View.
Add Your components to it.
Add this UIView to the HelpLayer.
You can add any UIKit component to the cocos2d Layer by using this
[[[CCDirector sharedDirector] view] addSubView:scrollView];
Note : Remove all UI component when you go back from this HelpLayer.
I think this may help you !
I'm a bit new with MapKit and have been trying to find the answer to this question:
Can I integrate, or to what extent can I integrate MapKit with Cocos2d?
In having this question answered, I hope that somebody could point me in the right direction on how to approach this scenario:
I am developing a Cocos2D app in which one part of the app would be the MapKit application, showing location and annotations (basically everything that comes with MapKit), and the user has the option to switch to the Cocos2D part. (Switching back and forth between the Map and the Game).
If the two were integrated, would there then be a way to overlay a Cocos2D Menu system over the MapKit and treat MapKit as simply a CCLayer or CCNode? or do I need to treat these two as separate entities altogether by only using UIKit buttons and menus with MapKit, and the only real mix between them is the passing of data from MapKit on to Cocos2D view on transition and vice versa?
Would it follow the same concept as integrating UIKit and Cocos2D in this answered question or this tutorial? Or do I have to use a special wrapper class such as CCUIViewWrapper? I read that CCUIViewWrapper is always drawn on top, so it could possibly not allow me to draw a Cocos2D Menu on top of the map, or even overlay a Cocos2D object once a UIKit button is pressed in the MapKit App.
Any help would be appreciated...Thanks!
I think using CCUIViewWrapper will be a good idea, about the question that CCUIViewWrapper always draw on the topmost layer of View I think that is kinda wrong(I am not sure) as CCUIViewWrapper returns the object in the format of CCNode so you can add it anywhere on the screen you would like to (If I was in your place I would have first tested this with adding a small sprite on top of a MapKit View in a cocos2d project just to be sure).
-Ankur
I'd like to do this:
Create a Cocoa application with a couple NSButtons in it. Also, a "cocos2d-iphone" view running in the same window.
If I trigger the NSButtons, a function is called in the cocos2d-iphone view (not sure where, maybe in the currently running scene?).
Well, I managed to create a new project from the cocos2d-iphone for Mac template, made the window bigger than the cocos2d view, moved the cocos2d view, and added my NSButtons. Now, I am not very sure about how to make the connection I need.. =/
I suggest reading an Interface Builder tutorial. This one is using Quartz, it's not Cocos2D but close enough. Simply assume the Quartz view to be Cocos2D view while you go through the tutorial.
Note that Cocos2D/EAGLView has some issues with NSView objects. In particular you can't add NSView objects as subviews to the Cocos2D OpenGL view, they will simply not be displayed. This is a general problem of the OpenGL view on Mac, and there are solutions/workarounds for this but they unfortunately do not work with Cocos2D. So if you're planning to have NSView objects overlapping the Cocos2D view … well, you can try and if you can make it work, PLEASE let me know how! :)
Hello i'm new to cocos 2D and am thinking about implementing iADs in a new app i'm working on. I'v used iADs before and know the framework pretty well but i know that cocos 2D works in Layers and not views and am a little confused on how to implement them in my app. Can someone please walk me through just how to get them to show up i'm completely confused by other tutorials. Thanks
How about this tutorial?
Implementing iAd on Cocos2d Application
This tutorial is also helpful.
Integrate cocos2d and UIKit
i need to create a switch over cocos2d scene. i can create a uiswitch and add it to scene but
i really interested in cocos2d switch if there is any....
can anyone give me any idea??
If you compile and run the cocs2d test applications included with cocos2d there are several tests that use controls like a switch or a slider. Then you can look at the test files and see how they implemented.
Best way I have been learning cocos2d is by reviewing the test apps.
Also check out these posts for several other useful resources:
https://stackoverflow.com/questions/2293457/cocos2d-resources/4061868#4061868t
Need 2D iPhone graphics designed