Cogs.Core
Text3DSystem.h
1#pragma once
2
3#include "../ComponentSystem.h"
4
5#include "../../Components/Core/Text3DComponent.h"
6
7namespace Cogs {
8 namespace Core {
9 class Context;
10 class FontManager;
11
15 class Text3DSystem : public ComponentSystem<Text3DComponent>
16 {
17 public:
18 Text3DSystem(Memory::Allocator* allocator, SizeType capacity) : ComponentSystem(allocator, capacity) {}
19
20 virtual void update(Context* context) override;
21
22 private:
23 MaterialHandle textMaterial;
24
25 static float calcTextWidth(const FontManager* fontManager,
26 const Font& font,
27 const std::string& text);
28
29 static void generateText(std::vector<glm::vec3>& vertices,
30 std::vector<glm::vec2>& uvs,
31 const FontManager* fontManager,
32 const Font& font,
33 const std::string& text,
34 glm::vec3 position,
35 glm::vec3 hAxis,
36 glm::vec3 vAxis,
37 Alignment alignment);
38 };
39 }
40}
Context * context
Pointer to the Context instance the system lives in.
void update()
Updates the system state to that of the current frame.
Typed component system managing a pool of components with the given ComponentType.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Font manager responsible for loading, processing and lifetime of Font resources.
Definition: FontManager.h:40
The 3D text system handles Text3DComponents.
Definition: Text3DSystem.h:16
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
Font resources are used to render text with a specific font and size.
Definition: Font.h:22