Skip to content

Struct Engine::Position

ClassList > Engine > Position

A basic component representing a 2D position (x, y) plus a draw layer (z). More...

  • #include <Position.hpp>

Public Attributes

Type Name
bool moved
True when (x, y, z) differs from (prevX, prevY, prevZ); updated by PositionSystem .
float prevX
float prevY
int prevZ
bool relative = false
When true and the entity has Parent ,HierarchySystem applies the parent's frame delta to this position.
float x
float y
int z
Draw layer: entities with a higher z are drawn on top of lower ones.

Public Functions

Type Name
Position (float x=0.0f, float y=0.0f, int z=0)
Creates a Position . Previous-frame coordinates start equal to the current ones so the entity is not reported as moved on spawn.

Detailed Description

Holds current (x, y, z), previous-frame (prevX, prevY, prevZ), moved, and relative. Stored x/y are always world coordinates; relative only gates HierarchySystem delta follow.

Public Attributes Documentation

variable moved

True when (x, y, z) differs from (prevX, prevY, prevZ); updated by PositionSystem .

bool Engine::Position::moved;


variable prevX

float Engine::Position::prevX;

variable prevY

float Engine::Position::prevY;

variable prevZ

int Engine::Position::prevZ;

variable relative

When true and the entity has Parent ,HierarchySystem applies the parent's frame delta to this position.

bool Engine::Position::relative;


variable x

float Engine::Position::x;

variable y

float Engine::Position::y;

variable z

Draw layer: entities with a higher z are drawn on top of lower ones.

int Engine::Position::z;


Public Functions Documentation

function Position

Creates a Position . Previous-frame coordinates start equal to the current ones so the entity is not reported as moved on spawn.

inline Engine::Position::Position (
    float x=0.0f,
    float y=0.0f,
    int z=0
) 

Parameters:

  • x The initial X position.
  • y The initial Y position.
  • z The initial draw layer.


The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Components/Position.hpp