Functions | Variables

C:/Programming/doxygen/AnyaBasic/reference.h File Reference

Go to the source code of this file.

Functions

statement START ()
 Signifies the start of a code block.
statement END ()
 Signifies the end of a code block.
statement VAR ()
 Defines and instantiates a variable, a typed variable or an array.
statement TYPE ()
 Defines a user defined type/structure.
statement PRINT (expression)
 Prints an expression. Places the cursor on the nextline.
statement WRITE (expression)
 Prints an expression (string,number or variable). Cursor stays on the line.
statement DELAY (expression)
 Waits until a specified amount of time has elapsed.
statement INPUT (expression)
 Reads a value typed from the keyboard until enter is pressed.
statement WHILE (condition)< statement(s)>
 Specifies that a loop block will continue as long as the condition evaluates as TRUE. The loop block can be a single statement or a block of statements contained between the START and END statements.
statement IF (condition)< statement(s)> THEN ELSE< statement(s)>
 A way to control the flow of the program. If the condition evaluates as TRUE,the code block immediately following the THEN statement gets executed. Otherwise, the code block following the ELSE statement gets executed.
statement FOR (VAR counterVariable=startValue TO endValue STEP increment)< statement(s)>
 Initializes variable to startValue and increments it by adding the increment value every loop. The code block following the construct will continue to be performed until variable is equal to endValue.
statement REPEAT (startValue TO endValue STEP increment)< statement(s)>
 Initializes an internal variable to startValue and increments it by adding the increment value every loop. The code block following the construct will continue to be performed until variable is equal to endValue. Unlike FOR, this construct does not need a counter variable.
statement FUNCTION (< parameterList...>) statement(s)
 Defines a procedure that can or cannot return a value. Defines a block of code that gets executed everytime the function is called. Functions can be called as a statement(procedure/sub) or as part of an expression.
statement RETURN (expression)
 Used to return a value from a function. RETURN should always be the last statement in a function. Functions can be called as a statement(procedure/sub) or as part of an expression.
statement BREAK ()
 A control flow statement used to exit a statement block.
Statement blocks are 2 or more statements inside a conditional IF-ELSE,
WHILE, FOR and REPEAT.
statement SCREEN (< width, height, vsynch >)
 Initializes and shows our graphics screen. If width and height is not present as an argument, screensize defaults to 640x480.
statement SCREENFLIP (< fps >)
 Displays the contents of the backbuffer. Our screen is doublebuffered, and flip shows the hidden backbuffer where we draw our graphics entities.
statement CLS (< red, green, blue, alpha >)
 Clears the contents of the backbuffer. An empty parenthesis tells CLS to clear the screen to black.
statement DRAWLINE (x1, y1, x2, y2,< red, green, blue, alpha >)<
 Draws either a line of a box. Boxes can be either be empty or filled.
statement statement DRAWELLIPSE (x, y, radius1, radius2, angleBias,< red, green, blue, alpha >)<+>
 Draws an ellipse. Can be empty or filled.
statement DRAWSTRING (x, y,< red, green, blue, alpha >, text)
 Draws a string of characters.
statement SETCOLOR (red, green, blue, alpha)
 Sets the current default drawing color. Successive draw commands would use the last color set by setcolor unless they are overriden in the parameters of the primitive or image.
statement SETBLENDMODE (mode)
 Sets the current blending mode. Successive draw commands would use the last blendmode set by setBlendmode.
statement DRAWFANCYLINE (x1, y1, x2, y2, thickness, type,< red, green, blue, alpha >)
 Draws a textured line. Boxes can be either be empty or filled.
statement LOADIMAGE (path, array, index)
 Loads a power of 2 image to a hardware accelerated surface then puts a reference an array for easy fetching later. LOADIMAGE only accepts images with a power of two size. ie. 2x8, 16x16, 256x1024..
statement DRAWIMAGE (x, y,< red, green, blue, alpha >)
 Draws an image on the backbuffer screen.
statement DRAWTRANSFORMEDIMAGE (x, y, angle, scaleX, scaleY,< red, green, blue, alpha >)
 Draws a transformed image on the backbuffer screen "Transformed" means that we can apply rotation and scaling to the image.
statement DRAWSCROLLEDIMAGE (x, y, scaleX, scaleY, u, v,< red, green, blue, alpha >)
 Draws a scrolled image on the backbuffer screen "Scrolled" means that we can scroll the U/V textures pf the image when drawn.
