Loving Cube Engine API documentation

Introduction and table of contents - The init file - The Main object - Importing new textures - Importing 3D meshes - New data types - List of instantiable objects - List of static objects


Importing new textures

The textures must be 32 bits PNG format (i.e. RGBA, A being the alpha channel which must exist even if you don't plan to have transparency in your picture). The pixel width and height in of a picture must be a multiples of 2, and greater or equal to 16.

To add a new cube type composed of a "side" texture, a "top" texture, and a "bottom" texture, put files named for example "texture_side.png", "texture_top.png", "texture_bottom.png" in the "data/cube_textures/" directory. Then in the lua code add in the Main->init function:

CubesEngine.get():addCubeType(
	"texture_side.png","texture_side.png","texture_top.png",
	"texture_bottom.png","texture_side.png","texture_side.png",
	false, true, -1)

[...]

-- must be called once when all new cube types and active objects are loaded:
-- (check that this function is not already called, because no need to call it twice)
CubesAndActiveObjects.finalizeCubeTypesAndActiveObjectTypes()

(see CubesEngine documentation for more informations about the addCubeType function)