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

Method onWindowClose

tests/cpp-tests/Source/WindowTest/WindowTest.cpp:190–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void WindowTestClose::onWindowClose(EventCustom* e)
191{
192 auto isClose = static_cast<bool*>(e->getUserData());
193 if (isClose == nullptr)
194 return;
195
196 // false prevents the window from closing
197 *isClose = false;
198
199 this->stopActionByTag(1);
200 if (label != nullptr)
201 {
202 label->removeFromParent();
203 label = nullptr;
204 }
205
206 auto s = _director->getWinSize();
207 label = Label::createWithTTF("Window close button callback!", "fonts/Marker Felt.ttf", 16.0f);
208 label->setPosition(s.width / 2, s.height / 2);
209 addChild(label);
210
211 auto delay = DelayTime::create(3.0);
212 auto callFunc = CallFunc::create(
213 [this]()
214 {
215 if (label != nullptr)
216 {
217 label->removeFromParent();
218 label = nullptr;
219 }
220 });
221 auto sequence = Sequence::create(delay, callFunc, nullptr);
222 sequence->setTag(1);
223 this->runAction(sequence);
224}
225
226#endif

Callers

nothing calls this directly

Calls 7

createFunction · 0.85
stopActionByTagMethod · 0.80
setTagMethod · 0.80
getUserDataMethod · 0.45
removeFromParentMethod · 0.45
setPositionMethod · 0.45
runActionMethod · 0.45

Tested by

no test coverage detected