statement GETSUBIMAGE (x1, y1, x2, y2, imageIndex)
 Gets a copy of a portion of an image then stores the indx in imageArray[arrayIndex] Very usefull for spritesheets and imageatlases.
statement SOUNDINIT ()
 Initializes our sound engine.
statement SOUNDLOAD (stringID, isLooping)
 Loads the sound sample pointed to by the path.
statement SOUNDPLAY (stringID)
 Plays the sound sample pointed to by the string ID.
statement SOUNDPAUSE (stringID)
 Pauses the sound sample pointed to by the string ID.
statement SOUNDSTOP (stringID)
 Stops the sound sample pointed to by the string ID.
statement SWAP (a, b)
 Swaps the values held by the two arguments You can even use SWAP to exchange different types of variables.
statement FREE (variablenamee)
 Frees the memory used by a variable, array or type.
statement EXIT (expression)
 Closes and destroys the graphics screen, and ends the program. Be sure to call this at the end of your code when you have opened a graphics screen as it does some cleaning up.
function KEYDOWN (expression)
function TIMER ()
function FORMAT (string, expression)
function SUBSTRING (string, begin<, end >)
function SPLIT (string, regex)
function VALASCII (string, index)
function VAL (string)
function ISDIGIT (string)
function ISLETTER (string)
function STRINGLENGTH (string)
function LOWERCASE (string)
function UPPERCASE (string)
function SIZEOF (array<, dimension >)
function CONTAINSKEY (string, associativearray)
function MOUSEX ()
function MOUSEY ()
function MOUSEBUTTONDOWN (buttonID)
function WINDOWCLOSED ()
function SIN (expression)
function COS (expression)
function TAN (expression)
function ASIN (expression)
function ACOS (expression)
function ATAN (expression)
function ATAN2 (y, x)
function CEIL (expression)
function FLOOR (expression)
function ROUND (expression)
function EXP (expression)
function LOG (expression)
function RANDOM (expression)
function ABS (expression)
function SQRT (expression)
function INT (expression)
function BOXINTERSECTS (ax1, ay1, ax2, ay2, bx1, by1, bx2, by2)
function CIRCLEINTERSECTS (ax, ay, aradius, bx, by, bradius)

Variables

statement flipMode
statement array [index]
statement imageArray
statement arrayIndex

Detailed Description


Function Documentation

function ABS ( expression   )

the absolute value of a number.

Parameters:
expressionThe argument to pass to the function.
function ACOS ( expression   )

the trigonometric arcosine of the argument.

Parameters:
expressionThe argument to pass to the function in radians(not degrees).
function ASIN ( expression   )

the trigonometric arcsine of the argument.

Parameters:
expressionThe argument to pass to the function in radians(not degrees).
function ATAN ( expression   )

the trigonometric arctangent of the argument.

Parameters:
expressionThe argument to pass to the function in radians(not degrees).
function ATAN2 ( ,
 
)

the trigonometric arctangent of a ratio.

Parameters:
yThe y/rise component to pass to the function in radians(not degrees).
xThe x/run component to pass to the function in radians(not degrees).
function BOXINTERSECTS ( ax1  ,
ay1  ,
ax2  ,
ay2  ,
bx1  ,
by1  ,
bx2  ,
by2   
)

1 if the two boxes intersect, returns 0 otherwise.

Parameters:
ax1,ay1,ax2,ay2The coordinates defining the first box.
bx1,by1,bx2,by2The coordinates defining the second box.
function CEIL ( expression   )

the trigonometric sine of the argument.

Parameters:
expressionThe argument to pass to the function in radians(not degrees).
function CIRCLEINTERSECTS ( ax  ,
ay  ,
aradius  ,
bx  ,
by  ,
bradius   
)

1 if the two circles intersect, returns 0 otherwise.

Parameters:
ax,ayThe coordinates of the center of the first circle.
aradiusThe radius of the first circle.
bx,byThe coordinates of the center of the second circle.
bradiusThe radius of the second circle.
statement CLS ( < red, green, blue, alpha >   )

Clears the contents of the backbuffer. An empty parenthesis tells CLS to clear the screen to black.

Parameters:
redRed component of the color.
greenGreen component of the color.
blueBlue component of the color.
alphaAlpha transparency component of the color.
function CONTAINSKEY ( string  ,
associativearray   
)

1 if a key is contained in an associative array ans 0 if not.

Parameters:
stringThe key to check.
associativearrayThe name of the associative array variable.
function COS ( expression   )

the trigonometric cosine of the argument.

Parameters:
expressionThe argument to pass to the function in radians(not degrees).
statement DELAY ( expression   )

Waits until a specified amount of time has elapsed.

Parameters:
expressionNumber of milliseconds to wait .
statement statement DRAWELLIPSE ( ,
,
radius1  ,
radius2  ,
angleBias  ,
< red, green, blue, alpha >   
)

Draws an ellipse. Can be empty or filled.

Parameters:
x,yCenter coordinate of the ellipse.
radius1Horizontal radius of the ellipse.
radius2Vertical radius of the ellipse.
angleBiasangle of rotation in degrees of the ellipse.
redRed component of the color.
greenGreen component of the color.
blueBlue component of the color.
alphaAlpha transparency component of the color.
+The '+' signifies that we fill the ellipse.
statement DRAWFANCYLINE ( x1  ,
y1  ,
x2  ,
y2  ,
thickness  ,
type  ,
< red, green, blue, alpha >   
)

Draws a textured line. Boxes can be either be empty or filled.

Parameters:
x1-y1Top-left coordinate of the line.
x2-y2Bottom-right coordinate of the line.
thicknessThickness of the line.
typeThe texture type to use while drawing the line.
redRed component of the color.
greenGreen component of the color.
blueBlue component of the color.
alphaAlpha transparency component of the color.
statement DRAWIMAGE ( ,
,
< red, green, blue, alpha >   
)

Draws an image on the backbuffer screen.

Parameters:
x,yCoordinate to start drawing the string.
redRed component of the color(0 to 1).
greenGreen component of the color(0 to 1).
blueBlue component of the color(0 to 1).
alphaAlpha transparency component of the color(0 to 1).
flipmodean integer value that signifies how we flip the image(0 to 3).
array[index]The array[index] that references the image.
statement DRAWLINE ( x1  ,
y1  ,
x2  ,
y2  ,
< red, green, blue, alpha >   
)

Draws either a line of a box. Boxes can be either be empty or filled.

Parameters:
x1-y1Top-left coordinate of the line.
x2-y2Bottom-right coordinate of the line.
redRed component of the color.
greenGreen component of the color.
blueBlue component of the color.
alphaAlpha transparency component of the color.
+The first '+' signifies that we draw a box.
+The second '+' signifies that we fill the box.
statement DRAWSCROLLEDIMAGE ( ,
,
scaleX  ,
scaleY  ,
,
,
< red, green, blue, alpha >   
)

Draws a scrolled image on the backbuffer screen "Scrolled" means that we can scroll the U/V textures pf the image when drawn.

Parameters:
x,ycoordinate of the image.
scaleXHorizontal scaling factor(1 is normal scale).
scaleYVertical scaling factor(1 is normal scale).
uHorizontal scroll offset.
vVertical scroll offset.
redRed component of the color(0 to 1).
greenGreen component of the color(0 to 1).
blueBlue component of the color(0 to 1).
alphaAlpha transparency component of the color(0 to 1).
flipmodean integer value that signifies how we flip the image(0 to 3).
array[index]The array[index] that references the image.
statement DRAWSTRING ( ,
,
< red, green, blue, alpha >  ,
text   
)

Draws a string of characters.

Parameters:
x,yCoordinate to start drawing the string.
redRed component of the color.
greenGreen component of the color.
blueBlue component of the color.
alphaAlpha transparency component of the color.
textThe string to print.
statement DRAWTRANSFORMEDIMAGE ( ,
,
angle  ,
scaleX  ,
scaleY  ,
< red, green, blue, alpha >   
)

Draws a transformed image on the backbuffer screen "Transformed" means that we can apply rotation and scaling to the image.

Parameters:
x,yCenter coordinate of the image.
angleangle(in degrees) to rotate the image.
scaleXHorizontal scaling factor(1 is normal scale).
scaleYVertical scaling factor(1 is normal scale).
redRed component of the color(0 to 1).
greenGreen component of the color(0 to 1).
blueBlue component of the color(0 to 1).
alphaAlpha transparency component of the color(0 to 1).
flipmodean integer value that signifies how we flip the image(0 to 3).
array[index]The array[index] that references the image.
statement EXIT ( expression   )

Closes and destroys the graphics screen, and ends the program. Be sure to call this at the end of your code when you have opened a graphics screen as it does some cleaning up.

