-
Notifications
You must be signed in to change notification settings - Fork 1
Create a new Component
Prog'z edited this page Apr 20, 2021
·
4 revisions
How to create a new Component ?
- Create your file
- Reflect the file (include .rfk.h in the .hpp and add File_GENERATED in the .cpp)
- Create your Component class
- Reflect your Component class (add RFKClass() and MyClass_GENERATED)
- Reflect the namespace the class is in if necessary
- Don't forget to add the ComponentGen property to RFKClass() or random crashes can happen /!\
- You can add the property Inspect() if you want the class to be inspected
- You can add the property Serialize() if you want the class to be saved and loaded
The default constructor and destructor must not be deleted. Components can't be moved, since they have to be fixed in memory.
MyFpsScript.hpp :
// includes
// ...
// Generated
#include "Generated/myFpsScript.rfk.h"
namespace GPG RFKNamespace()
{
class RFKClass(Inspect(), ComponentGen, Serialize()) MyFpsScript : public GPE::BehaviourComponent
{
public:
inline MyFpsScript(GPE::GameObject & owner) noexcept
: GPE::BehaviourComponent(owner)
{
}
MyFpsScript() noexcept = default;
MyFpsScript(const MyFpsScript& other) noexcept = delete;
MyFpsScript(MyFpsScript && other) noexcept = delete;
virtual ~MyFpsScript() noexcept = default;
MyFpsScript& operator=(MyFpsScript const& other) noexcept = delete;
MyFpsScript& operator=(MyFpsScript&& other) noexcept = delete;
MyFpsScript_GENERATED
};
}
MyFpsScript.cpp :
#include "myFpsScript.hpp"
#include "Generated/myFpsScript.rfk.h"
File_GENERATED
// Functions declaration
// ...