Hii, hope you all are fine.
I am creating an Android project and using an image for the background and scaling it to the size of the screen, but it results as 180 degree rotated image.
here is my code…
visibleSize = Director::getInstance()->getVisibleSize(); vsWidth = visibleSize.width; vsHeight = visibleSize.height; auto backgroundRoad = Sprite::create("background.png"); auto brWidth = backgroundRoad->getContentSize().width; auto brHeight = backgroundRoad->getContentSize().height; backgroundRoad->setScale(vsWidth/brWidth, vsHeight/brHeight); backgroundRoad->setPosition(Point(vsWidth/2, vsHeight/2)); auto renderTextureForRoad = RenderTexture::create( vsWidth, vsHeight, PixelFormat::RGBA8888 ); renderTextureForRoad->begin(); backgroundRoad->visit(); renderTextureForRoad->end(); road = Sprite::createWithTexture(renderTextureForRoad->getSprite()->getTexture()); road->setPosition(vsWidth/2, vsHeight/2); this->addChild(road);
I have scaled another image with the same code and it worked fine for that image. I don’t know why this strange thing is happening with this image.
I am attaching the image…
Can someone please help me in this. Thanks in advance.