cocos2D-X create image sprite solution

寵の児 提交于 2020-04-04 00:16:56

    //int width, height;

    //unsigned char *data = SOIL_load_image("res/06a03.jpg", &width, &height, 0, SOIL_LOAD_RGBA);

    Image *image = new Image();
    
    ////cocos2d::Texture2D::PixelFormat::RGBA8888
    //image->initWithRawData(data,width * height,width,height, 2);
    //image->setPNGPremultipliedAlphaEnabled(true);
    //SOIL_free_image_data(data);

    //auto so = Sprite::createWithTexture(Director::getInstance()->getTextureCache()->addImage(image,"key"));
    auto so = Sprite::create("res/06a03.jpg");
    so->setPosition(visibleSize / 2);
    //delete image;
    this->addChild(so);

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!