CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Component.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "EntityScript.hpp"
11
13
15
18
19#include <any>
20
21namespace CeresEngine {
22
23 struct CE_SCRIPT_EXPORT(name = "ScriptingComponent") ScriptComponent final : public Component<ScriptComponent> {
25 struct Accessor;
26
29
32 explicit ScriptComponent(SPtr<EntityScript> script) : script(std::move(script)) {}
33 };
34
35 struct ScriptComponent::Accessor : public Component<ScriptComponent>::Accessor {
37
40 };
41
43 class ScriptedObject : public EntityObject<ScriptComponent> {
44 public:
46 };
47
48} // namespace CeresEngine
49
52
#define CE_EXTERN_COMPONENT(T)
Definition Component.hpp:600
#define CE_ENTITY_OBJECT_HASH(T)
Definition Entity.hpp:784
#define CE_REFLECTABLE_STRUCT
Definition IReflectable.hpp:47
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition Macros.hpp:247
A type-safe entity type.
Definition Entity.hpp:538
EntityObject()=default
Creates a new entity object.
An entity type with an associated script.
Definition Component.hpp:43
Definition Application.hpp:19
std::shared_ptr< T > SPtr
SPtr is a smart pointer that retains shared ownership of an object through a pointer.
Definition SmartPtr.hpp:37
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Span.hpp:668
Accessor(const Entity &entity)
Definition Component.hpp:181
Components serve as the base for data storage for an entity.
Definition Component.hpp:68
Definition Component.hpp:35
const SPtr< EntityScript > & getScript() const
The script instance associated with the entity.
Definition Component.hpp:23
SPtr< EntityScript > script
The script to be ran by the scripting system.
Definition Component.hpp:28
ScriptComponent(SPtr< EntityScript > script)
Creates a new script component.
Definition Component.hpp:32