- This wiki is out of date, use the continuation of this wiki instead
Write string
From FenixWiki
(Difference between revisions)
Revision as of 21:09, 24 July 2007 (edit) Rincewind (Talk | contribs) (New article!) ← Previous diff |
Current revision (00:19, 15 November 2007) (edit) (undo) Sandman (Talk | contribs) m |
||
Line 23: | Line 23: | ||
'''INT''' : [[TextID]] | '''INT''' : [[TextID]] | ||
{| | {| | ||
- | | | + | | -1 || - Error. The text could not be obtained or was empty. |
|- | |- | ||
- | | | + | | >=0 || - The [[TextID]] of the text. |
|} | |} | ||
Line 36: | Line 36: | ||
== Errors == | == Errors == | ||
- | + | {| | |
+ | | Too many texts onscreen || - There are too many texts on the screen. | ||
+ | |} | ||
== Example == | == Example == | ||
Line 42: | Line 44: | ||
Program test; | Program test; | ||
Global | Global | ||
- | string | + | string my_string="Fenix"; |
Begin | Begin | ||
- | | + | |
- | | + | write_string(0,320/2,200/2,4,&my_string); |
- | | + | |
- | | + | Repeat |
+ | frame; | ||
+ | Until(key(_ESC)) | ||
+ | |||
End | End | ||
</pre> | </pre> | ||
- | This will result in something like:<br | + | This will result in something like:<br> |
[[Image:Write_string.png]] | [[Image:Write_string.png]] |
Current revision
Contents |
[edit] Definition
INT write_string ( <INT fontID> , <INT x> , <INT y> , <INT alignment> , <STRING POINTER var> )
Writes a string to the screen, which will be automatically updated when the value of the string changes. The string 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. |
STRING POINTER var | - A pointer to a string. |
[edit] Returns
INT : TextID
-1 | - Error. The text could not be obtained or was empty. |
>=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_string(), 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; Global string my_string="Fenix"; Begin write_string(0,320/2,200/2,4,&my_string); Repeat frame; Until(key(_ESC)) End