From 7c6e9618b57f103d76ee91c45b59e9a7f97dacd9 Mon Sep 17 00:00:00 2001 From: "Angelo Borges Silva (borgessa)" Date: Mon, 9 Dec 2019 18:05:31 +0000 Subject: [PATCH] Create timetableLoading.h --- timetableLoading.h | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 timetableLoading.h diff --git a/timetableLoading.h b/timetableLoading.h new file mode 100644 index 0000000..12505ec --- /dev/null +++ b/timetableLoading.h @@ -0,0 +1,65 @@ +#include +#include +//#include +//#include + +using namespace sf; + + + +// function timetable takes and uses the username parameter +// to get the courseId of each user which is the +// name of the timetable for each course +string timetable(string username) +{ + //sqlite3* db; + + //sqlite3_open("Timetablex.db", &db); + + //string timetableName = db("SELECT courseId WHERE (AccountName = " + username +";"); + + //sqlite3_close(); + string timetableName = "1"; + + return timetableName; +}; + + + +// function timetableLoading takes the username parameter +// and uses it in the name of the new window +// +// in the new window the timetable is rendered +// +// SFML library used to display the timetable +int timetableLoading(string username) +{ + + RenderWindow window(VideoMode(1270, 530), username + "'s Timetable"); + + string timetableName = timetable(username) + ".png"; + + Texture timetableTexture; + + timetableTexture.loadFromFile(timetableName); + + Sprite timetableSprite; + + timetableSprite.setTexture(timetableTexture); + + while (window.isOpen()) + { + Event event; + while (window.pollEvent(event)) + { + if (event.type == Event::Closed) + window.close(); + } + + window.clear(); + window.draw(timetableSprite); + window.display(); + } + + return 0; +};