cocos2d-x icon indicating copy to clipboard operation
cocos2d-x copied to clipboard

Sprite::createWithTexture gives black sprite after configuration change on android device

Open zoranigic opened this issue 3 years ago • 0 comments

  • 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:

  1. Create cocos project
  2. 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);
  1. Run app on android emulator/device
  2. Sprite is showing OK
  3. Change theme on device from white to dark to provoke on configuration change and recreation of cocos activity
  4. Get back in app
  5. Sprite is black

zoranigic avatar Nov 02 '21 15:11 zoranigic