wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wEngine::ScaleComponent Class Reference

ECS component that defines the scaling factor for an entity in 2D space. More...

#include <wScaleComponent.hpp>

Inheritance diagram for wEngine::ScaleComponent:
Inheritance graph

Public Member Functions

 ScaleComponent (sf::Vector2f scale={ 1.0f, 1.0f })
 Constructs a ScaleComponent with the given scale.
virtual ~ScaleComponent ()=default
sf::Vector2f getScale () const
 Retrieves the current scale factor.
void setScale (sf::Vector2f newScale)
 Sets a new scale factor.
void debugPrint () const
 Outputs the scale to standard output for debugging.
Public Member Functions inherited from wEngine::Component
virtual ~Component ()=default
virtual void enable ()
virtual void disable ()
bool isEnabled () const
 Checks whether the component is currently active.
void setParent (Entity *parent)
 Sets the parent entity of this component.
EntitygetParent () const
 Returns the parent entity of this component.

Additional Inherited Members

Protected Member Functions inherited from wEngine::Component
 Component ()
 Protected constructor to restrict instantiation to derived classes.

Detailed Description

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

Constructor & Destructor Documentation

◆ ScaleComponent()

wEngine::ScaleComponent::ScaleComponent ( sf::Vector2f scale = { 1.0f, 1.0f })

Constructs a ScaleComponent with the given scale.

Parameters
scaleInitial scale vector (must be strictly positive, defaults is ( 1.0f, 1.0f ).
Exceptions
std::invalid_argumentif any scale component is non-positive.

◆ ~ScaleComponent()

virtual wEngine::ScaleComponent::~ScaleComponent ( )
virtualdefault

Member Function Documentation

◆ 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
newScaleNew scale vector (must be strictly positive).
Exceptions
std::invalid_argumentif 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: