Write float
Jump to navigation
Jump to search
Definition
INT write_float ( <INT fontID> , <INT x> , <INT y> , [<INT z>] , <INT alignment> , <FLOAT POINTER var> )
Writes a floating point variable to the screen, which will be automatically updated when the value of the variable changes. The floating point variable will remain on the screen until deleted with delete_text().
Parameters
INT fontID | - The FontID of the font to be used for the text. |
INT x | - The X coordinate of the text. |
INT y | - The Y coordinate of the text. |
INT z | - The depthplane of the text (optional, introduced in version rc282). |
INT alignment | - The type of alignment. |
FLOAT POINTER var | - A pointer to a floating point variable. |
Returns
INT : TextID
-1 | - Error. |
>=0 | - The TextID of the text. |
Notes
There is a limit of 511 texts to simultaneously exist on the screen. The program will crash with an error when this number is reached.
The text depth can be changed by adjusting the global variable text_z.
Instead of write_float(), write_var() can be used for the same purpose, which is a more general function that allows you to write variables of any type to the screen.
Errors
Too many texts onscreen | - There are too many texts on the screen. |
Example
Program test; Private float my_float=3.14159265; Begin write_float(0,320/2,200/2,4,&my_float); Repeat Frame; Until(key(_ESC)) End