开发者

Cocos2d - Should I use ccDrawLine or OpenGL for touchable "lines"

开发者 https://www.devze.com 2023-03-27 00:49 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消