Cogs.Core
Extensions
WellLog
Source
WellLogExtension.cpp
1
#include "Context.h"
2
#include "ExtensionRegistry.h"
3
#include "Serialization/EntityReader.h"
4
5
#include "Components/ZipComponent.h"
6
#include "Systems/ZipSystem.h"
7
8
namespace
Cogs
9
{
10
namespace
Core
11
{
12
struct
WellLogExtension
:
public
Extension
13
{
14
WellLogExtension
() {
ExtensionRegistry::add
(
this
, COGS_CORE_VERSION_STRING); }
15
16
bool
initializeStatic
()
override
;
17
bool
initialize
(
Context
*context)
override
;
18
const
char
*
getExtensionKey
()
const override
{
return
"WellLog"
; }
19
} wellLogExtension;
20
21
bool
WellLogExtension::initializeStatic
()
22
{
23
ZipComponent::registerType();
24
return
true
;
25
}
26
27
bool
WellLogExtension::initialize
(
Context
*context)
28
{
29
readEntityDefinition(R
"(
30
{
31
"name": "WellLog",
32
"components": [
33
"TransformComponent",
34
"SceneComponent",
35
"MeshComponent",
36
"SubMeshRenderComponent",
37
"ZipComponent",
38
"MaterialComponent"
39
]
40
}
41
)", context->
store
);
42
43
ExtensionRegistry::registerExtensionSystem<ZipSystem>(context,
SystemPriority::PostView
, 128);
44
return
true
;
45
}
46
}
47
}
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core::Context::store
class EntityStore * store
Entity store.
Definition:
Context.h:231
Cogs::Core::ExtensionRegistry::add
static void add(Extension *extension, StringView version)
Adds the given extension to the registry, ensuring the initialization methods are called at appropria...
Definition:
ExtensionRegistry.cpp:34
Cogs
Contains all Cogs related functionality.
Definition:
FieldSetter.h:23
Cogs::Core::Extension
Defines an extension to Cogs.Core and provides methods to override in order to initialize extension c...
Definition:
ExtensionRegistry.h:54
Cogs::Core::SystemPriority::PostView
@ PostView
Run after view data has been updated. Anything after this is appropriate for geometry depending on e....
Definition:
Engine.h:66
Cogs::Core::WellLogExtension
Definition:
WellLogExtension.cpp:13
Cogs::Core::WellLogExtension::getExtensionKey
const char * getExtensionKey() const override
Get the extensions unique key, used to check for extension presence and retrieve extension specific d...
Definition:
WellLogExtension.cpp:18
Cogs::Core::WellLogExtension::initialize
bool initialize(Context *context) override
Initialize extension for the given context.
Definition:
WellLogExtension.cpp:27
Cogs::Core::WellLogExtension::initializeStatic
bool initializeStatic() override
Initialize extension statically.
Definition:
WellLogExtension.cpp:21
Generated by
1.9.6