在 Cocos2D-X 中创建具有新成员的图层
Creating layers with new members in Cocos2D-X?
在 Cocos2D-X 中,我创建了一个指向当前场景的指针来初始化游戏对象管理器(试图抽象出一些 Cocos2D API)。
我的标题看起来像:
class GameplayScene : public cocos2d::CCLayer
{
private:
CCTMXTiledMap *_tileMap;
CCTMXLayer *_background;
CCSprite *_sprite;
CCPoint _firstPoint;
ObjectManager objectManager;
public:
void feedback(CCObject * swipe);
bool isBlocked(CCPoint point);
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::CCScene* scene();
void update(float delta);
CCPoint tileCoordForPosition(CCPoint position);
CCPoint tileToPosition(CCPoint position);
// a selector callback
void menuCloseCallback(CCObject* pSender);
// implement the "static node()" method manually
CREATE_FUNC(GameplayScene);
};
但是,我立即被告知我正在调用"隐式删除的默认构造函数"。谁能向我解释一下这里发生了什么?
像这样公开GameplayScene构造函数
class GameplayScene : public cocos2d::CCLayer
{
public:
GameplayScene() {}
与"删除默认构造函数头痛"相同。
相关文章:
- 如何访问子类的新成员函数?
- 在单元测试中,如何在不使用 operator== 的情况下比较两个对象,这可能会错过新成员?
- 如何在千层面打印隐藏图层的输出
- 使用几何着色器的图层渲染似乎只输出图像数组的第一层
- 图层不会绘制另一个图层
- 在作为表后面图层的标签上绘图
- 没有新成员的模板多态性派生类的大小
- 在 caffe 中仅编译一个图层文件
- 如何在咖啡中提取图层的斑点信息?
- BOOST :: ASIO使用成员受体而不是新成员时崩溃
- 条件while循环(此社区的新成员)
- 如何在 c++ 中获取图层的顶部标签?
- 是否有针对新成员的编译器强化实施完整性的模式
- 当我想为结构体声明新成员时,有些麻烦我不明白
- 在 Cocos2D-X 中创建具有新成员的图层
- 面向对象的图层
- 跨多个图层的模板化类未知类型
- 如果 Derived 没有向 Base 添加新成员(并且是 POD),则可以安全地完成哪种指针强制转换和取消引用
- 如何从装饰项中删除图层
- 存储 SDL 渲染器的预定义图层