I added class GraphicsScene.h:
#pragma once
#include "cocos2d.h"
class GraphicsScene : public cocos2d::Layer
{
public:
static cocos2d::Scene* createScene();
virtual bool init();
CREATE_FUNC(GraphicsScene);
};
Then
#include "GraphicsScene.h"
USING_NS_CC;
Scene* GraphicsScene::createScene()
{
auto scene = Scene::create();
auto layer = GraphicsScene::create();
scene->addChild(layer);
return scene;
}
bool GraphicsScene::init()
{
if ( !Layer::init() )
{
return false;
}
auto sprite = Sprite::create("HelloWorld.png");
sprite->setPosition(0, 0);
this->addChild(sprite, 0);
return true;
}
Then I added in AppDelegate instead of usual HelloWorld::createScene():
auto scene = GraphicsScene::createScene();
// run
director->runWithScene(scene);
I added name of the class in Android.mk.
These are errors
What I m doing wrong? How to create class?