-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharacter.cpp
More file actions
33 lines (26 loc) · 741 Bytes
/
Character.cpp
File metadata and controls
33 lines (26 loc) · 741 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
#include "stdafx.h"
#include "Character.h"
#include "CharacterRules.h"
Character::Character(const std::string & name)
:m_name(name)
{
}
Character::~Character(void)
{
}
CompositeImage Character::draw(const Box & box) const
{
Rule & rule = CharacterRules::rule_for(*this);
std::vector<ImageWithAnchors> shape_images = drawShapes(box, rule.shapes);
return ImageWithAnchors::join(shape_images, box, rule);
}
std::vector<ImageWithAnchors> Character::drawShapes(const Box & box, const std::vector<Shape*> & shapes) const
{
std::vector<ImageWithAnchors> result;
for (std::vector<Shape*>::const_iterator it = shapes.begin(); it != shapes.end(); ++it)
{
Shape & shape = **it;
result.push_back(shape.draw(box));
}
return result;
}