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


New data types

Note: these objects do not have drop() method i.e. you don't need to care about deleting them.

Int2 - A couple of integer variables - Can be used as 2D pixel coordinates/position/point/vector/size

MethodDescription
Int2 new(int x, int y)Static constructor
Int2 clone()Duplicate this object
int x([int new_x])Set or get the X coordinate
int y([int new_y])Set or get the Y coordinate
int width()Alias of x() (makes more sense when the value represents a size instead of a position).
int height()Alias of y() (makes more sense when the value represents a size instead of a position).
number norm()Get the norm of the (x,y) vector.
string str()Get a string showing the Int2 values with the syntax "(x,y)".
number distanceTo(Int2 other_point)Get the distance between this position and another position. In other words, compute √((x1-x2)²+(y1-y2)²)
number dotProduct(Int2 other_point)Get the scalar product between this vector and another vector.
bool equals(Int2 other_point)Return true if the coordinates are the same.
This data type has also overloaded "+" and "-" operators.

Number2 - A couple of floating variables - Can be used as a 2D scale ratio

Same methods than Int2.

Int3 - A triplet of integer variables - Can be used for cube coordinates

MethodDescription
Int3 new(int x, int y, int z)Static constructor
Int3 clone()Duplicate this object
int x([int new_x])Set or get the X coordinate
int y([int new_y])Set or get the Y coordinate
int z([int new_z])Set or get the Z coordinate
number distanceTo(Int3 other_point)Get the distance between this position and another position. In other words, compute √((x1-x2)²+(y1-y2)²+(z1-z2)²)
bool equals(Int3 other_point)Return true if the coordinates are the same.
This data type has also overloaded "+" and "-" operators.

Number3 - A triplet of floating variables - Can be used as a 3D world position/point/vector

MethodDescription
Number3 new(number x, number y, number z)Static constructor
Number3 clone()Duplicate this object
number x([number new_x])Set or get the X coordinate
number y([number new_y])Set or get the Y coordinate
number z([number new_z])Set or get the Z coordinate
number distanceTo(Number3 other_point)Get the distance between this position and another position. In other words, compute √((x1-x2)²+(y1-y2)²+(z1-z2)²)
Number3 normalized()Get a normalized version of this vector
bool equals(Number3 other_point)Return true if the coordinates are the same.
This data type has also overloaded "+" and "-" operators.

Color - A 8-bits-per-channel color with R,G,B,A (red,green,blue,alpha) channels

MethodDescription
Color new(int r, int g, int b, int a)Static constructor
int r()Get the red channel (between 0 and 255)
int g()Get the green channel (between 0 and 255)
int b()Get the blue channel (between 0 and 255)
int a()Get the alpha channel (between 0 and 255)
bool equals(Color other_point)Return true if the color components are the same.