Drawing vector art in an iPhone app - iphone

Im developing an iPhone game, and I want to know how to draw vector art, right now Im drawing all my art in Illustrator + Photoshop, it looks ok, but what I do is to save my vector art to png and then I use it in my game.
What I want to do, is to use my vector art instead, how can I do this?
Thx.
(I've read that I should use Quartz2d and Core Animation.. but dunno what those are or how to use them tbh)

You should start by reading the Quartz 2D Programming Guide.
Quartz 2D is the underlying drawing technology in iOS, and is vector based.
If you plan to use art drawn from illustrator & photoshop you may have to jump through some hoops to turn your assets into something you can draw directly.
You may consider exporting your assets to pdf and using the Quartz 2D's pdf support to draw them. If it's not quick enough, you may yet be able to use it to cache stuff to bitmaps. I haven't tried this myself, but it's certainly what I'd try first.
Good luck!

Related

What is the best way to draw a glossy circle in iPhone OpenGL or Coregraphics?

I want to draw a circle on the iPhone screen with Shadow and glossy effect.I am new to coreGraphics and OpenGL and dont really know the difference between the two.And which library is to be used when.
How can I draw following image in iPhone? any reference point to learn the appropriate library would be great.
have 3 of those images [1] [2] [3]
and a slider to control the glow.when you slide to change the glow it should go across all these, and furthermore some levels could have upto 50 circles.
OpenGL is not a library, it's an API that gives you a "no-frills" access to the graphics system. All it provides are graphics primitives (points, lines, triangles) that it places on the screen and rasterizes them applying colour, textures through mathematical formula and/or a program called shader.
Sure, what you want to draw can be drawn using OpenGL, but it will require several intermediate steps and an artistic understanding of how that image is created from drawing operations.
So to answer your question: The most simple approach is to store this kind of, well whatever it is, as a vector graphics (SVG), and draw it using a library that provides drawing from a file.
The choice between CoreGraphics and OpenGL should be based on what your application does primiarily: Is it rendering some 3D graphics, a custom written 3D engine maybe: Use OpenGL. If you're aiming to draw some kind of UI then CoreGraphics probably is the better choice.

Best way to draw 3D text?

I need to draw two lines of text in a 3D perspective. They're not just flat characters, they are really 3D models and need to animate as well. Preferably with a glossy effect on them.
It sounds really complex to me and I have no experience with OpenGL. Are there frameworks that make this easy or am I looking at a difficult and timeconsuming task?
use cocos3d. cocos3d link here.
That kind of functionality on the iPhone requires plain OpenGL knowledge. You'll need to learn OpenGL and implement all of this by yourself. I know OpenTK is being ported to iPhone but that's not done yet. Good luck!

Need help on graphic suite of choice for iOS development

I'm trying to play around with ios development and thought of a function that I'd like to achieve but don't yet know where to begin. In short, what I want to do is being able to draw lines with touch and then compare the drawn graphics with another image by pixels. I'm wondering what graphics suite should I use for drawing and comparing image functions? Thanks!
Quartz and Core Graphics are what you will need for pixel processing in iOS. I'm not positive if there are any open frameworks available that try to wrap some of this into friendlier usage, but i haven't used any. Here is a link to the Quartz2d document from Apple: Quartz 2D
As far as touch handling, there are a number of great tutorials to help with this. Try googling iphone touchesBegan.

iOS app view background (Image vs draw) design question

Suppose I was writing a game which involved a relatively complex geometric game board. Something like a dartboard.
I would want a view to display the game state. What is the best way to implement that view?
For example, should I draw the board off line in something like photoshop, add it as a resource, and then show it using a UIImageView? Or should I use drawing primitives and essentially draw the board programmatically?
What are the trade-offs?
If I do use an image, what format should I prefer? .png, .tiff, .gif, .jpg?
Thanks,
John
If you decide to go the image route you should use png. Displaying any other format you pay a performance hit (as mentioned in the comment).
To decide between building photoshop vs drawing via code you need to decide how much time you want to put into learning Quartz/CoreGraphics. Apple's docs:
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html
If you already know Photoshop then building the graphic there is probably much easier, if you don't then learning Quartz is prob a less steep learning curve than Photoshop...
If it's a simple board, it's easy enough to draw it into the view, which gives you the possibility of easily manipulating it in interesting ways. Drawing in a view is done with a set of postscript like primitives.
For something more fancy, photoshop might be the way to go.
PNGs are preferred.

Generating graphics at runtime with Cocos2D - How to display?

I'm trying to create dynamic graphics for my game, which I'm building with Cocos2D. The graphics generation will occur at predictable, finite points, such as level loading. I'm having a hard time figuring out how to actually draw this at runtime. From what I can tell, the easiest way would be to draw into a PNG file at runtime and then load an AtlasSprite based on the PNG file, but I can't seem to figure out if this is indeed the best way or how to go about doing it. Any suggestions?
I'm not sure how Cocos2D loads Sprites or Atlases so this is a more general answer.
It might be worth taking a look at the Texture2D class that comes with the old CrashLanding example app. It uses a bitmap graphics context to generate a texture of a string for drawing with OpenGL. The code uses the CGBitmapContextCreate function to create a context. You can draw whatever you want onto it.
Then once you've finished drawing, you can either save the file as a PNG or you can call glTexImage2D on the data to use it with OpenGL.
There's more information about it in the Graphics and Drawing
documentation, specifically the section: Creating and Drawing Images.
Edit: It looks like Cocos2D comes with Texture2D so you should be in good shape. Check out the initWithString method here.