cocos2d-x 截取像素

    auto ac = Sequence::create(DelayTime::create(3), CallFunc::create([=]() 
    {
        auto rt = RenderTexture::create(Director::getInstance()->getWinSize().width,
            Director::getInstance()->getWinSize().height,
            Texture2D::PixelFormat::RGBA8888);
        rt->beginWithClear(0.0f, 1.0f, 0.0f, 0.0f);
        Director::getInstance()->getRunningScene()->visit();
        rt->end();
        auto ret = rt->saveToFile("r2t.png");
        printf("%d\n",ret);
    }),nullptr);

    this->runAction(ac);

 

posted @ 2020-12-20 23:30  YZFHKMS-X  阅读(128)  评论(0编辑  收藏  举报