Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::example::ExampleSystem Struct Referencefinal

Example system that increments the counter in ExampleResource. More...

#include <example.hpp>

Inheritance diagram for helios::example::ExampleSystem:
helios::ecs::System

Public Member Functions

void Update (app::SystemContext &ctx) override
 Updates the system, incrementing the example resource counter.
 
- Public Member Functions inherited from helios::ecs::System
virtual ~System ()=default
 

Static Public Member Functions

static constexpr std::string_view GetName () noexcept
 Returns the name of the system.
 
static constexpr auto GetAccessPolicy () noexcept
 Returns the access policy for this system.
 

Detailed Description

Example system that increments the counter in ExampleResource.

This system demonstrates how to create a system that operates on resources.

Definition at line 37 of file example.hpp.

Member Function Documentation

◆ GetAccessPolicy()

static constexpr auto helios::example::ExampleSystem::GetAccessPolicy ( )
inlinestaticconstexprnoexcept

Returns the access policy for this system.

Returns
Access policy declaring resource writes.
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/modules/example/include/helios/example/example.hpp.

Definition at line 48 of file example.hpp.

48{ return app::AccessPolicy().WriteResources<ExampleResource>(); }

◆ GetName()

static constexpr std::string_view helios::example::ExampleSystem::GetName ( )
inlinestaticconstexprnoexcept

Returns the name of the system.

Returns
System name.
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/modules/example/include/helios/example/example.hpp.

Definition at line 42 of file example.hpp.

42{ return "ExampleSystem"; }

◆ Update()

void helios::example::ExampleSystem::Update ( app::SystemContext ctx)
overridevirtual

Updates the system, incrementing the example resource counter.

Parameters
ctxThe system context providing access to resources.

Implements helios::ecs::System.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/modules/example/include/helios/example/example.hpp.

Definition at line 8 of file example.cpp.

8 {
9 auto& resource = ctx.WriteResource<ExampleResource>();
10 ++resource.counter;
11}