VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
ComponentFactory.hpp File Reference

Contains ComponentRegistry class used to have register of posible to create components.. More...

#include "components/GameComponents/BasicComponents.hpp"
#include "components/ErrorUtils.hpp"
#include "components/PathUtils.hpp"
#include "components/GameObjects/GameObject.hpp"
#include "components/ColorTypes.hpp"
#include "SerializationUtils.hpp"
#include <nlohmann/json.hpp>
#include <functional>
#include <unordered_map>
#include <string>
#include <glm/glm.hpp>
#include <components/Mesh.hpp>

Go to the source code of this file.

Classes

class  vex::ComponentRegistry
 Class registering GameComponents mainly used to load them in SceneManager. More...

Namespaces

namespace  vex

Macros

#define IMGUI_REFLECT(...)
#define VEX_CAT_IMPL(a, b)
 Helper macros to generate unique names based on line number.
#define VEX_CAT(a, b)
#define VEX_UNIQUE_NAME(prefix)
#define REGISTER_COMPONENT(Type, ...)
 Macro used to register GameComponents in ComponentRegistry. It allows to add component from scene file.
#define REGISTER_COMPONENT_CUSTOM(Type, ...)
 Same macro just skips json registration for more complex components, it requires manual registration.

Functions

template<typename T>
void vex::GenericComponentInspector (GameObject &obj)

Detailed Description

Contains ComponentRegistry class used to have register of posible to create components..

Author
Eryk Roszkowski

Definition in file ComponentFactory.hpp.

Macro Definition Documentation

◆ IMGUI_REFLECT

#define IMGUI_REFLECT ( ...)
Value:
;

Definition at line 255 of file ComponentFactory.hpp.

◆ REGISTER_COMPONENT

#define REGISTER_COMPONENT ( Type,
... )
Value:
namespace vex { NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, __VA_ARGS__) } \
IMGUI_REFLECT(Type, __VA_ARGS__) \
namespace { \
struct VEX_UNIQUE_NAME(Registrar_) { \
VEX_UNIQUE_NAME(Registrar_)() { \
vex::ComponentRegistry::getInstance().registerComponent<Type>(#Type, false); \
} \
~VEX_UNIQUE_NAME(Registrar_)() { \
vex::ComponentRegistry::getInstance().unregisterComponent(#Type); \
} \
}; \
static VEX_UNIQUE_NAME(Registrar_) VEX_UNIQUE_NAME(g_registrar_); \
}

Macro used to register GameComponents in ComponentRegistry. It allows to add component from scene file.

Example usage:

REGISTER_COMPONENT(CameraComponent, fov, nearPlane, farPlane);
#define REGISTER_COMPONENT(Type,...)
Macro used to register GameComponents in ComponentRegistry. It allows to add component from scene fil...

Definition at line 466 of file ComponentFactory.hpp.

◆ REGISTER_COMPONENT_CUSTOM

#define REGISTER_COMPONENT_CUSTOM ( Type,
... )
Value:
IMGUI_REFLECT(Type, __VA_ARGS__) \
namespace { \
struct VEX_UNIQUE_NAME(Registrar_) { \
VEX_UNIQUE_NAME(Registrar_)() { \
vex::ComponentRegistry::getInstance().registerComponent<Type>(#Type, false); \
} \
~VEX_UNIQUE_NAME(Registrar_)() { \
vex::ComponentRegistry::getInstance().unregisterComponent(#Type); \
} \
}; \
static VEX_UNIQUE_NAME(Registrar_) VEX_UNIQUE_NAME(g_registrar_); \
}

Same macro just skips json registration for more complex components, it requires manual registration.

Definition at line 482 of file ComponentFactory.hpp.

◆ VEX_CAT

#define VEX_CAT ( a,
b )
Value:
#define VEX_CAT_IMPL(a, b)
Helper macros to generate unique names based on line number.

Definition at line 427 of file ComponentFactory.hpp.

◆ VEX_CAT_IMPL

#define VEX_CAT_IMPL ( a,
b )
Value:
a##b

Helper macros to generate unique names based on line number.

Definition at line 426 of file ComponentFactory.hpp.

◆ VEX_UNIQUE_NAME

#define VEX_UNIQUE_NAME ( prefix)
Value:
VEX_CAT(prefix, __LINE__)

Definition at line 428 of file ComponentFactory.hpp.