Parameters:
expressionValue you want System.exit() to return.
function EXP ( expression   )

e raised to the power of a number.

Parameters:
expressionThe argument to pass to the function in radians(not degrees).
function FLOOR ( expression   )

the integer part of a number equal to or greater than the argument.

Parameters:
expressionThe argument to pass to the function.
statement FOR ( VAR  counterVariable = startValue TO endValue STEP increment )

Initializes variable to startValue and increments it by adding the increment value every loop. The code block following the construct will continue to be performed until variable is equal to endValue.

Parameters:
counterVariableA number variable that acts as a loop counter.
startValueAn expression to initialize the counterVariable.
endValueAn expression to check to finish the loop.
incrementAn expression to add to the counter everytime the loop gets executed.
function FORMAT ( string  ,
expression   
)

a formatted string of a nummber.
Format strings are the same as C and Java.

Parameters:
StringThe format string.
expressionThe argument to pass to the function.
statement FREE ( variablenamee   )

Frees the memory used by a variable, array or type.

Parameters:
variablenameName of the variable to free.
statement FUNCTION ( < parameterList...>   )

Defines a procedure that can or cannot return a value. Defines a block of code that gets executed everytime the function is called. Functions can be called as a statement(procedure/sub) or as part of an expression.

Parameters:
parameterListAny number of expressions separated by commas. A function can also have no parameters.
statement GETSUBIMAGE ( x1  ,
y1  ,
x2  ,
y2  ,
imageIndex   
)

Gets a copy of a portion of an image then stores the indx in imageArray[arrayIndex] Very usefull for spritesheets and imageatlases.

Parameters:
ax1,ay1,ax2,ay2The coordinates defining the first box.
imageIndexThe index reference of the original image.
imageArrayThe array to hold the index reference of the image portion.
arrayIndexThe index in the array to hold the reference to the image portion.
statement IF ( condition   )

A way to control the flow of the program. If the condition evaluates as TRUE,the code block immediately following the THEN statement gets executed. Otherwise, the code block following the ELSE statement gets executed.

Parameters:
conditionA boolean expression to be evaluated.
statement INPUT ( expression   )

Reads a value typed from the keyboard until enter is pressed.

Parameters:
expressionNumber or String variable .
function INT ( expression   )

integer part of a number.

Parameters:
expressionThe argument to pass to the function.
function ISDIGIT ( string   )

1 if he string is a digit. Returns 0 otherwise

Parameters:
StringThe stringto parse values from.
function ISLETTER ( string   )

1 if he string is a letter. Returns 0 otherwise

Parameters:
StringThe stringto parse values from.
function KEYDOWN ( expression   )

the state(0 or 1) of a key being pressed.

Parameters:
expressionThe argument to pass to the function.
statement LOADIMAGE ( path  ,
array  ,
index   
)

Loads a power of 2 image to a hardware accelerated surface then puts a reference an array for easy fetching later. LOADIMAGE only accepts images with a power of two size. ie. 2x8, 16x16, 256x1024..

Parameters:
pathThe relative or absolute path of the image to load.
arrayThe name of the array variable.
indexIndex on the array where we store the reference to the image.
function LOG ( expression   )

the natural logarithm of a given number.

Parameters:
expressionThe argument to pass to the function.
function LOWERCASE ( string   )

the lowercase representation of the string.

Parameters:
StringThe original string.
function MOUSEBUTTONDOWN ( buttonID   )

whether a partcular mouse buttonis pressed.

Parameters:
buttonIDThe ID of the button to check if pressed.
function MOUSEX (  )

the absolute horizontal coordinate of the mouse.

function MOUSEY (  )

the absolute vertical coordinate of the mouse.

statement PRINT ( expression   )

Prints an expression. Places the cursor on the nextline.

Parameters:
expressionA string, number, function, variable or a combination of them.
function RANDOM ( expression   )

a random number from 0 to expression(exclusive).

Parameters:
expressionThe argument to pass to the function.
statement REPEAT ( startValue TO endValue STEP  increment )

Initializes an internal variable to startValue and increments it by adding the increment value every loop. The code block following the construct will continue to be performed until variable is equal to endValue. Unlike FOR, this construct does not need a counter variable.

Parameters:
startValueAn expression to initialize the counterVariable.
endValueAn expression to check to finish the loop.
incrementAn expression to add to the counter everytime the loop gets executed.
statement RETURN ( expression   )

