本文整理汇总了C++中Entity::GetFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GetFunction方法的具体用法?C++ Entity::GetFunction怎么用?C++ Entity::GetFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::GetFunction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnAccel
//testing accelerometer readings. To enable the test, search below for "ACCELTEST"
//Note: You'll need to look at the debug log to see the output. (For android, run PhoneLog.bat from RTBareBones/android)
void App::OnAccel(VariantList *pVList)
{
if ( int(pVList->m_variant[0].GetFloat()) != MESSAGE_TYPE_GUI_ACCELEROMETER) return;
CL_Vec3f v = pVList->m_variant[1].GetVector3();
LogMsg("Accel: %s", PrintVector3(v).c_str());
v.x = v.x * kFilteringFactor + v.x * (1.0f - kFilteringFactor);
v.y = v.y * kFilteringFactor + v.y * (1.0f - kFilteringFactor);
v.z = v.z * kFilteringFactor + v.z * (1.0f - kFilteringFactor);
// Compute values for the three axes of the acceleromater
float x = v.x - v.x;
float y = v.y - v.x;
float z = v.z - v.x;
//Compute the intensity of the current acceleration
if (sqrt(x * x + y * y + z * z) > 2.0f)
{
Entity *pEnt = GetEntityRoot()->GetEntityByName("jumble");
if (pEnt)
{
//GetAudioManager()->Play("audio/click.wav");
VariantList vList(CL_Vec2f(), pEnt);
pEnt->GetFunction("OnButtonSelected")->sig_function(&vList);
}
LogMsg("Shake!");
}
}
示例2: SetOutput
void ArcadeInputComponent::SetOutput(VariantList *pVList)
{
Entity *pEnt = pVList->Get(0).GetEntity();
assert(!m_customSignal && "We don't support setting this twice yet");
m_customSignal = &pEnt->GetFunction("OnArcadeInput")->sig_function;
//get notified when this entity dies
pEnt->sig_onRemoved.connect(1, boost::bind(&ArcadeInputComponent::OnCustomOutputRemoved, this, _1));
}