Classes/Material/MaterialLesson10.cpp
// on "init" you need to initialize your instance
on "init" you need to initialize your instance
on " init " you need to initialize your instance
bool MaterialLesson10::init()
{
    if ( !Layer::init() )
    {
        return false;
    }
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();
    auto closeItem = MenuItemImage::create(
                                           "CloseNormal.png",
                                           "CloseSelected.png",
                                           CC_CALLBACK_1(MaterialLesson10::menuCloseCallback, this));
	closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
                                origin.y + closeItem->getContentSize().height/2));
    auto menu = Menu::create(closeItem, NULL);
    menu->setPosition(Vec2::ZERO);
    this->addChild(menu, 1);
    std::string filename = "res/Material/feijiku01.c3t";
    auto sprite = Sprite3D::create(filename);
    sprite->setPosition(visibleSize.width/2 + origin.x, visibleSize.height/10 + origin.y);
    addChild(sprite);
    auto material = Material::createWithFilename("res/Material/lightmap.material");
    setMaterial(sprite, material);
    return true;
}
bool MaterialLesson10 :: init ( ) { if ( ! Layer :: init ( ) ) { return false ; } Size visibleSize = Director :: getInstance ( ) -> getVisibleSize ( ) ; Vec2 origin = Director :: getInstance ( ) -> getVisibleOrigin ( ) ; auto closeItem = MenuItemImage :: create ( " " , " " , CC_CALLBACK_1 ( MaterialLesson10 :: menuCloseCallback , this ) ) ; closeItem -> setPosition ( Vec2 ( origin . x + visibleSize . width - closeItem -> getContentSize ( ) . width / 2 , origin . y + closeItem -> getContentSize ( ) . height / 2 ) ) ; auto menu = Menu :: create ( closeItem , NULL ) ; menu -> setPosition ( Vec2 :: ZERO ) ; this -> addChild ( menu , 1 ) ; std :: string filename = " " ; auto sprite = Sprite3D :: create ( filename ) ; sprite -> setPosition ( visibleSize . width / 2 + origin . x , visibleSize . height / 10 + origin . y ) ; addChild ( sprite ) ; auto material = Material :: createWithFilename ( " " ) ; setMaterial ( sprite , material ) ; return true ; }
on "init" you need to initialize your instance
on " init " you need to initialize your instance
////////////////////////////// // 1. super init first ///////////////////////////// // 2. add a menu item with "X" image, which is clicked to quit the program //    you may modify it. // add a "close" icon to exit the progress. it's an autorelease object // create menu, it's an autorelease object ///////////////////////////// // 3. add your codes below... // add a label shows "Hello World" // create and initialize a label // add "MathLesson1" splash screen" //create Sprite3D