-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (32 loc) · 1.06 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
#include "imgui/imgui.h"
#include "views/ViewObjectsConfig.hpp"
#include "views/ViewStats.hpp"
#include "views/draw_view/drawView.hpp"
#include "views/main/MainView.hpp"
#define SUB_STEP 8.0f
int main() {
// this is mac versioning add other versions
const char *glsl_version = "#version 150";
ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.00f);
uint32_t width = 1280;
uint32_t height = 720;
auto main_view = MainView(glsl_version, clear_color, width, height);
main_view.createWindow();
auto stats_modal = ViewStats();
auto object_config_modal = ViewObjectsConfig();
auto draw_view = DrawView();
auto& io = ImGui::GetIO();
const float fps_cap = 60.0f;
while (main_view.getIsRunning()) {
main_view.processEvent();
// Start the Dear ImGui frame
main_view.newFrame();
stats_modal.render();
object_config_modal.render();
const double frame_rate = io.Framerate >= fps_cap ? fps_cap : io.Framerate;
float dt = 1 / (frame_rate * SUB_STEP);
draw_view.render(dt);
main_view.render();
}
main_view.quitView();
}