Cocos2d - Should I use ccDrawLine or OpenGL for touchable "lines"
I'm working on an iOS game, and part of it requires the player to be able to touch and interact with some lines that are drawn on the screen. Essentially, I need to be able to detect whether or not a player 开发者_JAVA技巧has touched a line, and if so, change it's color/thickness etc.
Now, I know I can overwrite the draw method on a custom class with ccDrawLine and render out the line. Is that preferable to using OpenGL to render them?
Thanks
Sure, it is preferable, because cocos2d takes care of content scaling. I suggest you take a look at ccDrawLine function inside CCDrawingPrimitives.m.
精彩评论