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

Method init

core/ui/UIMediaPlayer.cpp:366–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366bool MediaPlayerControl::init(SpriteFrame* frame)
367{
368 if (!Button::init(""))
369 {
370 return false;
371 }
372
373 if (frame)
374 {
375 _overlay = Sprite::createWithSpriteFrame(frame);
376 AX_SAFE_RETAIN(_overlay);
377 auto spriteSize = _overlay->getContentSize();
378 setContentSize(spriteSize);
379 _overlay->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
380 _overlay->setPosition(_contentSize.width * 0.5f, _contentSize.height * 0.5f);
381 addProtectedChild(_overlay, -2, -1);
382
383 if (!_ignoreSize && _customSize.equals(Vec2::ZERO))
384 {
385 _customSize = _overlay->getContentSize();
386 }
387 this->updateChildrenDisplayedRGBA();
388 if (_unifySize)
389 {
390 if (!_scale9Enabled)
391 {
392 updateContentSizeWithTextureSize(spriteSize);
393 }
394 }
395 else
396 {
397 updateContentSizeWithTextureSize(spriteSize);
398 }
399 }
400
401 return true;
402}
403
404void MediaPlayerControl::onSizeChanged()
405{

Callers 2

createMethod · 0.45
MediaPlayerMethod · 0.45

Calls 7

createFunction · 0.85
initFunction · 0.50
getContentSizeMethod · 0.45
setAnchorPointMethod · 0.45
setPositionMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected