Compare commits
3 Commits
8619918fac
...
207e930b1c
Author | SHA1 | Date | |
---|---|---|---|
207e930b1c | |||
1cf439ef03 | |||
3651d07750 |
@ -51,7 +51,7 @@ target_include_directories(server PRIVATE server/inc shared/inc)
|
|||||||
|
|
||||||
add_executable(view
|
add_executable(view
|
||||||
view/src/main.cpp
|
view/src/main.cpp
|
||||||
|
view/src/Vapp.cpp
|
||||||
shared/src/canvas/BackGround.cpp
|
shared/src/canvas/BackGround.cpp
|
||||||
shared/src/canvas/BackGroundColors.cpp
|
shared/src/canvas/BackGroundColors.cpp
|
||||||
shared/src/canvas/Canvas.cpp
|
shared/src/canvas/Canvas.cpp
|
||||||
|
@ -111,17 +111,16 @@ void checker()
|
|||||||
if (type != SQL_NULL)
|
if (type != SQL_NULL)
|
||||||
{
|
{
|
||||||
user_table_id = sql::column_int64(get_user_table_id_stmt, 0);
|
user_table_id = sql::column_int64(get_user_table_id_stmt, 0);
|
||||||
|
sql::bind_int64(rem_like_w_user_table_id_stmt, 1, user_table_id);
|
||||||
|
sql::step(rem_like_w_user_table_id_stmt);
|
||||||
|
sql::reset(rem_like_w_user_table_id_stmt);
|
||||||
|
|
||||||
|
sql::bind_int64(rem_user_table_id_stmt, 1, user_table_id);
|
||||||
|
sql::step(rem_user_table_id_stmt);
|
||||||
|
sql::reset(rem_user_table_id_stmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sql::reset(get_user_table_id_stmt);
|
sql::reset(get_user_table_id_stmt);
|
||||||
|
|
||||||
sql::bind_int64(rem_like_w_user_table_id_stmt, 1, user_table_id);
|
|
||||||
sql::step(rem_like_w_user_table_id_stmt);
|
|
||||||
sql::reset(rem_like_w_user_table_id_stmt);
|
|
||||||
|
|
||||||
sql::bind_int64(rem_user_table_id_stmt, 1, user_table_id);
|
|
||||||
sql::step(rem_user_table_id_stmt);
|
|
||||||
sql::reset(rem_user_table_id_stmt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_gen)
|
if (new_gen)
|
||||||
|
@ -14,7 +14,7 @@ const char get_unchecked[] = "SELECT USER_ID FROM user_table WHERE CHECKED = 0;"
|
|||||||
|
|
||||||
const char get_gen[] = "SELECT lt.HASH, lt.POS, lt.LIKED FROM like_table lt JOIN user_table ut ON lt.USER_TABLE_ID = ut.ID WHERE ut.USER_ID = ? AND ut.GEN = ? ORDER BY lt.POS ASC;";
|
const char get_gen[] = "SELECT lt.HASH, lt.POS, lt.LIKED FROM like_table lt JOIN user_table ut ON lt.USER_TABLE_ID = ut.ID WHERE ut.USER_ID = ? AND ut.GEN = ? ORDER BY lt.POS ASC;";
|
||||||
|
|
||||||
const char get_user_table_id[] = "SELECT ID FROM user_table WHERE USER_ID = ? AND GEN = ?;";
|
const char get_user_table_id[] = "SELECT ID FROM user_table WHERE USER_ID = ? AND GEN >= ?;";
|
||||||
|
|
||||||
const char rem_like_w_user_table_id[] = "DELETE FROM like_table WHERE USER_TABLE_ID = ?;";
|
const char rem_like_w_user_table_id[] = "DELETE FROM like_table WHERE USER_TABLE_ID = ?;";
|
||||||
|
|
||||||
|
15
view/inc/Vapp.hpp
Normal file
15
view/inc/Vapp.hpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
#include "sql.hpp"
|
||||||
|
|
||||||
|
class Vapp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void init();
|
||||||
|
void update();
|
||||||
|
void draw();
|
||||||
|
void deinit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool showDemoWindow;
|
||||||
|
sqlite3 *db;
|
||||||
|
};
|
45
view/src/Vapp.cpp
Normal file
45
view/src/Vapp.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
|
#include "Vapp.hpp"
|
||||||
|
#include "values/Dna.hpp"
|
||||||
|
|
||||||
|
#include <rlImGui.h>
|
||||||
|
#include <imgui.h>
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
|
void Vapp::init()
|
||||||
|
{
|
||||||
|
sql::init();
|
||||||
|
sql::open(DB_NAME, &db);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vapp::update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vapp::draw()
|
||||||
|
{
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode);
|
||||||
|
|
||||||
|
if (ImGui::BeginMainMenuBar())
|
||||||
|
{
|
||||||
|
if (ImGui::BeginMenu("Window"))
|
||||||
|
{
|
||||||
|
if (ImGui::MenuItem("Demo Window", nullptr, showDemoWindow))
|
||||||
|
showDemoWindow = !showDemoWindow;
|
||||||
|
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::EndMainMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showDemoWindow)
|
||||||
|
ImGui::ShowDemoWindow(&showDemoWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vapp::deinit()
|
||||||
|
{
|
||||||
|
sql::close(db);
|
||||||
|
}
|
@ -1,51 +1,34 @@
|
|||||||
|
|
||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <rlImGui.h>
|
#include <rlImGui.h>
|
||||||
|
#include "Vapp.hpp"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 800;
|
int screenHeight = 800;
|
||||||
|
|
||||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
Vapp app;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "VIEW");
|
InitWindow(screenWidth, screenHeight, "VIEW");
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
rlImGuiSetup(true);
|
rlImGuiSetup(true);
|
||||||
|
app.init();
|
||||||
bool showDemoWindow = true;
|
bool showDemoWindow = true;
|
||||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
|
|
||||||
while (!WindowShouldClose())
|
while (!WindowShouldClose())
|
||||||
{
|
{
|
||||||
|
app.update();
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
rlImGuiBegin();
|
rlImGuiBegin();
|
||||||
|
app.draw();
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode);
|
|
||||||
|
|
||||||
if (ImGui::BeginMainMenuBar())
|
|
||||||
{
|
|
||||||
if (ImGui::BeginMenu("Window"))
|
|
||||||
{
|
|
||||||
if (ImGui::MenuItem("Demo Window", nullptr, showDemoWindow))
|
|
||||||
showDemoWindow = !showDemoWindow;
|
|
||||||
|
|
||||||
ImGui::EndMenu();
|
|
||||||
}
|
|
||||||
ImGui::EndMainMenuBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showDemoWindow)
|
|
||||||
ImGui::ShowDemoWindow(&showDemoWindow);
|
|
||||||
|
|
||||||
|
|
||||||
rlImGuiEnd();
|
rlImGuiEnd();
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
app.deinit();
|
||||||
rlImGuiShutdown();
|
rlImGuiShutdown();
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user