Cogs.Core
FontSelectorComponent.h
1#include "Components/Core/DynamicComponent.h"
2
3#include "Resources/Resources.h"
4
5namespace Cogs
6{
7 namespace Core
8 {
9 class Context;
10
11 enum class FontSelectorFlags
12 {
13 ApplyToChildren,
14 SelfOnly
15 };
16
21 {
22 public:
23 FontSelectorComponent() = default;
24
25 void initialize(Context * context);
26 void update();
27
29 std::string fontName = "Fonts/SourceSansPro-Regular.ttf";
31 float fontSize = 20.0f;
36 FontSelectorFlags flags = FontSelectorFlags::ApplyToChildren;
37
39 Context * context = nullptr;
40
41 static void registerType();
42 private:
43 static void recurseFontSelection(const FontSelectorComponent* source, const Entity* parent);
44 };
45 }
46}
47
48template<> inline Cogs::StringView getName<Cogs::Core::FontSelectorComponent>() { return "FontSelectorComponent"; }
49
50template<> inline Cogs::StringView getName<Cogs::Core::FontSelectorFlags>() { return "FontSelectorFlags"; }
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base class for components implementing dynamic behavior.
Creates fontHandle from Font+Size passing handle to other components having the 'fontHandle' field.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
static const ResourceHandle_t NoHandle
Handle representing a default (or none if default not present) resource.