-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponentType.cpp
More file actions
53 lines (48 loc) · 1.67 KB
/
Copy pathComponentType.cpp
File metadata and controls
53 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "ComponentType.h"
using namespace std;
ObjectTag toObjectTag(const std::string& name)
{
// The level file's exact spellings. Note "Player" is capitalised while
// "invader" and "bullet" are not -- an inconsistency that used to be
// load-bearing, because these strings were compared directly all over the
// codebase. It is now confined to this one function.
if (name == "Player") { return ObjectTag::Player; }
if (name == "invader") { return ObjectTag::Invader; }
if (name == "bullet") { return ObjectTag::Bullet; }
return ObjectTag::Unknown;
}
const char* toString(ObjectTag tag)
{
switch (tag)
{
case ObjectTag::Player: return "Player";
case ObjectTag::Invader: return "invader";
case ObjectTag::Bullet: return "bullet";
case ObjectTag::Unknown: return "unknown";
}
return "unknown";
}
const char* toString(ComponentType type)
{
switch (type)
{
case ComponentType::Update: return "update";
case ComponentType::Graphics: return "graphics";
case ComponentType::Transform: return "transform";
case ComponentType::Collider: return "collider";
}
return "unknown";
}
const char* toString(ComponentSpecificType type)
{
switch (type)
{
case ComponentSpecificType::Player: return "player";
case ComponentSpecificType::Invader: return "invader";
case ComponentSpecificType::Bullet: return "bullet";
case ComponentSpecificType::Rect: return "rect";
case ComponentSpecificType::Standard: return "standard";
case ComponentSpecificType::Transform: return "transform";
}
return "unknown";
}