TextDisplayAddText: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 15: | Line 15: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- Create a text display. | -- Create a text display. | ||
myTextDisplay = textCreateDisplay () | myTextDisplay = textCreateDisplay () | ||
-- Add a player as an observer, i.e. this player will see | -- Add a player as an observer, i.e. this player will see all text items that are on this display | ||
textDisplayAddObserver ( myTextDisplay, aPlayer ) | textDisplayAddObserver ( myTextDisplay, aPlayer ) | ||
-- Create a new text item with the text 'Hello World' and a priority of 'low' and colored red. | -- Create a new text item with the text 'Hello World' and a priority of 'low' and colored red. | ||
myTextItem = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 ) | myTextItem = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 ) | ||
-- Add the newly created text item to the display | -- Add the newly created text item to the display | ||
textDisplayAddText ( myTextDisplay, myTextItem ) | textDisplayAddText ( myTextDisplay, myTextItem ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Text | {{Text functions}} |
Latest revision as of 18:55, 21 August 2007
This function adds a textitem to a textdisplay. This allows any observers of the textdisplay to see the textitem.
Syntax
void textDisplayAddText ( textdisplay displayToAddTo, textitem itemToAdd )
Required Arguments
- displayToAddTo: The textdisplay to add the textitem to.
- itemToAdd: The textitem to add to the display.
Example
-- Create a text display. myTextDisplay = textCreateDisplay () -- Add a player as an observer, i.e. this player will see all text items that are on this display textDisplayAddObserver ( myTextDisplay, aPlayer ) -- Create a new text item with the text 'Hello World' and a priority of 'low' and colored red. myTextItem = textCreateTextItem ( "Hello World", 0.5, 0.5, "low", 255, 0, 0, 0, 1.0 ) -- Add the newly created text item to the display textDisplayAddText ( myTextDisplay, myTextItem )
See Also
- textCreateDisplay
- textCreateTextItem
- textDestroyDisplay
- textDestroyTextItem
- textDisplayAddObserver
- textDisplayAddText
- textDisplayGetObservers
- textDisplayIsObserver
- textDisplayRemoveObserver
- textDisplayRemoveText
- textItemGetColor
- textItemGetPosition
- textItemGetPriority
- textItemGetScale
- textItemGetText
- textItemSetColor
- textItemSetPosition
- textItemSetPriority
- textItemSetScale
- textItemSetText