Flecs: include/flecs/addons/cpp/mixins/pipeline/impl.hpp Source File
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.0 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
impl.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "builder.hpp"
9
10namespace flecs {
11
12template <typename ... Components>
13 struct pipeline : entity {
14 pipeline(world_t *world, ecs_pipeline_desc_t *desc)
15 : entity(world)
16 {
17 id_ = ecs_pipeline_init(world, desc);
18
19 if (!id_) {
20 ecs_abort(ECS_INVALID_PARAMETER, NULL);
21 }
22 }
23};
24
25 inline flecs::pipeline_builder<> world::pipeline() const {
26 return flecs::pipeline_builder<>(world_);
27}
28
29template <typename Pipeline, if_not_t< is_enum<Pipeline>::value >>
30 inline flecs::pipeline_builder<> world::pipeline() const {
31 return flecs::pipeline_builder<>(world_, _::type<Pipeline>::id(world_));
32}
33
34 inline void world::set_pipeline(const flecs::entity pip) const {
35 return ecs_set_pipeline(world_, pip);
36}
37
38template <typename Pipeline>
39 inline void world::set_pipeline() const {
40 return ecs_set_pipeline(world_, _::type<Pipeline>::id(world_));
41}
42
43 inline flecs::entity world::get_pipeline() const {
44 return flecs::entity(world_, ecs_get_pipeline(world_));
45}
46
47 inline bool world::progress(ecs_ftime_t delta_time) const {
48 return ecs_progress(world_, delta_time);
49}
50
51 inline void world::run_pipeline(const flecs::entity_t pip, ecs_ftime_t delta_time) const {
52 return ecs_run_pipeline(world_, pip, delta_time);
53}
54
55template <typename Pipeline, if_not_t< is_enum<Pipeline>::value >>
56 inline void world::run_pipeline(ecs_ftime_t delta_time) const {
57 return ecs_run_pipeline(world_, _::type<Pipeline>::id(world_), delta_time);
58}
59
60 inline void world::set_time_scale(ecs_ftime_t mul) const {
61 ecs_set_time_scale(world_, mul);
62}
63
64 inline void world::set_target_fps(ecs_ftime_t target_fps) const {
65 ecs_set_target_fps(world_, target_fps);
66}
67
68 inline void world::reset_clock() const {
69 ecs_reset_clock(world_);
70}
71
72 inline void world::set_threads(int32_t threads) const {
73 ecs_set_threads(world_, threads);
74}
75
76 inline int32_t world::get_threads() const {
77 return ecs_get_stage_count(world_);
78}
79
80 inline void world::set_task_threads(int32_t task_threads) const {
81 ecs_set_task_threads(world_, task_threads);
82}
83
84 inline bool world::using_task_threads() const {
85 return ecs_using_task_threads(world_);
86}
87
88}
ecs_abort
#define ecs_abort(error_code,...)
Abort.
Definition log.h:359
ecs_set_threads
FLECS_API void ecs_set_threads(ecs_world_t *world, int32_t threads)
Set number of worker threads.
ecs_set_time_scale
FLECS_API void ecs_set_time_scale(ecs_world_t *world, ecs_ftime_t scale)
Set time scale.
ecs_set_pipeline
FLECS_API void ecs_set_pipeline(ecs_world_t *world, ecs_entity_t pipeline)
Set a custom pipeline.
ecs_get_pipeline
FLECS_API ecs_entity_t ecs_get_pipeline(const ecs_world_t *world)
Get the current pipeline.
ecs_progress
FLECS_API bool ecs_progress(ecs_world_t *world, ecs_ftime_t delta_time)
Progress a world.
ecs_reset_clock
FLECS_API void ecs_reset_clock(ecs_world_t *world)
Reset world clock.
ecs_run_pipeline
FLECS_API void ecs_run_pipeline(ecs_world_t *world, ecs_entity_t pipeline, ecs_ftime_t delta_time)
Run pipeline.
ecs_using_task_threads
FLECS_API bool ecs_using_task_threads(ecs_world_t *world)
Returns true if task thread use have been requested.
ecs_set_task_threads
FLECS_API void ecs_set_task_threads(ecs_world_t *world, int32_t task_threads)
Set number of worker task threads.
ecs_pipeline_init
FLECS_API ecs_entity_t ecs_pipeline_init(ecs_world_t *world, const ecs_pipeline_desc_t *desc)
Create a custom pipeline.
ecs_get_stage_count
int32_t ecs_get_stage_count(const ecs_world_t *world)
Get number of configured stages.
flecs::world::set_threads
void set_threads(int32_t threads) const
Set number of threads.
Definition impl.hpp:72
flecs::world::set_time_scale
void set_time_scale(ecs_ftime_t mul) const
Set timescale.
Definition impl.hpp:60
flecs::world::set_pipeline
void set_pipeline() const
Set pipeline.
Definition impl.hpp:39
flecs::world::reset_clock
void reset_clock() const
Reset simulation clock.
Definition impl.hpp:68
flecs::world::set_target_fps
void set_target_fps(ecs_ftime_t target_fps) const
Set target FPS.
Definition impl.hpp:64
flecs::world::set_task_threads
void set_task_threads(int32_t task_threads) const
Set number of task threads.
Definition impl.hpp:80
flecs::world::run_pipeline
void run_pipeline(const flecs::entity_t pip, ecs_ftime_t delta_time=0.0) const
Run pipeline.
Definition impl.hpp:51
flecs::world::using_task_threads
bool using_task_threads() const
Returns true if task thread use has been requested.
Definition impl.hpp:84
flecs::world::pipeline
flecs::pipeline_builder pipeline() const
Create a new pipeline.
Definition impl.hpp:25
flecs::world::progress
bool progress(ecs_ftime_t delta_time=0.0) const
Progress world one tick.
Definition impl.hpp:47
flecs::world::get_threads
int32_t get_threads() const
Set number of threads.
Definition impl.hpp:76
flecs::world::get_pipeline
flecs::entity get_pipeline() const
Get pipeline.
Definition impl.hpp:43
ecs_ftime_t
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:59
ecs_set_target_fps
void ecs_set_target_fps(ecs_world_t *world, float fps)
Set target frames per second (FPS) for application.
builder.hpp
Pipeline builder.
ecs_pipeline_desc_t
Pipeline descriptor, used with ecs_pipeline_init().
Definition pipeline.h:88
flecs::_::type
Definition flecs.hpp:39
flecs::entity
Entity.
Definition entity.hpp:30
flecs::pipeline_builder
Pipeline builder.
Definition builder.hpp:24
flecs::world
The world.
Definition world.hpp:137
flecs::world::delta_time
ecs_ftime_t delta_time() const
Get delta_time.
Definition world.hpp:1181