MCPcopy Create free account
hub / github.com/axmolengine/axmol / updateImage

Method updateImage

tests/cpp-tests/Source/Texture2dTest/Texture2dTest.cpp:2142–2179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2140}
2141
2142void 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
2181std::string TextureMemoryAlloc::title() const
2182{

Callers

nothing calls this directly

Calls 10

getInstanceFunction · 0.85
createFunction · 0.85
removeUnusedTexturesMethod · 0.80
getTextureCacheMethod · 0.80
getTagMethod · 0.80
Vec2Function · 0.50
c_strMethod · 0.45
setVisibleMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected