本文整理汇总了C++中luaplus::LuaObject::GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ LuaObject::GetFloat方法的具体用法?C++ LuaObject::GetFloat怎么用?C++ LuaObject::GetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类luaplus::LuaObject
的用法示例。
在下文中一共展示了LuaObject::GetFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildEventFromScript
bool EvtData_StartJump::buildEventFromScript(void)
{
if (m_eventData.IsTable())
{
// ID
LuaPlus::LuaObject temp = m_eventData.GetByName("actorId");
if (temp.IsInteger())
{
m_id = temp.GetInteger();
}
else
{
GCC_ERROR("Invalid id sent to EvtData_StartJump; type = " + std::string(temp.TypeName()));
return false;
}
// acceleration
temp = m_eventData.GetByName("acceleration");
if (temp.IsNumber())
m_acceleration = temp.GetFloat();
else
m_acceleration = 5.0f; // something reasonable
return true;
}
return false;
}
示例2: createActor
int ant::InternalLuaScriptExports::createActor( const char* actorArchetype, LuaPlus::LuaObject luaPosition, LuaPlus::LuaObject luaRotation )
{
if (!luaPosition.IsTable())
{
GCC_ERROR("Invalid object passed to createActor(); type = " + std::string(luaPosition.TypeName()));
return INVALID_ACTOR_ID;
}
if (!luaRotation.IsNumber())
{
GCC_ERROR("Invalid object passed to createActor(); type = " + std::string(luaRotation.TypeName()));
return INVALID_ACTOR_ID;
}
sf::Vector2f pos(luaPosition["x"].GetFloat(), luaPosition["y"].GetFloat());
ant::Real rot = luaRotation.GetFloat();
TiXmlElement *overloads = NULL;
ActorStrongPtr actor = ant::ISFMLApp::getApp()->getGameLogic()->createActor(actorArchetype, overloads, &pos, &rot);
if (actor)
{
shared_ptr<EvtData_New_Actor> pNewActorEvent(GCC_NEW EvtData_New_Actor(actor->getId()));
IEventManager::instance()->queueEvent(pNewActorEvent);
return actor->getId();
}
return INVALID_ACTOR_ID;
}