-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChild.cpp
More file actions
47 lines (31 loc) · 859 Bytes
/
Child.cpp
File metadata and controls
47 lines (31 loc) · 859 Bytes
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
#include "Headers/Child.hpp"
#include "Headers/Female.hpp"
#include "Headers/Male.hpp"
#include <iostream>
Child_E::Child_E()
: Elephant_Base()
, mPtr(nullptr) {
}
Child_E::Child_E(TextureHolder& text, std::pair<Elephant_Base::Gene, Elephant_Base::Gene> g, age_value a)
: Elephant_Base(text, Traits::sexOf(g), Traits::hasTusks(g), a)
, mPtr(nullptr) {
switch(getTraits().sex) {
case Female:
mPtr = new Female_E(text, getTraits().tusks, a);
break;
case Male:
mPtr = new Male_E(text, getTraits().tusks, a);
break;
}
}
void Child_E::update(sf::Time dt) {
toAge(dt);
}
Elephant_Base::Ptr Child_E::getData() const {
return mPtr;
}
void Child_E::draw(sf::RenderTarget& target, sf::RenderStates states) const {
states.transform *= getTransform();
states.transform.scale(0.8f, 0.8f);
target.draw(*mPtr, states);
}