//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);
来源:https://www.cnblogs.com/YZFHKMS-X/p/12629922.html