| 2140 | } |
| 2141 | |
| 2142 | void TextureMemoryAlloc::updateImage(ax::Object* sender) |
| 2143 | { |
| 2144 | if (_background) |
| 2145 | { |
| 2146 | _background->removeFromParentAndCleanup(true); |
| 2147 | } |
| 2148 | |
| 2149 | Director::getInstance()->getTextureCache()->removeUnusedTextures(); |
| 2150 | |
| 2151 | int tag = ((Node*)sender)->getTag(); |
| 2152 | std::string file; |
| 2153 | switch (tag) |
| 2154 | { |
| 2155 | case 0: |
| 2156 | file = "Images/test_image.png"; |
| 2157 | break; |
| 2158 | case 1: |
| 2159 | file = "Images/test_image_rgba8888.pvr"; |
| 2160 | break; |
| 2161 | case 2: |
| 2162 | file = "Images/test_image_rgb888.pvr"; |
| 2163 | break; |
| 2164 | case 3: |
| 2165 | file = "Images/test_image_rgba4444.pvr"; |
| 2166 | break; |
| 2167 | case 4: |
| 2168 | file = "Images/test_image_a8.pvr"; |
| 2169 | break; |
| 2170 | } |
| 2171 | |
| 2172 | _background = Sprite::create(file.c_str()); |
| 2173 | addChild(_background, -10); |
| 2174 | |
| 2175 | _background->setVisible(false); |
| 2176 | |
| 2177 | auto s = Director::getInstance()->getWinSize(); |
| 2178 | _background->setPosition(Vec2(s.width / 2, s.height / 2)); |
| 2179 | } |
| 2180 | |
| 2181 | std::string TextureMemoryAlloc::title() const |
| 2182 | { |
nothing calls this directly
no test coverage detected