This wiki has been moved to https://github.com/SuperTux/wiki into the mediawiki branch.

Difference between revisions of "ScriptingText"

From SuperTux
Jump to: navigation, search
(Added "Navbox Scripting reference" template.)
 
(One intermediate revision by one other user not shown)
Line 26: Line 26:
 
! class="method"| set_centered(bool centered)
 
! class="method"| set_centered(bool centered)
 
| If <tt>centered</tt> is <tt>true</tt>, the text will be centered on the screen. Otherwise, it will be left-aligned.
 
| If <tt>centered</tt> is <tt>true</tt>, the text will be centered on the screen. Otherwise, it will be left-aligned.
 +
|-
 +
! class="method"| set_pos(float x, float y)
 +
| Set offset of the text relative to anchor point.
 +
|-
 +
! class="method"| float get_pos_x()
 +
| Returns x offset of text relative to anchor point
 +
|-
 +
! class="method"| float get_pos_y()
 +
| Returns y offset of text relative to anchor point
 +
|-
 +
! class="method"| set_anchor_point(int anchor)
 +
| Set anchor point of text; one of the [[ScriptingGlobals#Constants|ANCHOR_*]] constants
 +
|-
 +
! class="method"| int get_anchor_point()
 +
| Returns current anchor point of text; one of the [[ScriptingGlobals#Constants|ANCHOR_*]] constants
 
|}
 
|}
  
Line 32: Line 47:
 
None
 
None
  
 +
{{Navbox Scripting reference}}
 
[[Category:Scripting Reference]]
 
[[Category:Scripting Reference]]

Latest revision as of 11:26, 23 January 2010


Summary

This module provides access to methods responsible for displaying text on-screen.

Instances

An eponymous instance (Text) can be accessed from scripts. The console allows a sector.Text.

Methods

set_text(string text) Sets the text string to be displayed to text.
set_font(string font) Sets the font of the text to be displayed to text. Currently valid values are gold, white, blue, gray, big and small.
fade_in(float time) Fades in the specified text for the next time seconds.
fade_out(float time) Just the opposite of fade_in.
set_visible(bool visible) Shows or hides the text abruptly (drastic counterpart to fade_in and fade_out).
set_centered(bool centered) If centered is true, the text will be centered on the screen. Otherwise, it will be left-aligned.
set_pos(float x, float y) Set offset of the text relative to anchor point.
float get_pos_x() Returns x offset of text relative to anchor point
float get_pos_y() Returns y offset of text relative to anchor point
set_anchor_point(int anchor) Set anchor point of text; one of the ANCHOR_* constants
int get_anchor_point() Returns current anchor point of text; one of the ANCHOR_* constants

Constants

None

Scripting reference
Ambient sound · Camera · Candle · Display effect · Floating image · Globals · Level · Level time · Path · Platform · Player · Scripted object · Sector · Sound · Text · Thunderstorm · Tilemap · Will-o-wisp · Wind