Cogs.Core
Source
Systems
Appearance
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
11
namespace
Cogs
12
{
13
namespace
Core
14
{
15
class
Context;
16
17
struct
ScreenSizeData
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
}
Cogs::Core::ComponentSystemBase::context
Context * context
Pointer to the Context instance the system lives in.
Definition:
ComponentSystem.h:136
Cogs::Core::ComponentSystemBase::update
void update()
Updates the system state to that of the current frame.
Definition:
ComponentSystem.h:65
Cogs::Core::ComponentSystemWithDataPools
Component system template with multiple parallel structures per component stored in separate pools si...
Definition:
ComponentSystem.h:252
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core::ScreenSizeSystem
Definition:
ScreenSizeSystem.h:26
Cogs::Core::ScreenSizeSystem::initialize
void initialize(Context *context) override
Initialize the system.
Definition:
ScreenSizeSystem.cpp:129
Cogs::Core::ScreenSizeSystem::cleanup
void cleanup(Context *context) override
Provided for custom cleanup logic in derived systems.
Definition:
ScreenSizeSystem.cpp:146
Cogs::Memory::Allocator
Base allocator implementation.
Definition:
Allocator.h:30
Cogs
Contains all Cogs related functionality.
Definition:
FieldSetter.h:23
Cogs::SizeType
ComponentIndex SizeType
Type used to track the size of pools.
Definition:
Component.h:19
Cogs::Core::ScreenSizeData
Definition:
ScreenSizeSystem.h:18
Cogs::Core::TaskId
Task id struct used to identify unique Task instances.
Definition:
TaskManager.h:20
Generated by
1.9.6