Home > other >  About MenuItemToggle cocos2dx in position.
About MenuItemToggle cocos2dx in position.

Time:09-25

The Size visibleSize=Director: : getInstance () - & gt; GetVisibleSize ();
Auto BGM_open=MenuItemImage: : create (" open. PNG ", "open. PNG");//show for open
Auto BGM_close=MenuItemImage: : create (" close. PNG ", "close. PNG");//show for closing
Auto BGM_toggle=MenuItemToggle: : createWithCallback (
CC_CALLBACK_1 (SettingScene: : stop_bgm, this),
BGM_open,
BGM_close,
NULL);
BGM_toggle - & gt; SetPosition (Vec2 (visibleSize. Width/3.8, visibleSize height/2.55));//set the coordinate
BGM_toggle - & gt; SetScale (1.5 f);
Auto BGM_menu=Menu: : create (BGM_toggle, NULL);
BGM_menu - & gt; SetPosition (Point: : ZERO);
AddChild (BGM_menu);

This is to write the code, to achieve the effect of a switch, debugging in VS time can see normally, also can response to the click event, but packaged into APK, direct disappeared, small white inquired, what is the problem? Is adaptation problem? Or Android does not support?
Beg you greatly help to look at, small white in this thank you very much,
  • Related