diff --git a/view/inc/Vapp.hpp b/view/inc/Vapp.hpp index 5f9873d..e5fda0f 100644 --- a/view/inc/Vapp.hpp +++ b/view/inc/Vapp.hpp @@ -19,7 +19,7 @@ constexpr int numberOfFunc = 2; class Vapp { public: - void init(); + void init(char* filename); void update(); void draw(); void deinit(); diff --git a/view/src/Vapp.cpp b/view/src/Vapp.cpp index 6551095..c50ec59 100644 --- a/view/src/Vapp.cpp +++ b/view/src/Vapp.cpp @@ -11,7 +11,7 @@ const char select_user_id[] = "SELECT USER_ID FROM user_table GROUP BY USER_ID;" constexpr int sizeOfCanvas = 1000; -void Vapp::init() +void Vapp::init(char* filename) { bigTexture = LoadRenderTexture(sizeOfCanvas * 4, sizeOfCanvas * 4); treeTexture = LoadRenderTexture(sizeOfCanvas, sizeOfCanvas); @@ -20,7 +20,7 @@ void Vapp::init() DnaManager::setUp(&manager, 0); sql::init(); - sql::open(DB_NAME, &db); + sql::open(filename, &db); sqlite3_stmt *stmt; sql::prepare_v2(db, select_user_id, -1, &stmt, NULL); diff --git a/view/src/main.cpp b/view/src/main.cpp index 52c57d3..54dedd8 100644 --- a/view/src/main.cpp +++ b/view/src/main.cpp @@ -2,18 +2,24 @@ #include #include #include "Vapp.hpp" +#include int main(int argc, char *argv[]) { int screenWidth = 1000; int screenHeight = 1000; + if(argc != 2){ + printf("MISING DB FILE\n"); + return 0; + } + Vapp app; SetConfigFlags(FLAG_WINDOW_RESIZABLE); InitWindow(screenWidth, screenHeight, "VIEW"); SetTargetFPS(60); rlImGuiSetup(true); - app.init(); + app.init(argv[1]); ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable; while (!WindowShouldClose())