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

Method update

tests/live2d-tests/Source/SampleScene.cpp:152–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void SampleScene::update(float delta)
153{
154 Node::update(delta);
155
156 {
157 auto winSize = Director::getInstance()->getWinSize();
158 auto visibleSize = Director::getInstance()->getVisibleSize();
159 Vec2 origin = Director::getInstance()->getVisibleOrigin();
160 // 端に隙間なく位置すると端末によっては描画されないことがあるのでマージンを設ける
161 Vec2 margin = Vec2(20, 20);
162
163 if (_changeItem)
164 {
165 float x = origin.x + visibleSize.width - _changeItem->getContentSize().width / 2 - margin.x;
166 float y = getContentSize().height - _changeItem->getContentSize().height / 2 - margin.y;
167 _changeItem->setPosition(Vec2(x,y));
168 }
169
170 if (_closeItem)
171 {
172 float x = origin.x + visibleSize.width - _closeItem->getContentSize().width / 2 - margin.x;
173 float y = origin.y + _closeItem->getContentSize().height / 2 + margin.y;
174 _closeItem->setPosition(Vec2(x,y));
175 }
176 }
177}
178
179void SampleScene::onExit()
180{

Callers 1

operator()Method · 0.45

Calls 7

getInstanceFunction · 0.85
updateFunction · 0.50
Vec2Function · 0.50
getVisibleSizeMethod · 0.45
getVisibleOriginMethod · 0.45
getContentSizeMethod · 0.45
setPositionMethod · 0.45

Tested by 1

operator()Method · 0.36