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
|
||||
view/src/main.cpp
|
||||
|
||||
view/src/Vapp.cpp
|
||||
shared/src/canvas/BackGround.cpp
|
||||
shared/src/canvas/BackGroundColors.cpp
|
||||
shared/src/canvas/Canvas.cpp
|
||||
|
@ -111,10 +111,6 @@ void checker()
|
||||
if (type != SQL_NULL)
|
||||
{
|
||||
user_table_id = sql::column_int64(get_user_table_id_stmt, 0);
|
||||
}
|
||||
}
|
||||
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);
|
||||
@ -123,6 +119,9 @@ void checker()
|
||||
sql::step(rem_user_table_id_stmt);
|
||||
sql::reset(rem_user_table_id_stmt);
|
||||
}
|
||||
}
|
||||
sql::reset(get_user_table_id_stmt);
|
||||
}
|
||||
|
||||
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_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 = ?;";
|
||||
|
||||
|
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,50 +1,33 @@
|
||||
|
||||
#include <raylib.h>
|
||||
#include <imgui.h>
|
||||
#include <rlImGui.h>
|
||||
#include "Vapp.hpp"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 800;
|
||||
|
||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
||||
Vapp app;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "VIEW");
|
||||
SetTargetFPS(60);
|
||||
rlImGuiSetup(true);
|
||||
|
||||
app.init();
|
||||
bool showDemoWindow = true;
|
||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
app.update();
|
||||
BeginDrawing();
|
||||
rlImGuiBegin();
|
||||
|
||||
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);
|
||||
|
||||
app.draw();
|
||||
|
||||
rlImGuiEnd();
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
app.deinit();
|
||||
rlImGuiShutdown();
|
||||
CloseWindow();
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user