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

ECS component that defines a logical coordinate offset. More...

#include <wOffsetComponent.hpp>

Inheritance diagram for wEngine::OffsetComponent:
Inheritance graph

Public Member Functions

 OffsetComponent (sf::Vector2f offset=sf::Vector2f(0.0f, 0.0f))
 Constructs the component with an optional offset.
virtual ~OffsetComponent ()=default
sf::Vector2f getOffset () const
 Returns the current offset.
void setOffset (sf::Vector2f offset)
 Updates the logical offset value.
void addOffset (sf::Vector2f delta)
 Increments the current offset by a given vector.
void debugPrint () const
 Outputs the current offset value to the console 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 a logical coordinate offset.

This component stores a 2D offset (in logical units) applied to graphical elements such as axes, curves, titles, labels and data points. It allows changing the visual reference frame without affecting pixel-based positioning.

Usage Examples:

  • With offset = ( 0, 0 ), logical coordinates are drawn as-is.
  • With offset = ( -20, 0 ), the visual origin is shifted 20 units to the right.

The offset is often combined with the origin and scale to compute actual pixel positions.

Author
Wilfried Koch

Constructor & Destructor Documentation

◆ OffsetComponent()

wEngine::OffsetComponent::OffsetComponent ( sf::Vector2f offset = sf::Vector2f( 0.0f, 0.0f ))

Constructs the component with an optional offset.

Parameters
offsetA 2D vector representing the logical offset (default is ( 0.0f, 0.0f )).

◆ ~OffsetComponent()

virtual wEngine::OffsetComponent::~OffsetComponent ( )
virtualdefault

Member Function Documentation

◆ getOffset()

sf::Vector2f wEngine::OffsetComponent::getOffset ( ) const
nodiscard

Returns the current offset.

Returns
A 2D vector representing the logical offset.

◆ setOffset()

void wEngine::OffsetComponent::setOffset ( sf::Vector2f offset)

Updates the logical offset value.

Parameters
offsetThe new offset to apply.

◆ addOffset()

void wEngine::OffsetComponent::addOffset ( sf::Vector2f delta)

Increments the current offset by a given vector.

Parameters
deltaThe additional offset to add to the current value.

◆ debugPrint()

void wEngine::OffsetComponent::debugPrint ( ) const

Outputs the current offset value to the console for debugging.


The documentation for this class was generated from the following files: