typedef ccTime changed into class CCTime problems

Hello.

I am new to cocos2d-x and recently I started to play around with some projects in obj-C and translating them into c**. What I found is that in many c** examples there were type ccTime exchangeable used with float - and caused no problems - due to the fact that it was declared as typedef of float. But it appears that 2.0 framework not only changed name of it from ccTime to CCTime - but also CCTime is actually a class with no to-float conversion , nor float or any other type of data derived from or encapsulating inside.

*class* CC_DLL CCTime { *public*: *static* int gettimeofdayCocos2d(struct cc_timeval *tp, void *tzp); *static* double timersubCocos2d(struct cc_timeval *start, struct cc_timeval *end); };

And I did use cocos2d:: namespace - no result - still having errors in compiler.

Has ccTime type been removed and replaced by CCTime - or they are different types? If so - where ccTime supposed to be declared as typedef of float then ?

Thanks,
cogelmogel

Cogel Mogel wrote:

Hello.
>
I am new to cocos2d-x and recently I started to play around with some projects in obj-C and translating them into c**. What I found is that in many c** examples there were type ccTime exchangeable used with float - and caused no problems - due to the fact that it was declared as typedef of float. But it appears that 2.0 framework not only changed name of it from ccTime to CCTime - but also CCTime is actually a class with no to-float conversion , nor float or any other type of data derived from or encapsulating inside.
>
*class* CC_DLL CCTime { *public*: *static* int gettimeofdayCocos2d(struct cc_timeval *tp, void *tzp); *static* double timersubCocos2d(struct cc_timeval *start, struct cc_timeval *end); };
>
And I did use cocos2d:: namespace - no result - still having errors in compiler.
>
Has ccTime type been removed and replaced by CCTime - or they are different types? If so - where ccTime supposed to be declared as typedef of float then ?
>
Thanks,
cogelmogel

Hello cogelmogel,

It appears that ccTime has been removed— CCTime is not an equivalent. I may recall incorrectly, but I think it was just a typedef for a float value anyway. Now, for instance, you can call update like so:

void MyClass::update(float dt){
   ...
}

Hope that helps.

Hi!
That’s what I exactly did - used plain float instead of ccTime, but I was curious if I am somehow not missing some include or so. Thanks for confirming my initial suspicions.