Data Types And Variables

  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.

@scriptname="SetRandomPixel";
@author="inoage";
@version="";
@description="";
 
void InitEffect()
{
 
}
 
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
}
 
void MatrixSizeChanged()
{
 InitEffect();
}
 
 
 
 

MADRIX Version: 5.5 | Script Version: 3.14
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
 Previous   Next

 


Enable automatic translation | Activer la traduction automatique |