ECS component that defines the scaling factor for an entity in 2D space.
More...
#include <wScaleComponent.hpp>
|
| Component () |
| Protected constructor to restrict instantiation to derived classes.
|
ECS component that defines the scaling factor for an entity in 2D space.
The scale determines how much the entity is scaled along the X and Y axes. It is typically used to transform logical coordinates into pixel coordinates.
- Author
- Wilfried Koch
- Copyright
- © 2025 Wilfried Koch. All rights reserved.
◆ ScaleComponent()
wEngine::ScaleComponent::ScaleComponent |
( |
sf::Vector2f | scale = { 1.0f, 1.0f } | ) |
|
Constructs a ScaleComponent with the given scale.
- Parameters
-
scale | Initial scale vector (must be strictly positive, defaults is ( 1.0f, 1.0f ). |
- Exceptions
-
std::invalid_argument | if any scale component is non-positive. |
◆ ~ScaleComponent()
virtual wEngine::ScaleComponent::~ScaleComponent |
( |
| ) |
|
|
virtualdefault |
◆ getScale()
sf::Vector2f wEngine::ScaleComponent::getScale |
( |
| ) |
const |
|
nodiscard |
Retrieves the current scale factor.
- Returns
- The scale as an sf::Vector2f (X and Y scale).
◆ setScale()
void wEngine::ScaleComponent::setScale |
( |
sf::Vector2f | newScale | ) |
|
Sets a new scale factor.
- Parameters
-
newScale | New scale vector (must be strictly positive). |
- Exceptions
-
std::invalid_argument | if newScale has non-positive values. |
◆ debugPrint()
void wEngine::ScaleComponent::debugPrint |
( |
| ) |
const |
Outputs the scale to standard output for debugging.
The documentation for this class was generated from the following files: