aboutsummaryrefslogtreecommitdiff
path: root/frontend/GameData.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 01:29:58 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 01:29:58 +0100
commitb9e738502260b8f448289c9888203971c7749c76 (patch)
tree09477251ba49307173a112e0cd5dbdd3633346ce /frontend/GameData.cpp
parente4261302944303781c952943e3290c99e2cabc52 (diff)
WIP SQL gedoe
Diffstat (limited to 'frontend/GameData.cpp')
-rw-r--r--frontend/GameData.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/frontend/GameData.cpp b/frontend/GameData.cpp
index ad22aa0..0cf6a1d 100644
--- a/frontend/GameData.cpp
+++ b/frontend/GameData.cpp
@@ -1,5 +1,10 @@
#include <memory>
+#include "backend/Enemy.h"
+#include "backend/EnemyFactory.h"
+#include "backend/Object.h"
+#include "backend/ObjectFactory.h"
+
#include "GameData.h"
using namespace std;
@@ -13,3 +18,24 @@ GameData::GameData() {
this->db = make_unique<DB>("kerkersendraken.db");
}
+Enemy * GameData::create_enemy(const string & name) {
+ Enemy * enemy = EnemyFactory::create_enemy();
+ return enemy;
+}
+
+Object * GameData::create_object(const string & name) {
+ DBStatement query = this->db->prepare("select type from Objecten where naam = ?");
+ query.bind(name);
+ // TODO: uhhhhhhhhh data ophalen
+
+ Object * object = ObjectFactory::create_object();
+ return object;
+}
+
+void GameData::leaderbord_add(const string & name, unsigned int gold) {
+ this->db->prepare("insert into Leaderboard (naam, goudstukken) values (?, ?)")
+ .bind(name)
+ .bind(gold)
+ .execute();
+}
+