blob: 7a78aeccaeb276fa4f8261c6d5ce880407606392 (
plain)
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
|
#include "bootstrap.hpp"
// Interfaces
#include "interfaces/enemy.hpp"
#include "interfaces/enemy_creator.hpp"
#include "interfaces/hero.hpp"
#include "interfaces/weapon.hpp"
// Concretes
#include "enemy.hpp"
#include "enemy_creator.hpp"
#include "hero.hpp"
#include "sword.hpp"
yacppdic::Container bootstrap()
{
auto container = yacppdic::Container();
container.bind<IHero>().to<Hero>();
container.bind<IWeapon>().to<Sword>();
container.bind<IEnemyCreator>().to<EnemyCreator>();
container.bind<IEnemyFactory>()
.to_factory(
[]()
{
return std::make_unique<Enemy>(65);
}
)
.when_tagged(SMALL_ENEMY_TAG);
container.bind<IEnemyFactory>()
.to_factory(
[]()
{
return std::make_unique<Enemy>(130);
}
)
.when_tagged(BIG_ENEMY_TAG);
return container;
}
|