Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
TriggerType.h
Go to the documentation of this file.
1#pragma once
2
8{
9
10public:
11
14 virtual ~TriggerType() { }
15
16 static const TriggerType None;
17 static const TriggerType Primary;
18 static const TriggerType Secondary;
19 static const TriggerType Special;
20 static const TriggerType All;
21
22
24 {
25 m_value = type.m_value;
26
27 return *this;
28 }
29
30 bool TriggerType::operator==(const TriggerType &type) const
31 {
32 return m_value == type.m_value;
33 }
34
35 bool TriggerType::operator!=(const TriggerType &type) const
36 {
37 return m_value != type.m_value;
38 }
39
40 bool TriggerType::operator<(const TriggerType &type) const
41 {
42 return m_value < type.m_value;
43 }
44
45 bool TriggerType::operator>(const TriggerType &type) const
46 {
47 return m_value > type.m_value;
48 }
49
50 const TriggerType operator|(const TriggerType &type) const
51 {
52 return (TriggerType)(m_value | type.m_value);
53 }
54
56 {
57 m_value |= type.m_value;
58
59 return *this;
60 }
61
62 const TriggerType operator&(const TriggerType &type) const
63 {
64 return (TriggerType)(m_value & type.m_value);
65 }
66
68 {
69 m_value &= type.m_value;
70
71 return *this;
72 }
73
74 const TriggerType operator^(const TriggerType &type) const
75 {
76 return (TriggerType)(m_value ^ type.m_value);
77 }
78
80 {
81 m_value ^= type.m_value;
82
83 return *this;
84 }
85
89 bool Contains(const TriggerType &type) const
90 {
91 return (m_value & type.m_value) > 0;
92 }
93
94
95protected:
96
99 TriggerType(const unsigned short value) { m_value = value; }
100
101
102private:
103
104 unsigned short m_value = 0;
105
106};
Represents a type of trigger, which can be used to activate weapons.
Definition TriggerType.h:8
bool operator<(const TriggerType &type) const
Definition TriggerType.h:40
bool operator>(const TriggerType &type) const
Definition TriggerType.h:45
TriggerType()
Instantiate a trigger type object.
Definition TriggerType.h:13
bool Contains(const TriggerType &type) const
Check if the trigger type contains a specific trigger.
Definition TriggerType.h:89
static const TriggerType None
Definition TriggerType.h:16
static const TriggerType All
Definition TriggerType.h:20
TriggerType & operator|=(const TriggerType &type)
Definition TriggerType.h:55
const TriggerType operator&(const TriggerType &type) const
Definition TriggerType.h:62
TriggerType & operator&=(const TriggerType &type)
Definition TriggerType.h:67
TriggerType(const unsigned short value)
Instantiate a trigger type object with a specific value.
Definition TriggerType.h:99
TriggerType & operator^=(const TriggerType &type)
Definition TriggerType.h:79
TriggerType & operator=(const TriggerType &type)
Definition TriggerType.h:23
const TriggerType operator|(const TriggerType &type) const
Definition TriggerType.h:50
const TriggerType operator^(const TriggerType &type) const
Definition TriggerType.h:74
virtual ~TriggerType()
Definition TriggerType.h:14
static const TriggerType Secondary
Definition TriggerType.h:18
bool operator==(const TriggerType &type) const
Definition TriggerType.h:30
bool operator!=(const TriggerType &type) const
Definition TriggerType.h:35
static const TriggerType Primary
Definition TriggerType.h:17
static const TriggerType Special
Definition TriggerType.h:19