Utility classes
Utility classes are classes used by components to represent some specific data structures.
Vocabulary
In the attribute's tables below:
- The "U" column tells if the attributes can be unserialized from YAPG templates files.
- The "R" column tells if the attributes can be changed at runtime
with lua scripting using the
myObject.attribute = newValue
syntax.
"✓" means "yes", "…" means that it will be included in a future version (planned) and nothing means "no".
animation class
Attributes
Name | Type | Description | U | R |
---|---|---|---|---|
duration | float | The total duration of the animation, in seconds. | ✓ | … |
frame | array of frame | The frames of the animation. | ✓ | … |
Lua serialization example
{
duration = 1,
frames = {
{
rect = frameRect1, --see the definition of Frame for more information
relative_duration = 0.6,
},
{
rect = frameRect2,
relative_duration = 0.4,
},
},
}
frame class
Attributes
Name | Type | Description | U | R |
---|---|---|---|---|
rect | int_rect | The part of the texture (defined in the RenderComponent) to use during this frame. | ✓ | … |
relative_duration | float | The relative duration of this frame, relatively to the Animation total duration. | ✓ | … |
int_rect class
Represents a axis-aligned rectangle.
Attributes
Name | Type | Description | U | R |
---|---|---|---|---|
x | int | The X position of the top-left corner. | ✓ | … |
y | int | The Y position of the top-left corner. | ✓ | … |
width | int | The width of the rectangle. | ✓ | … |
height | int | The height of the rectangle. | ✓ | … |
polygon class
Represents a convex polygon.
Attributes
Name | Type | Description | U | R |
---|---|---|---|---|
points | array of sf_vector_2f | The points of the hitbox | ✓ |
Lua serialization example
{
points = {
{
x = 0,
y = 0
},
{
x = 64,
y = 0
},
{
x = 64,
y = 64
},
{
x = 0,
y = 64
},
}
}
sf_vector_2f class
Represents a point with two float coordinates.
Attributes
Name | Type | Description | U | R |
---|---|---|---|---|
x | float | The X coordinate | ✓ | ✓ |
y | float | The Y coordinate | ✓ | ✓ |