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

Method onEnter

tests/cpp-tests/Source/TextureCacheTest/TextureCacheTest.cpp:62–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void TextureCacheTest::onEnter()
63{
64 TestCase::onEnter();
65 auto size = Director::getInstance()->getWinSize();
66
67 _labelLoading = Label::createWithTTF("loading...", "fonts/arial.ttf", 15);
68 _labelPercent = Label::createWithTTF("%0", "fonts/arial.ttf", 15);
69
70 _labelLoading->setPosition(Vec2(size.width / 2, size.height / 2 - 20));
71 _labelPercent->setPosition(Vec2(size.width / 2, size.height / 2 + 20));
72
73 this->addChild(_labelLoading);
74 this->addChild(_labelPercent);
75
76 // load textures
77 Director::getInstance()->getTextureCache()->addImageAsync("Images/HelloWorld.png",
78 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
79 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini.png",
80 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
81 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_01.png",
82 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
83 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_02.png",
84 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
85 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_03.png",
86 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
87 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_04.png",
88 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
89 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_05.png",
90 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
91 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_06.png",
92 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
93 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_07.png",
94 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
95 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_08.png",
96 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
97 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_09.png",
98 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
99 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_10.png",
100 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
101 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_11.png",
102 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
103 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_12.png",
104 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
105 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_13.png",
106 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
107 Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_14.png",
108 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
109 Director::getInstance()->getTextureCache()->addImageAsync("Images/background1.png",
110 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
111 Director::getInstance()->getTextureCache()->addImageAsync("Images/background2.png",
112 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
113 Director::getInstance()->getTextureCache()->addImageAsync("Images/background3.png",
114 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
115 Director::getInstance()->getTextureCache()->addImageAsync("Images/blocks.png",
116 AX_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
117}
118
119void TextureCacheTest::addSprite()

Callers

nothing calls this directly

Calls 8

getInstanceFunction · 0.85
addImageAsyncMethod · 0.80
getTextureCacheMethod · 0.80
removeTextureForKeyMethod · 0.80
unbindImageAsyncMethod · 0.80
Vec2Function · 0.50
setPositionMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected