CSEngine
Loading...
Searching...
No Matches
MoreComponentFunc.cpp
1
//
2
// Created by ounols on 19. 8. 31.
3
//
4
5
#include "MoreComponentFunc.h"
6
#include "../Component/Animation/AnimatorComponent.h"
7
#include "../Component/CameraComponent.h"
8
#include "../Component/CustomComponent.h"
9
#include "../Component/LightComponent.h"
10
#include "../Component/RenderComponent.h"
11
#include "../Component/TransformComponent.h"
12
13
#define CREATE_COMPONENT_MACRO(CLASSNAME) \
14
if(component_type == #CLASSNAME) { \
15
return obj->CreateComponent<CLASSNAME>(); \
16
}
17
18
#define BIND_COMPONENT_MACRO(CLASSNAME) \
19
if(component_type == #CLASSNAME) { \
20
auto comp_r = static_cast<CLASSNAME*>(component); \
21
instance->set(name.c_str(), comp_r); \
22
return; \
23
}
24
25
using namespace
CSE;
26
27
SComponent
* MoreComponentFunc::CreateComponent(
SGameObject
* obj, std::string component_type) {
28
29
CREATE_COMPONENT_MACRO(
AnimatorComponent
);
30
CREATE_COMPONENT_MACRO(
JointComponent
);
31
CREATE_COMPONENT_MACRO(
CameraComponent
);
32
CREATE_COMPONENT_MACRO(
CustomComponent
);
33
CREATE_COMPONENT_MACRO(
DrawableSkinnedMeshComponent
);
34
CREATE_COMPONENT_MACRO(
DrawableStaticMeshComponent
);
35
CREATE_COMPONENT_MACRO(
LightComponent
);
36
CREATE_COMPONENT_MACRO(
RenderComponent
);
37
CREATE_COMPONENT_MACRO(
TransformComponent
);
38
39
return
nullptr
;
40
41
}
42
43
void
MoreComponentFunc::BindComponentToSQInstance(
SComponent
* component, std::string name,
44
sqext::SQIClassInstance* instance) {
45
std::string component_type = component->GetClassType();
46
47
BIND_COMPONENT_MACRO(
AnimatorComponent
);
48
BIND_COMPONENT_MACRO(
JointComponent
);
49
BIND_COMPONENT_MACRO(
CameraComponent
);
50
BIND_COMPONENT_MACRO(
CustomComponent
);
51
BIND_COMPONENT_MACRO(
DrawableSkinnedMeshComponent
);
52
BIND_COMPONENT_MACRO(
DrawableStaticMeshComponent
);
53
BIND_COMPONENT_MACRO(
LightComponent
);
54
BIND_COMPONENT_MACRO(
RenderComponent
);
55
BIND_COMPONENT_MACRO(
TransformComponent
);
56
}
57
CSE::AnimatorComponent
Definition
AnimatorComponent.h:10
CSE::CameraComponent
Definition
CameraComponent.h:30
CSE::CustomComponent
Definition
CustomComponent.h:11
CSE::DrawableSkinnedMeshComponent
Definition
DrawableSkinnedMeshComponent.h:8
CSE::DrawableStaticMeshComponent
Definition
DrawableStaticMeshComponent.h:8
CSE::JointComponent
Definition
JointComponent.h:8
CSE::LightComponent
Definition
LightComponent.h:13
CSE::RenderComponent
Definition
RenderComponent.h:15
CSE::SComponent
Definition
SComponent.h:17
CSE::SGameObject
Definition
SGameObject.h:17
CSE::TransformComponent
Definition
TransformComponent.h:10
Util
MoreComponentFunc.cpp
Generated on Fri Nov 22 2024 01:09:31 for CSEngine by
1.9.8