Simple RTTI

Simple RTTI
0.0 0


Are you planning to add some kind of lightweight “RTTI” support? My point is that it would be nice to for example set opacity on all child nodes which supports CCRGBAProtocol. This is not possible since there is no way to save cast CCNode to anything higher. I think that some kind of numbers or enums would be enough.

There must be better way but something like:

enum ObjectType { otTransportation, otBus }

class Transport
virtual bool implements(ObjectType type) { return type == otTransportation; }

class Bus : public Transport
virtual bool implements(ObjectType type) { return type == otBus || Transport::implements(type); }

There is huge problem with this solution and it is ObjectType enum definition and it’s extending SDK vs. Developer. But when you use numbers and assure that there will be some boundaries reserved for SDK and for developers to avoid its mixture it should work.

What is your opinion?

CCSpriteBatchNode Limitations

Ming agree with you. But I prefer to wait if android would support RTTI in next NDK version :slight_smile:
If the workload of this “simple RTTI” is only 1~2 man-days, it worth to do.



do anyone know when the next Android NDK will be released? I found only messages like “I will be ready when it will be ready”.



Perhaps with Google IO, when the rest of the SDK gets an update to Ice Cream (Sandwich)?