コード例 #1
0
void LoadUtilLibrary(LuaState &state) {
	state.GetGlobalNamespace()
	.beginClass<VertexInfo>("Vertex")
	.addConstructor<void(*)(const FVec3&, const FVec3&, const FVec2&)>()
	.addData("vertex", &VertexInfo::vertex)
	.addData("normal", &VertexInfo::normal)
	.addData("uv", &VertexInfo::uv)
	.endClass()
	
	.beginClass<ManualModel>("Model")
	.addConstructor<void(*)(void)>()
	.addFunction("AddVertex", &ManualModel::AddVertexData)
	.endClass();

}
コード例 #2
0
void LoadGameLibrary(LuaState &state) {
	state.SetGlobal("ChunkWidth", ChunkWidth);
	state.SetGlobal("ChunkHeight", ChunkHeight);
	state.SetGlobal("ChunkLength", ChunkLength);
	
	state.GetGlobalNamespace()
	
	.beginClass<Dimension>("Dimension")
	.addFunction("GetBlock", &Dimension::GetBlockByCoord)
	.addFunction("IsSolidBlock", &Dimension::IsSolidBlock)
	.endClass()
	
	
	.beginClass<Chunk>("Chunk")
	.addFunction("GetBlock", &Chunk::GetBlock)
	.addFunction("IsSolidBlock", &Chunk::IsSolidBlock)
	.addFunction("GetDimension", &Chunk::GetDimension)
	.addFunction("GetX", &Chunk::GetX)
	.addFunction("GetZ", &Chunk::GetZ)
	.endClass()
	
	
	.beginClass<Block>("Block")
	.addFunction("GetX", &Block::GetX)
	.addFunction("GetY", &Block::GetY)
	.addFunction("GetZ", &Block::GetZ)
	.addFunction("GetAbsX", &Block::GetAbsoluteX)
	.addFunction("GetAbsZ", &Block::GetAbsoluteZ)
	.addFunction("IsSolid", &Block::IsSolid)
	.addFunction("GetChunk", &Block::GetChunk)
	.endClass()
	
	.beginClass<Entity>("Entity")
	.addFunction("GetPosition", &Entity::GetPosition)
	.addFunction("GetRotation", &Entity::GetRotation)
	.addFunction("SetPosition", &Entity::SetPosition)
	.addFunction("SetRotation", &Entity::SetRotation)
	.endClass()
	
	
	
	.beginClass<TextureAtlas<TEXTURE_ATLAS_BLOCK>>("BlockTexture")
	.addStaticFunction("GetTexCoord", &TextureAtlas<TEXTURE_ATLAS_BLOCK>::GetTextureCoords)
	;
}