-
Notifications
You must be signed in to change notification settings - Fork 9
Label
Label is a subclass of GUIControl
and therefore inherits all GUIControl's functions and properties in addition to its own, which are listed below.
Compatibility notes:
Prior to AGS 3.6.0 Labels added 1 pixel to the font's linespacing property (see GetFontLineSpacing
) when drawing multiple text lines. Starting with 3.6.0 they use strictly font's linespacing value.
(Formerly known as SetLabelFont
, which is now obsolete)
FontType Label.Font;
Gets/sets the font used to display the label's text. This is useful if you have a standard SCI font for your English version, but want to change to a TTF font for foreign language versions.
Example:
if (IsTranslationAvailable()) {
lblStatus.Font = eFontForeign;
}
will change label 'lblStatus' to use font "Foreign" if a game translation is in use.
See also: IsTranslationAvailable
,
Label.Text
,
TextBox.Font
(Formerly known as SetLabelText
, which is now obsolete)
(Formerly known as Label.GetText
, which is now obsolete)
(Formerly known as Label.SetText
, which is now obsolete)
String Label.Text;
Gets/sets the text displayed in the specified label.
Examples:
lblGameChapter.Text = "Chapter 2";
will display "Chapter 2" text on label 'lblGameChapter'.
lblHotspotName.Text = Game.GetLocationName(mouse.x, mouse.y);
will display the name of the location the cursor is over on label 'lblHotspotName'
lblScore.Text = String.Format("Game score: %d out of %d", cur_score, total_score);
will display a formatted string with game score variable values on label 'lblScore'.
Besides a regular text, or text formatted with String.Format, you can add some special values called "tokens" which will be replaced and automatically updated during the game. Multiple tokens may be present on a single label. The following tokens are currently supported, and will be substituted by actual values at runtime:
Token | Description |
---|---|
@GAMENAME@ |
The game's name, from General Settings or Game.Name property |
@OVERHOTSPOT@ |
The name of the location (hotspot, object, etc) which the cursor is over |
@SCORE@ |
The player's current score |
@SCORETEXT@ |
The text "Score: X of XX" with the relevant numbers filled in |
@TOTALSCORE@ |
The maximum possible score, specified on the General Settings pane |
Example:
lblStatus.Text = "You have @SCORE@ out of @TOTALSCORE@ points.";
See also: Button.NormalGraphic
,
Button.Text
,
Label.TextColor
,
Label.Font
HorizontalAlignment Label.TextAlignment;
Gets/sets how the text is aligned relative to the label's rectangle. Note that currently label supports only horizontal alignment which could be eAlignLeft, eAlignRight and eAlignCenter.
See also: Standard Enumerated Types, Label.Font
,
Label.Text
Compatibility: Supported by AGS 3.5.0 and later versions.
(Formerly known as SetLabelColor
, which is now obsolete)
int Label.TextColor;
Gets/sets the text color used to display the label's text.
Example:
lblStatus.TextColor = 14;
will change label 'lblStatus' to have yellow text.
See also: Label.Font
,
Label.Text
Getting Started in AGS
Editor
- New Game templates
- Editor Preferences
- General Settings
- Default Setup
- Colours Editor
- Room Editor
- Character Editor
- Cursor Editor
- Dialog Editor
- Font Preview
- GUI Editor
- Inventory Items Editor
- View Editor
- Sprite Manager
- Music and sound
- Voice speech
- Script Modules
- System limits
- Log Panel
- Plugins
- Other Features
Engine
Scripting
- Scripting Tutorial
- Scripting Language
-
Scripting API
- Script API Overview
- Standard Constants
- Standard Enumerated Types
- Standard Types
- Game variables
- Global arrays
- Global event handlers
- repeatedly_execute / repeatedly_execute_always
- Custom dialog options rendering
- Global functions: general
- Global functions: message display
- Global functions: multimedia actions
- Global functions: palette operations
- Global functions: room actions
- Global functions: screen effects
- Global functions: wait
- AudioChannel functions and properties
- AudioClip functions and properties
- Camera functions and properties
- Character functions and properties
- DateTime functions and properties
- Dialog functions and properties
- DialogOptionsRenderingInfo functions and properties
- Dictionary functions and properties
- DrawingSurface functions and properties
- DynamicSprite functions and properties
- File functions and properties
- Game functions and properties
- GUI functions and properties
- GUI control functions and properties
- GUI Button functions and properties
- GUI InvWindow functions and properties
- GUI Label functions and properties
- GUI List Box functions and properties
- GUI Slider properties
- GUI Text Box functions and properties
- Hotspot functions and properties
- Inventory item functions and properties
- Maths functions and properties
- Mouse functions and properties
- Object functions and properties
- Overlay functions and properties
- Parser functions
- Region functions and properties
- Room functions and properties
- Screen functions and properties
- Set functions and properties
- Speech functions and properties
- String functions
- System functions and properties
- TextWindowGUI functions and properties
- ViewFrame functions and properties
- Viewport functions and properties
- Obsolete Script API
- Event Types
- Key code table
- Audio in script
Legal Notice
Getting in touch
Misc