timestee
timestee

Reputation: 1096

How to get the visible rect of the node in cocos2d or cocos2d-x?

How to get the visible rect of the node? Sometime i need to hide 50% of the sprite, if the touch point is in the hidden part, just return but not to active the callback function.

Upvotes: 0

Views: 848

Answers (1)

m.ding
m.ding

Reputation: 3182

There is no default functions, maybe you need to create your own class to handle it.

You can try to create a subclass of CCNode with a changeable CCRect as touchable area, or you can try to read the Image Raw data and detect if the touch position pixel is transparent or not.

Upvotes: 1

Related Questions