This wiki is out of date, use the continuation of this wiki instead

Write int

From FenixWiki

Revision as of 00:16, 15 November 2007 by Sandman (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search


Contents

[edit] Definition

INT write_int ( <INT fontID> , <INT x> , <INT y> , <INT alignment> , <INT POINTER var> )

Writes an integer to the screen, which will be automatically updated when the value of the integer changes. The integer will remain on the screen until deleted with delete_text().

[edit] 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 alignment - The type of alignment.
INT POINTER var - A pointer to an integer.

[edit] Returns

INT : TextID

-1 - Error.
>=0 - The TextID of the text.

[edit] 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_int(), 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.

[edit] Errors

Too many texts onscreen - There are too many texts on the screen.

[edit] Example

Program test;
Private
    my_integer=0;
Begin

    write_int(0,320/2,200/2,4,my_integer);

    Repeat
        my_integer=rand(1,1000);
        frame;
    Until(key(_ESC))

End

Used in example: rand(), key()

This will result in something like:
Image:Write_int.png

Personal tools