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

Method alignMenusV

tests/cpp-tests/Source/MenuTest/MenuTest.cpp:270–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void MenuLayer2::alignMenusV()
271{
272 for (int i = 0; i < 2; i++)
273 {
274 auto menu = static_cast<Menu*>(getChildByTag(100 + i));
275 menu->setPosition(_centeredMenu);
276 if (i == 0)
277 {
278 // TIP: if no padding, padding = 5
279 menu->alignItemsVertically();
280 auto p = menu->getPosition();
281 menu->setPosition(p + Vec2(100.0f, 0.0f));
282 }
283 else
284 {
285 // TIP: but padding is configurable
286 menu->alignItemsVerticallyWithPadding(40);
287 auto p = menu->getPosition();
288 menu->setPosition(p - Vec2(100.0f, 0.0f));
289 }
290 }
291}
292
293void MenuLayer2::menuCallback(Object* sender)
294{

Callers

nothing calls this directly

Calls 6

getChildByTagFunction · 0.85
alignItemsVerticallyMethod · 0.80
Vec2Function · 0.50
setPositionMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected