Data Types & Variables |
Print Previous Next |
In MADRIX Script variables may be used to store different data. Each variable will be defined with a certain data type. This data type describes the kind of values the variable can store and the operations which are possible with the variable. Here is a small example to get a feeling for variables. The following source code renders a yellow pixel on a random position each time RenderEffect is called. This is the script "SetRandomPixel": void RenderEffect() {
color col = {255, 255, 0, 0}; int px,py; px = random(0,GetMatrixWidth()-1); py = random(0,GetMatrixHeight()-1); SetPixel(col, px, py);
//a color variable called 'col' is declared and its values are set to yellow (RGB) //two variables of type int are declared to store the coordinates of a pixel //coordinates for x and y inside the matrix are chosen by chance //the pixel is drawn on the matrix }
|