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

This file defines GameObjectFactory class used to auto register GameObjects. More...

#include "Engine.hpp"
#include "components/ErrorUtils.hpp"
#include "components/GameObjects/GameObject.hpp"
#include "components/GameComponents/BasicComponents.hpp"
#include "VEX/VEX_export.h"
#include <functional>
#include <unordered_map>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  vex::GameObjectFactory
 Class responsible for registering and then creating GameObjects eg. Player, CameraObject. It is needed to load GameObjects from scene files but not all GameObjects can be registered. It requires your GameObject to not change constructor parameters. More...

Namespaces

namespace  vex

Macros

#define REGISTER_GAME_OBJECT(ClassName)
 Macro for automatic GameObject registration, you should call it at the bottom of your class implementation.

Detailed Description

This file defines GameObjectFactory class used to auto register GameObjects.

Author
Eryk Roszkowski

Definition in file GameObjectFactory.hpp.

Macro Definition Documentation

◆ REGISTER_GAME_OBJECT

#define REGISTER_GAME_OBJECT ( ClassName)
Value:
namespace { \
struct ClassName##Registrar { \
ClassName##Registrar() { \
GameObjectFactory::getInstance().registerClass<ClassName>(#ClassName, false); \
} \
}; \
static ClassName##Registrar ClassName##registrar; \
}

Macro for automatic GameObject registration, you should call it at the bottom of your class implementation.

Example usage:

class MyGameObject : public GameObject {
public:
MyGameObject(Engine& engine, const std::string& name) : GameObject(engine, name) {}
};
REGISTER_GAME_OBJECT(MyGameObject);
#define REGISTER_GAME_OBJECT(ClassName)
Macro for automatic GameObject registration, you should call it at the bottom of your class implement...

Definition at line 114 of file GameObjectFactory.hpp.