- This wiki is out of date, use the continuation of this wiki instead
Write in map
From FenixWiki
Revision as of 21:52, 25 July 2007 (edit) Sandman (Talk | contribs) ← Previous diff |
Revision as of 22:00, 25 July 2007 (edit) (undo) Sandman (Talk | contribs) m Next diff → |
||
Line 28: | Line 28: | ||
The centre of the graph ([[control point]] 0) is given according to the given [[alignment]]. This gives added functionality of being able to place the graph like texts, yet also using [[flags]], [[alpha]], rotation, [[collision]], etc. | The centre of the graph ([[control point]] 0) is given according to the given [[alignment]]. This gives added functionality of being able to place the graph like texts, yet also using [[flags]], [[alpha]], rotation, [[collision]], etc. | ||
- | Processes can adopt the graphic containing the text, or it can be displayed with [[ | + | Processes can adopt the graphic containing the text, or it can be displayed with some [[maps|maps functions]], creating a very handy function. |
== Errors == | == Errors == | ||
Line 39: | Line 39: | ||
Program example; | Program example; | ||
Begin | Begin | ||
+ | Set_text_color(154); | ||
graph=write_in_map(0,"Game programming is awesome!",4); | graph=write_in_map(0,"Game programming is awesome!",4); | ||
repeat | repeat | ||
Line 47: | Line 48: | ||
End | End | ||
</pre> | </pre> | ||
- | Used in example: [[key]](), [[x]], [[y]], [[mouse]] | + | Used in example: [[set_text_color]](), [[key]](), [[x]], [[y]], [[mouse]] |
This will result in something like:<br/> | This will result in something like:<br/> | ||
[[Image:Write_in_map.png]] | [[Image:Write_in_map.png]] |
Revision as of 22:00, 25 July 2007
Contents |
Definition
INT write_in_map ( <INT fontID> , <STRING text> , <INT alignment> )
Creates a new graphic in memory with the given text on it (without borders around the text).
Parameters
INT fontID | - The FontID of the font to be used for the text. |
STRING text | - The text to be used. |
INT alignment | - The type of alignment. |
Returns
INT : GraphID
0 | - Error. The text could not be obtained or was empty. |
!0 | - The GraphID of the graphic of the generated graphic in the system FPG. |
Notes
This function creates a graphic containing the specified font, with a width and height determined by the physical size of the text; the graphic's size will fit the text exactly to the pixel. The graphic will be stored in memory with FileID 0 (using the system FPG), and can be obtained at any time by calling its GraphID. The graphic can also be unloaded from memory by using unload_map.
The centre of the graph (control point 0) is given according to the given alignment. This gives added functionality of being able to place the graph like texts, yet also using flags, alpha, rotation, collision, etc.
Processes can adopt the graphic containing the text, or it can be displayed with some maps functions, creating a very handy function.
Errors
Invalid font | - The specified font does not exist or is invalid. |
Example
Program example; Begin Set_text_color(154); graph=write_in_map(0,"Game programming is awesome!",4); repeat x=mouse.x; y=mouse.y; frame; until(key(_esc)) End
Used in example: set_text_color(), key(), x, y, mouse