aboutsummaryrefslogtreecommitdiff
path: root/examples/basic/src/basic_example.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/basic/src/basic_example.cpp')
-rw-r--r--examples/basic/src/basic_example.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/basic/src/basic_example.cpp b/examples/basic/src/basic_example.cpp
new file mode 100644
index 0000000..f85ed2d
--- /dev/null
+++ b/examples/basic/src/basic_example.cpp
@@ -0,0 +1,23 @@
+#include "bootstrap.hpp"
+#include "interfaces/enemy.hpp"
+#include "interfaces/hero.hpp"
+
+#include <iostream>
+
+int main()
+{
+ auto container = bootstrap();
+
+ auto hero = container.get<IHero>();
+
+ std::cout << "Created a hero\n";
+
+ auto enemy = container.get<IEnemy>();
+
+ std::cout << "Created a enemy with " << enemy->get_health() << " in health\n";
+
+ hero->fight(*enemy);
+
+ std::cout << "The hero hit the enemy! The enemy now has " << enemy->get_health()
+ << " in health\n";
+}