Пример #1
0
void LuaManager::ConvertVec3ToTable(const XMFLOAT3& vec, LuaPlus::LuaObject& outLuaTable) const
{
	outLuaTable.AssignNewTable(GetLuaState());
	outLuaTable.SetNumber("x", vec.x);
	outLuaTable.SetNumber("y", vec.y);
	outLuaTable.SetNumber("z", vec.z);
}
Пример #2
0
 // /////////////////////////////////////////////////////////////////
 //
 // /////////////////////////////////////////////////////////////////
 LuaPlus::LuaObject SliderControl::VGetLuaData()
 {
     LuaPlus::LuaObject table;
     table.AssignNewTable(g_appPtr->GetLuaStateManager()->GetGlobalState().Get());
     table.SetNumber("SliderPosition", m_sliderPos);
     table.SetInteger("EventTypeId", m_eventTypeId);
     table.SetInteger("ScreenElementId", VGetId());
     return (table);
 }
Пример #3
0
LuaPlus::LuaObject InternalScriptExports::GetVectorFromRotation(float angleRadians)
{
    Vec3 result = ::GetVectorFromYRotation(angleRadians);
    LuaPlus::LuaObject luaResult;
    luaResult.AssignNewTable(LuaStateManager::Get()->GetLuaState());
    luaResult.SetNumber("x", result.x);
    luaResult.SetNumber("y", result.y);
    luaResult.SetNumber("z", result.z);
    return luaResult;
}
Пример #4
0
static LuaPlus::LuaObject Wrap(Vec3 vector){
	LuaPlus::LuaObject vecObj;
	vecObj.AssignNewTable(LuaManager::Get()->GetState());

	vecObj.SetNumber("x", vector.x);
	vecObj.SetNumber("y", vector.y);
	vecObj.SetNumber("z", vector.z);

	return vecObj;
}
Пример #5
0
static LuaPlus::LuaObject Wrap(Quat quat){
	LuaPlus::LuaObject quatObj;
	quatObj.AssignNewTable(LuaManager::Get()->GetState());

	quatObj.SetNumber("w", quat.w);
	quatObj.SetNumber("x", quat.x);
	quatObj.SetNumber("y", quat.y);
	quatObj.SetNumber("z", quat.z);

	return quatObj;
}
 // /////////////////////////////////////////////////////////////////
 //
 // /////////////////////////////////////////////////////////////////
 LuaPlus::LuaObject ListButtonControl::VGetLuaData()
 {
     LuaPlus::LuaObject table;
     table.AssignNewTable(g_appPtr->GetLuaStateManager()->GetGlobalState().Get());
     if(m_list.empty()) {
         table.SetString("Text", "");
     } else {
         table.SetString("Text", (*m_curr).c_str());
     }
     table.SetInteger("ScreenElementId", VGetId());
     table.SetInteger("EventTypeId", GetEventType());
     return (table);
 }
// create a lua vec3 table from an angle in radians
LuaPlus::LuaObject LuaInternalScriptExports::GetVectorFromRotation(float angleRadians)
{
	// use the GetVectorFromYRotation from math.h
	Vec3 result = ::GetVectorFromYRotation(angleRadians);

	// create a lua vec3 table from the result
	LuaPlus::LuaObject luaResult;
	luaResult.AssignNewTable(LuaStateManager::Get()->GetLuaState());
	luaResult.SetNumber("x", result.x);
	luaResult.SetNumber("y", result.y);
	luaResult.SetNumber("z", result.z);

	return luaResult;
}
Пример #8
0
static LuaPlus::LuaObject Wrap(GameObject* go){
	LuaPlus::LuaObject goObj;
	goObj.AssignNewTable(LuaManager::Get()->GetState());

	WrappedGameObject* wgo = new WrappedGameObject(go);

	//std::shared_ptr<WrappedGameObject> wgo = std::make_shared<WrappedGameObject>(new WrappedGameObject(go));

	goObj.RegisterDirect<WrappedGameObject>("getPosition", *wgo, &WrappedGameObject::getPosition);
	goObj.RegisterDirect<WrappedGameObject>("getScale", *wgo, &WrappedGameObject::getScale);
	goObj.RegisterDirect<WrappedGameObject>("getRotation", *wgo, &WrappedGameObject::getRotation);
	goObj.RegisterDirect<WrappedGameObject>("getForward", *wgo, &WrappedGameObject::getForward);

	goObj.RegisterDirect<WrappedGameObject>("setPosition", *wgo, &WrappedGameObject::setPosition);
	goObj.RegisterDirect<WrappedGameObject>("setScale", *wgo, &WrappedGameObject::setScale);
	goObj.RegisterDirect<WrappedGameObject>("setRotation", *wgo, &WrappedGameObject::setRotation);

	goObj.RegisterDirect<WrappedGameObject>("__gc", *wgo, &WrappedGameObject::Dispose);

	return goObj;
}
Пример #9
0
void ant::LuaStateManager::convertVec2ToTable(const sf::Vector2f& vec, LuaPlus::LuaObject& vec2Table)
{
	vec2Table.AssignNewTable(getLuaState());
	vec2Table.SetNumber("x", vec.x);
	vec2Table.SetNumber("y", vec.y);
}