cocos2d-x
cocos2d-x copied to clipboard
Sprite::createWithTexture gives black sprite after configuration change on android device
- cocos2d-x version: 3.17.2
- devices test on: Samsung Galaxy S21, Samsung Galaxy S20FE, Xiaomi Redmi 5Plus , Pixel 4XL emulator
- developing environments
- NDK version: 21.3.6528147
- Xcode version:
- VS version:
- browser type and version:
Steps to Reproduce:
- Create cocos project
- In HelloWorldScene.cpp replace
auto sprite = Sprite::create("HelloWorld.png");
with
Image* image = new Image();
image->initWithImageFile("HelloWorld.png");
Texture2D* texture = new Texture2D();
texture->initWithImage(image);
auto sprite= Sprite::createWithTexture(texture);
- Run app on android emulator/device
- Sprite is showing OK
- Change theme on device from white to dark to provoke on configuration change and recreation of cocos activity
- Get back in app
- Sprite is black