CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
World.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
11
13
17
18#include <any>
19
20namespace CeresEngine {
21
22 struct CE_SCRIPT_EXPORT() PhysicsWorldComponent final : Component<PhysicsWorldComponent> {
24 struct Accessor;
25
29 Vector3 gravity = Vector3(0.0, 0.0, 0.0);
30
33 Any engineContext;
34
35 public: // Reflection
38 template<typename Processor> static constexpr void reflect(Processor&& RTTI) { CE_REFL_DATA(gravity); }
39 };
40
41 struct PhysicsWorldComponent::Accessor : public Component<PhysicsWorldComponent>::Accessor {
43
46 const Vector3& getGravity() const noexcept { return read(&C::gravity); }
47
51
52 public: // Reflection
55 template<typename Processor> static constexpr void reflect(Processor&& RTTI) { CE_REFL_DATA_GETSET(gravity, getGravity, setGravity); }
56 };
57
58 // ---------------------------------------------------------------------------------------------
59
60 class CE_SCRIPT_EXPORT() PhysicsWorld : public CeresEngine::EntityObject<PhysicsWorldComponent> {
61 public:
62 using EntityObject::EntityObject;
63 };
64
65} // namespace CeresEngine
66
69
#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_REFL_DATA_GETSET(N, G, S)
Definition Macros.hpp:549
#define CE_REFL_DATA(N)
Definition Macros.hpp:541
#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
Definition Any.hpp:13
A type-safe entity type.
Definition Entity.hpp:538
Definition World.hpp:60
Definition Application.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Accessor(const Entity &entity)
Definition Component.hpp:181
auto mutate(T C::*ptr)
Accesses an element from an existing Component.
const T & read(const T C::*ptr) const
Accesses an element from an existing Component.
Components serve as the base for data storage for an entity.
Definition Component.hpp:68
const Vector3 & getGravity() const noexcept
The physicsWorld gravity constant.
Definition World.hpp:46
static constexpr void reflect(Processor &&RTTI)
Executes the given processor for every field of the struct.
Definition World.hpp:55
void setGravity(const Vector3 &gravity) noexcept
The physicsWorld gravity constant.
Definition World.hpp:50
Definition World.hpp:22
Vector3 gravity
The physicsWorld gravity constant.
Definition World.hpp:29