-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
64 lines (49 loc) · 1.49 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <nlohmann/json.hpp>
#define JSON_TYPE nlohmann::json
#include "gui_elements.h"
#ifndef DEBUG
#pragma comment(linker, "/SUBSYSTEM:Windows /ENTRY:mainCRTStartup")
#endif
advatek_manager adv;
int main(int, char**)
{
GLFWwindow* window;
setupWindow(window);
// Init Advatek Manager
applog.Clear();
adv.refreshAdaptors();
if (adv.networkAdaptors.size() > 0) {
adaptor_string = adv.networkAdaptors[0];
adv.poll();
applog.AddLog(("[INFO] Polling using network adaptor " + adaptor_string + "...\n").c_str());
s_loopVar.lastPoll = s_loopVar.currTime;
}
// Main loop
while (!glfwWindowShouldClose(window))
{
glfwPollEvents();
adv.listen();
glfwGetWindowSize(window, &s_loopVar.window_w, &s_loopVar.window_h);
// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
s_loopVar.currTime = ImGui::GetTime();
if (s_loopVar.currTime - s_loopVar.lastPoll > s_loopVar.rePollTime) {
adv.softPoll();
s_loopVar.lastPoll = s_loopVar.currTime;
//applog.AddLog(("[INFO] Polling using network adapter " + adaptor_string + "...\n").c_str());
}
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::SetNextWindowSize(ImVec2(s_loopVar.window_w, s_loopVar.window_h));
showWindow(window);
processUpdateRequests();
}
// Cleanup
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}