Used to return a value from a function. RETURN should always be the last statement in a function. Functions can be called as a statement(procedure/sub) or as part of an expression.

Parameters:
expressionA value to return.
function ROUND ( expression   )

the rounded integer part of a number.

Parameters:
expressionThe argument to pass to the function.
statement SCREEN ( < width, height, vsynch >   )

Initializes and shows our graphics screen. If width and height is not present as an argument, screensize defaults to 640x480.

Parameters:
widthWidth of the screen.
heightHeight of the screen.
vynch1 to synch the rendering to screen refresh, 0 otherwise.
statement SCREENFLIP ( < fps >   )

Displays the contents of the backbuffer. Our screen is doublebuffered, and flip shows the hidden backbuffer where we draw our graphics entities.

Parameters:
fpsFrames per second to sync the drawing. Defaults to 60 if absent.
statement SETBLENDMODE ( mode   )

Sets the current blending mode. Successive draw commands would use the last blendmode set by setBlendmode.

Parameters:
mode0 for normal blend, 1 for additive blend.
statement SETCOLOR ( red  ,
green  ,
blue  ,
alpha   
)

Sets the current default drawing color. Successive draw commands would use the last color set by setcolor unless they are overriden in the parameters of the primitive or image.

Parameters:
redRed component of the color.
greenGreen component of the color.
blueBlue component of the color.
alphaAlpha transparency component of the color.
function SIN ( expression   )

the trigonometric sine of the argument.

Parameters:
expressionThe argument to pass to the function in radians(not degrees).
function SIZEOF ( array<, dimension >   )

an integer that corresponds to the size of an array/associative array.

Parameters:
arrayarray/associative The name of the array variable.
dimensionThe dimension to return(0 for row, 1 for column). Not used if it's
an associative arrays.
statement SOUNDLOAD ( stringID  ,
isLooping   
)

Loads the sound sample pointed to by the path.

Parameters:
stringIDThe path of the sound sample to load.
isLooping1 for looping, 0 for play once.
statement SOUNDPAUSE ( stringID   )

Pauses the sound sample pointed to by the string ID.

Parameters:
stringIDThe ID of the sound sample to play.
Should be the same stringID used by SoundLoad().
statement SOUNDPLAY ( stringID   )

Plays the sound sample pointed to by the string ID.

Parameters:
stringIDThe ID of the sound sample to play.
Should be the same stringID used by SoundLoad().
statement SOUNDSTOP ( stringID   )

Stops the sound sample pointed to by the string ID.

Parameters:
stringIDThe ID of the sound sample to play.
Should be the same stringID used by SoundLoad().
function SPLIT ( string  ,
regex   
)

a string array composed of the splitted portions of the string.

Parameters:
StringThe original string.
RegexThe regular expression to use to split the string.
function SQRT ( expression   )

the squareroot of a number.

Parameters:
expressionThe argument to pass to the function.
function STRINGLENGTH ( string   )

an integer that corresponds to the length of the string.

Parameters:
StringThe original string.
function SUBSTRING ( string  ,
begin<, end >   
)

a portion of a string.

Parameters:
StringThe original string.
beginThe start index where the substring would start.
endThe end index where the substring would end.
Substring would return from begin to length of string if end is absent.
statement SWAP ( ,
 
)

Swaps the values held by the two arguments You can even use SWAP to exchange different types of variables.

Parameters:
a,bVariables whose values are to be swapped.
function TAN ( expression   )

the trigonometric tangent of the argument.

Parameters:
expressionThe argument to pass to the function in radians(not degrees).
function TIMER (  )

current value of the high resolution timer(in milliseconds).

function UPPERCASE ( string   )

the uppercase representation of the string.

Parameters:
StringThe original string.
function VAL ( string   )

an integer that corresponds to the value of the string.

Parameters:
StringThe stringto parse values from.
function VALASCII ( string  ,
index   
)

an integer that corresponds to the ASCII value of the character at index.

Parameters:
StringThe original string.
indexThe index of the character in the string to read.
statement WHILE ( condition   )

Specifies that a loop block will continue as long as the condition evaluates as TRUE. The loop block can be a single statement or a block of statements contained between the START and END statements.

Parameters:
conditionA boolean expression to be evaluated.
function WINDOWCLOSED (  )

a value(0 or 1) of whether the current graphics window is closed.

statement WRITE ( expression   )

Prints an expression (string,number or variable). Cursor stays on the line.

Parameters:
expressionA string, number, function, variable or a combination of them.