New inheritance structure after 3.x question

Hi guys,

After following several tutorials over the internet I started to read the official documentation and found that Scene and Layer are deprecated as we speak and at some point they will be removed from cocos2d-x.

Regarding that I tried to have the same basecode I had for other demos/tutorials/projects but removing Layer and Scene from them as much as possible.

So, I ask for help in order to check two topics over the following repository:

  • Is all the new Ref/Node used as expected ? I see extra Scene creation within the Nodes to wrap the node itself.
  • in AppDelegate, if I wanted to cover all android/ios devices, is it the correct way of having multi-resolution multi-device project ?

Repo is only developed for iphonehd btw, using XCode, I didn’t update android makefile

Thanks a lot for your help!

Hello,

Not 100% sure but I’ve checked the documentation for the version 3.13 and I can’t see nothing about deprecation for Scene and Layer in previous 3.x versions functions as ccTouchBegan, ccTouchMoved, etc. has been deprecated in favour of onTouchBegan, onTouchMoved, etc. but not the class

Looking your Cocos2dxBaseGame I think still do you need use Scene and Layer, if you do class MainScene : public cocos2d::Ref instead class MainScene : public cocos2d::Scene you gonna lose all the good of inheritance from Node. The same for the layer. class HUDLayer : public cocos2d::Node should be class HUDLayer : public cocos2d::Node if not you’ll lost attributes as size for example.

A quick review for the multiresolution in AppDelegate I think looks fine, you can check more about multiresolution in this links

I hope this helps
Cheers

Hi aitor, thanks for the reply

if you look at documentation for C++ it says Layer is going to get deprecated:

http://www.cocos2d-x.org/wiki/Layer
Layer seems to useless since v3.0, because now all Nodes can receive touch events. It is reserved just for compatibility. It may be removed in future

Regarding use of Ref and Node instead of Scene and Layer, there are several topics about that:

this is known since 3 years at least. you can take it easy.

updating previous comment, this is taking into consideration design proposed in this topic:

so Scene for me is just a Ref, a Wrapper, real stuff happens on Nodes inside the Ref.