I'd like to write/use particle effects in a uiview so I'm thinking of writing a simple one using quartz. It'd be strictly 2d. Am I shooting myself in the foot by not using gl, or are there othet projects or solutions out there that wrap particle systems nicely in a uiview?
Cocos2d for iPhone has some really neat particle effects. Maybe check there? It can run on the Mac too iirc.
From iOS 5, you can use the UIKit Particle System to achieve what you want. Here's a tutorial on that: http://www.raywenderlich.com/6063/uikit-particle-systems-in-ios-5-tutorial
You can add Cocos2d view on the top of all Views, then run cocos2d particle. Check my demo here: https://github.com/lephukhanhhuy/KHParticleView
Related
I've been building a 2D game and I've been drawing the playing area inside of a UIViewsubclass where I override drawRect: and draw the game with a lot of UIBezierPath* objects. I'm not very experienced on iOS and I've been wondering if this is the right way to do it.
So I guess my question is How much is enough? When should I stop using UIBezierPathand start using OpenGL or Metal? Can I use these to draw inside an UIViewor they take total control of the screen?
There is no answer on when you should stop using UIBezierPath. You need to ask yourself in the beginning on what tool will you need to use to achieve what you need for your application to work the way you want it to. The core graphics procedure which you use is very simple comparing to openGL or such but the performance is not at its best and mostly you are very limited on what you can even achieve in drawing. In general you should use as easy procedure as possible as long as it works out for you.
OpenGL and Metal are bond to the view and do not take control of your whole window (the screen in iOS). Also you can still add subviews to those views without breaking any drawing or functionality so for instance even a full screen view openGL application can have a simple UIButton to for instance pause the game or make your main character take that big sword and slay the dragon saving the princess.
What is the best and most efficient way to add effects to a game built with cocos2d?
I mean effects like an explosion.
Are they just animation / sprits?
If not, then what should i receive from the designer?
You can run cocos2d project which comes with library and in the top left drop down list you can choose Particle System Test and build it. So you will able to see all basic particle effects cocos2d has.
Also there is a nice application ParticleDesigner, where you can make your nice looking particles and generate a file to add to cocos2d project, it also has a lot of samples, so it would be good for you to download it and see.
And cocos2d supports animations as well, so you can make animations from frames, but of course in the case of explosions particles would look much better
I would take a look at CCParticleSystem and or CCParticleSystemQuad. You or your designer can use tools like ParticleDesigner to create great looking particle effects.
The core question is "what are my options for decent particle effects in an iOS app?"
I wrote an iPad app where I wanted to use a large amount of UIKit objects in the UI and just keep to a native iPad codebase feel. However I wanted nice particle effects, so instead of going with cocos2d and distancing myself from using native objects directly, I wrote my own particle effects engine utilizing quartz. It works, but the performance is very underwhelming.
Do I have to go with an openGL ES solution to get any good performance at all (openGL and uikit view don't play nicely together); Are there any libraries out there that will let me simply add a UIView that contains the particle effects systems layered in my app as I see fit to place it (pretty much what I've tried to do with pretty bad performance)?
(Forgive me if my usage/knowledge of GL is rusty; I've been out of sight for a few months and do not have a strong handle on it.)
I believe they've added particle effects to Core Animation as of iOS 5. Try this video or look up CAEmitterLayer.
I would like to know the best(high performance / FPS) way of doing sprite (frame) animations in a MonoTouch project.
I'm doing this very effectively in Android by decoding whole sprite image, clip it at desired sizes and display frames at desired pace.
So, what's the most effective way of doing this in Monotouch, in terms of FPS.
Thanks in advance.
Have you looked at using MonoGame?
The SpriteBatch class works well for us. It is OpenTK/OpenGL underneath, so you could repurpose it for your needs if you don't want to use full MonoGame.
It depends on what are the demands that you have for your sprites.
If your requirements fall in the scope of what CoreAnimation can do, you can just your image into a UIView and use CoreAnimation to animate the view.
If you need more control, MonoGame provides a more comprehensive set of primitives for dealing with sprites.
I'm looking to draw a custom shape (say, a solid rectangle) using openGL ES in an iOS game built upon the Cocos2d framework. In another StackOverflow question, I saw a suggestion to use [CCDirector sharedDirector].openGLView; however, I am unsure as to how to go about this. Perhaps someone can provide an example or point me to some sample code?
Thanks in advance!
There are two tutorials I can recommend for doing this, depending on what exactly you are trying to achieve.
Generating Textures using CCRenderTexture - here
Generating Textures using OpenGL - here