|
SpriteBatchDrawBitmapText(String, Vector2, Single, Color4, Single, Single, Single, Single, Boolean, BitmapTextCreator) Method |
DrawBitmapText method draws the specified text to the specified position that defines the top-left corner of the text.
See remarks for more info.
Namespace: Ab4d.SharpEngine.UtilitiesAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax public void DrawBitmapText(
string text,
Vector2 topLeftPosition,
float fontSize,
Color4 textColor,
float scaleX = 1f,
float scaleY = 1f,
float maxWidth = 0f,
float rotationAngleDegrees = 0f,
bool isPreMultipliedAlpha = false,
BitmapTextCreator? bitmapTextCreator = null
)
Parameters
- text String
- text to draw (supports multiple lines)
- topLeftPosition Vector2
- position that defines the top-left corner of the text
- fontSize Single
- size of the font (font size is always specified in absolute coordinates)
- textColor Color4
- color of the text
- scaleX Single (Optional)
- x scale (1 by default)
- scaleY Single (Optional)
- y scale (1 by default)
- maxWidth Single (Optional)
- when bigger than 0 (0 by default) then it specifies the max text width - if wider, then text is automatically wrapped into a new line after the last word (or character if the word is longer then maxWidth).
- rotationAngleDegrees Single (Optional)
- clockwise rotation angle in degrees (0 by default)
- isPreMultipliedAlpha Boolean (Optional)
- specifies if the textColor is specified as pre-multiplied alpha color (false by default)
- bitmapTextCreator BitmapTextCreator (Optional)
- optional BitmapTextCreator that is used to render the text; when null (by default) then the default BitmapTextCreator is used (get by GetDefaultBitmapTextCreator(Scene))
Remarks
DrawBitmapText method draws the specified text to the specified position that defines the top-left corner of the text.
The specified bitmapTextCreator is used to generate SceneNodes that render the text.
The topLeftPosition and fontSize can be specified in relative coordinates (valid range is from 0 to 1) or in absolute coordinates (valid range is from 0 to size of view).
FontSize is always specified in absolute coordinates.
Absolute coordinates are supported only when the SpriteBatch is created from SceneView (in this case the AreAbsoluteCoordinatesSupported is true).
To use absolute coordinates call Begin(Boolean, Int32) method and set useAbsoluteCoordinates parameter to true or set the IsUsingAbsoluteCoordinates property to true.
When bitmapTextCreator parameter is not specified, then the default BitmapTextCreator is used (get by GetDefaultBitmapTextCreator(Scene)).
When IsUsingDpiScale is true, then size of view is defined as (sceneView.Width / DpiScaleX, sceneView.Height / DpiScaleY).
When IsUsingDpiScale is false (by default) then size of the view is the same as size of the SceneView.
See Also