-
Notifications
You must be signed in to change notification settings - Fork 0
View.TextBlock.API
A block of text with a limited width. If the width is reached by the text, the text will break into multiple lines.
The constructor for the TextBlock class.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
string |
string | The string to display inside the TextBlock |
||
x |
number |
<optional> |
0 | The x-position of the object in the game arena, in pixels |
y |
number |
<optional> |
0 | The y-position of the object in the game arena, in pixels |
width |
number |
<optional> |
200 | The width of the text block, in pixels. When the text reaches the width, it will break into a new line |
additionalProperties |
Object |
<optional> |
An object containing additional properties to assign to the created object.
The default is: |
- Source:
Name | Type | Description |
---|---|---|
font |
string | A css string representing the font of the text block |
width |
number | The width of the text block |
height |
number | The height of the text block |
alignment |
string | The text alignment of the text block, possible values are: ALIGNMENT_LEFT, ALIGNMENT_CENTER, ALIGNMENT_RIGHT |
color |
string | A css string representing the text's color |
offset |
Vector | The offset with which the sprite will be drawn (to its position) |
direction |
number | The direction of the sprite (in radians) |
size |
number | A size modifier which modifies both the width and the height of the sprite |
widthScale |
number | A size modifier which modifies the width of the sprite |
heightScale |
number | A size modifier which modifies the height of the object |
opacity |
number | The opacity of the sprite |
-
Remove drawCanvas function which was inherited from View
- Inherited From:
- Source:
-
Adds children to a View object. If the object that the children are added to, is a descendant of the current room, the children will be drawn on the stage when added. The added children will be drawn above the current children.
Name Type Description child1
View.Child A child to add to the View object
child2
View.Child Another child to add...
- Inherited From:
- Source:
An array containing the added children
- Type
- View.Child[]
-
Used for animating numeric properties of the owner of the function. Available easing functions are: "linear" "quadIn" "quadOut" "quadInOut" "powerIn" "powerOut" "powerInOut" "sinusInOut"
Name Type Description properties
object An object containing key-value pairs in the following format:
{ "[property name]": "[end value]" }
options
object An object containing key-value pairs for the animation's option:
{ "duraton": "[animation duration (in ms)]", "callback": "[callback function]", "easing": "[easing function to use]" }
- Inherited From:
- Source:
-
Executes a function for the View and all of the its children.
Name Type Description func
function Function to execute
- Inherited From:
- Source:
-
Does the actual rendering of the text, and caches it (for huge performance gains). This function is automatically called each time a property which affects the rendering has been changed (via the right setter functions).
- Source:
-
Calculates and sets the height of the cache canvas based on the number of lines, the font height and the line height
- Source:
-
- Inherited From:
- Source:
-
Draws all children and grandchildren of an object that inherits the View class. It is usually not necessary to call this function since it is automatically called by the engine's redraw loop.
Name Type Description c
CanvasRenderingContext2D A canvas' 2d context to draw the children on
area
Math.Rectangle A rectangle specifying the area to draw
forceRedraw
boolean Whether or not to force a redraw even though draw caching is enabled (this option is actually used when caching the view)
- Inherited From:
- Source:
-
Fetches all current animations of the object.
- Inherited From:
- Source:
An array of all the current animations of the object
- Type
- Object[]
-
Fetches an array of all the View's children. This will not return a pointer, so changing the returned array will not change the View's children.
- Inherited From:
- Source:
Array containing all of the View's children
- Type
- View.Child[]
-
getCombinedRedrawRegion() → {Math.Rectangle}() → {Math.Rectangle}
-
Gets the complete region that will used for drawing on next redraw
- Inherited From:
- Source:
A rectangle representing the region
- Type
- Math.Rectangle
-
Calculates the direction to another child
Name Type Description child
View.Child The object to calculate the direction to
- Inherited From:
- Source:
The direction in radians
- Type
- number
-
Calculates the distance to another child (the distance between the object's positions)
Name Type Description child
View.Child The object to calculate the distance to
- Inherited From:
- Source:
The distance in pixels
- Type
- number
-
Creates and returns and array of all the child's parents (from closest to farthest)
- Inherited From:
- Source:
A list of all the child's parents
- Type
- View.Container[]
-
Calculates a bounding non-rotated rectangle that the text block will fill when drawn.
- Source:
The bounding rectangle of the text block when drawn.
- Type
- Rectangle
-
Finds the room to which the object is currently added
- Inherited From:
- Source:
The room to which the object is currently added, or false if the object is not added to a room
- Type
- View.Room | Boolean
-
getRoomPosition() → {Math.Vector|Boolean}() → {Math.Vector|Boolean}() → {Math.Vector|Boolean}
-
Fetches the position of the child inside the room
- Inherited From:
- Source:
The objects position in its room, or false if the object is not placed in any room.
- Type
- Math.Vector | Boolean
-
Adds a child to a View object, below an already added child. This means that the inserted child (or children) will be drawn below the child which they are inserted below.
Name Type Description insertChildren
View.Child | Array.<View.Child> Child or array of children to insert before an existing child
child
View.Child Current child to insert other children before
- Inherited From:
- Source:
Array of the inserted children
- Type
- View.Child[]
-
Checks if the object is currently being animated.
- Inherited From:
- Source:
Whether or not the object is being animated
- Type
- boolean
-
Checks if the child object is in a state where it will get drawn. For this function to return true, the child object has to be both visible and placed in a visible room.
- Inherited From:
- Source:
Whether or not the child object is in a state where it will get drawn
- Type
- Boolean
-
Checks if the child object is inside a room that is currently visible
- Inherited From:
- Source:
Whether or not the child object is currently in a visible room
- Type
- Boolean
-
Checks if the objects is visible. This function runs before each draw to ensure that it is necessary
- Source:
Whether or not the object is visible (based on its size and opacity vars)
- Type
- boolean
-
Sets the position of the object relative to its parent
Name Type Description x
number The horisontal position
y
number The vertical position
- Inherited From:
- Source:
-
parseOffsetGlobal(offset) → {Math.Vector}
-
Parses an offset global into an actual Math.Vector offset that fits the instance
Name Type Description offset
number Offset global (OFFSET_TOP_LEFT, etc.)
- Source:
The offset vector the offset global corresponds to for the instance
- Type
- Math.Vector
-
Checks if a specific property is current being animated
- Inherited From:
- Source:
Whether or not the property is being animated
- Type
- boolean
-
Removes all children from the View.
Name Type Description purge
boolean Whether or not to purge the removed children, meaning that their scheduled functions and loop-attached functions will be removed. (true by default)
- Inherited From:
- Source:
-
Removes one or more children from the View.
Name Type Description child1
View.Child A child to add to the View object
child2
View.Child Another child to remove...
- Inherited From:
- Source:
An array of the children which was removed. If an object, which was supplied as argument, was not a child of the View, it will not appear in the returned array
- Type
- View.Child[]
-
Sets theme of an View. Children whose theme is not already set, will inherit the set theme. To enforce the theme to all children, use the recursive argument.
Name Type Argument Default Description themeName
string The name of the theme to apply as the object's theme
recursive
boolean <optional>
false Whether or not the set theme will be applied to children for which a theme has already been set. If this argument is unset, it will default to false
- Inherited From:
- Source:
-
Stops all current animations of the object.
- Inherited From:
- Source:
-
Breaks the TextBlock's text string into lines.
- Source:
Generated with wicked.
- Engine.Camera
- Engine.CustomLoop
- Engine.Loader
- Engine.Room
- Engine
- Input.Keyboard
- Input.Pointer
- Math.Circle
- Math.Line
- Math.Polygon
- Math.Rectangle
- Math.Vector
- Sound.Effect
- Sound.Music
- View.Child
- View.Circle
- View.Collidable
- View.Container
- View.GameObject
- View.Line
- View.Polygon
- View.Rectangle
- View.Sprite
- View.TextBlock
- global