Ejemplo n.º 1
0
// ****************************************************************************
// ****************************************************************************
Instance * InstanceManager::Load(const std::string &name)
{
	Instance *inst = Get(name);
	if(inst != NULL)
		return inst;

	std::string fullPath = "Meshes/";
	fullPath += name;
	fullPath += ".lua";

	LuaPlus::LuaState *state = LuaPlus::LuaState::Create();
	_ASSERT(state != NULL);
	
	int retVal = state->DoFile(fullPath.c_str());
	_ASSERT(retVal == 0);

	LuaPlus::LuaObject shaderObj = state->GetGlobals()["MeshList"];
	_ASSERT(shaderObj.IsTable());

	inst = new Instance;
	_ASSERT(inst != NULL);

	m_database[name] = inst;
	return inst;

}
Ejemplo n.º 2
0
bool Gyro::UserSettings::Initialize()
{
	LuaPlus::LuaState* theLuaState = LuaPlus::LuaState::Create( true );
	if( theLuaState->DoFile( "data/UserSettings.ini" ) )
		if( theLuaState->GetTop() == 1 )
			assert( 0 ); // an error occured.


	LuaPlus::LuaObject& settings = theLuaState->GetGlobal( "UserSettings" );
	LuaPlus::LuaObject& screen = settings["Screen"];
	screen_width = screen["Width"].GetInteger();
	screen_height = screen["Height"].GetInteger();

	return true;
}