|
R-Type
Distributed multiplayer game engine in C++
|
System managing entity boundaries and screen limits. More...
#include <BoundarySystem.hpp>


Public Member Functions | |
| BoundarySystem (int screenWidth=1920, int screenHeight=1080) | |
| Constructs a BoundarySystem with specified screen dimensions. | |
| ~BoundarySystem () override=default | |
| Default destructor. | |
| void | update (Registry ®istry, float deltaTime) override |
| Checks entities against screen boundaries. | |
| ComponentMask | getComponentMask () const override |
| Gets the component mask for this system. | |
| void | setScreenSize (int width, int height) |
| Updates the screen dimensions. | |
Public Member Functions inherited from ecs::ISystem | |
| virtual | ~ISystem ()=default |
| Virtual destructor. | |
Private Attributes | |
| int | _screenWidth |
| int | _screenHeight |
System managing entity boundaries and screen limits.
Handles entities going out of bounds and applies boundary constraints. Requires Transform component.
Definition at line 22 of file BoundarySystem.hpp.
| ecs::BoundarySystem::BoundarySystem | ( | int | screenWidth = 1920, |
| int | screenHeight = 1080 |
||
| ) |
Constructs a BoundarySystem with specified screen dimensions.
| screenWidth | Width of the screen/game area (default: 1920) |
| screenHeight | Height of the screen/game area (default: 1080) |
Definition at line 16 of file BoundarySystem.cpp.
|
overridedefault |
Default destructor.
|
overridevirtual |
Gets the component mask for this system.
Implements ecs::ISystem.
Definition at line 64 of file BoundarySystem.cpp.
Referenced by update().
| void ecs::BoundarySystem::setScreenSize | ( | int | width, |
| int | height | ||
| ) |
Updates the screen dimensions.
Allows dynamic adjustment of boundary limits when screen is resized.
| width | New screen width |
| height | New screen height |
Definition at line 59 of file BoundarySystem.cpp.
References _screenHeight, and _screenWidth.
|
overridevirtual |
Checks entities against screen boundaries.
Checks entities against boundaries and marks out-of-bounds entities for destruction.
Destroys entities that have moved outside the screen bounds (with a 100-pixel margin). Typically used for projectiles and enemies.
| registry | Reference to the ECS registry |
| deltaTime | Time elapsed since last frame (in seconds) |
Instead of destroying entities directly, this system adds a PendingDestroy component. The server will then:
This prevents interpolation bugs where clients try to interpolate to old positions.
Implements ecs::ISystem.
Definition at line 29 of file BoundarySystem.cpp.
References _screenHeight, _screenWidth, ecs::Registry::getComponent(), getComponentMask(), ecs::Registry::getEntitiesWithMask(), ecs::Transform::getPosition(), ecs::Registry::hasComponent(), LOG_WARNING, ecs::OutOfBounds, and ecs::Registry::setComponent().

|
private |
Definition at line 67 of file BoundarySystem.hpp.
Referenced by setScreenSize(), and update().
|
private |
Definition at line 66 of file BoundarySystem.hpp.
Referenced by setScreenSize(), and update().