//
// OptionsLayer::createToggleButton from 0x422804 to 0x42299e (410 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
CCMenuItemToggler *__fastcall OptionsLayer::createToggleButton(
int a1,
int a2,
cocos2d::SEL_MenuHandler a3,
bool a4,
cocos2d::CCNode *a5,
const cocos2d::CCPoint *a6)
{
cocos2d::CCSprite *v7; // r8
cocos2d::CCSprite *v8; // r6
CCMenuItemToggler *v9; // r7
cocos2d::CCLabelBMFont *v10; // r4
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *v12)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
float *v13; // r0
void (__fastcall *setScale)(cocos2d::CCLabelBMFont *__hidden, float); // r6
float *v15; // r0
void (__fastcall *v16)(cocos2d::CCLabelBMFont *__hidden, float); // r6
int v17; // r1
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+Ch] [bp-28h]
cocos2d::CCPoint v21; // [sp+1Ch] [bp-18h] BYREF
cocos2d::CCPoint v22; // [sp+24h] [bp-10h] BYREF
v7 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v8 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v7->setScale)(v7, 1061997773);
((void (__fastcall *)(cocos2d::CCSprite *, int))v8->setScale)(v8, 1061997773);
v9 = CCMenuItemToggler::create(v7, v8, (cocos2d::CCObject *)a1, a3);
CCMenuItemToggler::toggle(v9, a4);
a5->addChild(a5, v9);
setPosition = v9->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v22, a5, a6);
setPosition(v9, &v22);
CCMenuItemToggler::setSizeMult(v9, 1.5);
v10 = cocos2d::CCLabelBMFont::create();
(*(void (__fastcall **)(_DWORD, cocos2d::CCLabelBMFont *))(**(_DWORD **)(a1 + 464) + 220))(*(_DWORD *)(a1 + 464), v10);
setAnchorPoint = v10->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v22, 0.0, 0.5);
setAnchorPoint(v10, &v22);
v12 = v10->setPosition;
v13 = (float *)v7->getContentSize(v7);
cocos2d::CCPoint::CCPoint(&v21, (float)((float)(*v13 * 0.5) * 0.8) + 8.0, 0.0);
cocos2d::CCPoint::operator+(&v22, a6, &v21);
v12(v10, &v22);
if ( v10->getContentSize(v10)->width > 120.0 )
{
setScale = v10->setScale;
v15 = (float *)v10->getContentSize(v10);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _DWORD))setScale)(v10, 120.0 / *v15);
}
v16 = v10->setScale;
if ( v10->getScale(v10) > 0.35 )
v17 = 1051931443;
else
v17 = ((int (__fastcall *)(cocos2d::CCLabelBMFont *))v10->getScale)(v10);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v16)(v10, v17);
return v9;
}