Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
aegis2d::ecs::Aabb Struct Reference

Axis-aligned box given by its two corners, in logical pixels. More...

#include <aegis2d/ecs/collision.hpp>

Public Member Functions

bool overlaps (const Aabb &other) const noexcept
 Tells whether two boxes overlap.
 

Static Public Member Functions

static Aabb of (const Transform &transform, const Collider &collider) noexcept
 Box of an entity's collider, placed on its transform.
 

Public Attributes

Vec2 min {}
 Top-left corner (smallest x and y).
 
Vec2 max {}
 Bottom-right corner (largest x and y).
 

Detailed Description

Axis-aligned box given by its two corners, in logical pixels.

Member Function Documentation

◆ of()

static Aabb aegis2d::ecs::Aabb::of ( const Transform &  transform,
const Collider &  collider 
)
inlinestaticnoexcept

Box of an entity's collider, placed on its transform.

Parameters
transformPosition of the entity (its center).
colliderSize and offset of the box.
Returns
The box centered on transform.position + collider.offset.

◆ overlaps()

bool aegis2d::ecs::Aabb::overlaps ( const Aabb &  other) const
inlinenoexcept

Tells whether two boxes overlap.

Boxes that only touch (an edge of one on an edge of the other) do not overlap, and a box with a NaN corner overlaps nothing.

Parameters
otherBox to test.
Returns
true if the boxes share an area.

Member Data Documentation

◆ max

Vec2 aegis2d::ecs::Aabb::max {}

Bottom-right corner (largest x and y).

◆ min

Vec2 aegis2d::ecs::Aabb::min {}

Top-left corner (smallest x and y).


The documentation for this struct was generated from the following file: