コード例 #1
0
void CPropFloorButtonBase::TouchThink(void)
{
	touchAmount = 0;
	CBaseEntity *pObject = NULL;
	while ((pObject = gEntList.FindEntityByClassname(pObject, "prop_weighted_cube")) != NULL)
	{
		HandleEntityTouch(pObject);
	}
	while ((pObject = gEntList.FindEntityByClassname(pObject, "prop_monster_box")) != NULL)
	{
		HandleEntityTouch(pObject);
	}
	while ((pObject = gEntList.FindEntityByClassname(pObject, "player")) != NULL)
	{
		HandleEntityTouch(pObject);
	}

	if (touchAmount == 0 && wasTouching)
	{
		OnPress();
	}
	else if (touchAmount > 0 && !wasTouching)
	{
		OnUnpress();
	}

	SetThink(&CPropFloorButtonBase::TouchThink);
	SetNextThink(gpGlobals->curtime + TICK_INTERVAL);
}
コード例 #2
0
ファイル: jbutton.cpp プロジェクト: skopp/rush
void JButton::Unpress()
{
    if (m_bPressed)
    {
        Frame ext = GetLocalExt();
        ext.x  -= float( m_PressDX );
        ext.y  -= float( m_PressDY );
        SetLocalExt( ext );
    }

    m_bPressed = false;
    SendSignal( "Unpress" );
    SendSignal( "Pressed" );
    OnUnpress();
} // JButton::Unpress