Cogs.Core
ScreenSizeSystem.h
1#pragma once
2
3#include "Systems/ComponentSystem.h"
4
5#include "Components/Appearance/ScreenSizeComponent.h"
6
7#include "Services/TaskManager.h"
8
9#include "Foundation/Geometry/BoundingBox.hpp"
10
11namespace Cogs
12{
13 namespace Core
14 {
15 class Context;
16
18 {
19 std::vector<Cogs::ComponentModel::Entity*> children = {};
20 std::vector<Cogs::Geometry::BoundingBox> childWorldBoundingBoxes = {};
21 float currentSize = std::numeric_limits<float>::max();
22 bool transformUpdateRequired = false;
23 };
24
25 class ScreenSizeSystem : public ComponentSystemWithDataPools<ScreenSizeComponent, ScreenSizeData>
26 {
27 public:
28 ScreenSizeSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPools(allocator, capacity) {}
29
30 void initialize(Context* context) override;
31 void update(Context* context) override;
32 void cleanup(Context* context) override;
33
34 private:
35 void calcluateNewScales(Context* context, bool workParallel);
36 void updateTransforms(Context* context, bool workParallel);
37
38 Cogs::Core::TaskId taskGroup = NoTask;
39 };
40 }
41}
Context * context
Pointer to the Context instance the system lives in.
void update()
Updates the system state to that of the current frame.
Component system template with multiple parallel structures per component stored in separate pools si...
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
void initialize(Context *context) override
Initialize the system.
void cleanup(Context *context) override
Provided for custom cleanup logic in derived systems.
Base allocator implementation.
Definition: Allocator.h:30
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19
Task id struct used to identify unique Task instances.
Definition: TaskManager.h:20