This commit is contained in:
Crispy 2023-04-02 16:59:07 +02:00
parent 6aef8f92d7
commit 3f1670809c

View file

@ -6,7 +6,7 @@
#include "openvr/openvr.h" #include "openvr/openvr.h"
static vr::ETrackingUniverseOrigin TRACKING_UNIVERSE = vr::ETrackingUniverseOrigin::TrackingUniverseStanding; auto TRACKING_UNIVERSE = vr::ETrackingUniverseOrigin::TrackingUniverseStanding;
#define FRAMERATE 30 #define FRAMERATE 30
@ -81,15 +81,6 @@ void init_overlay()
assert(err == 0); assert(err == 0);
} }
void cleanup()
{
printf("\nShutting down\n");
vr::VR_Shutdown();
glfwDestroyWindow(gl_window);
glfwTerminate();
exit(0);
}
void render_desktop() void render_desktop()
{ {
auto frame = XGetImage(xdisplay, root_window, 0, 0, width, height, AllPlanes, ZPixmap); auto frame = XGetImage(xdisplay, root_window, 0, 0, width, height, AllPlanes, ZPixmap);
@ -127,13 +118,13 @@ void interrupted(int _sig)
int main() int main()
{ {
signal(SIGINT, interrupted);
init_x11(); init_x11();
init_glfw(); init_glfw();
init_vr(); init_vr();
init_overlay(); init_overlay();
signal(SIGINT, interrupted);
while (!should_exit) while (!should_exit)
{ {
render_desktop(); render_desktop();
@ -142,6 +133,10 @@ int main()
glfwSwapBuffers(gl_window); glfwSwapBuffers(gl_window);
usleep(1000000 / FRAMERATE); usleep(1000000 / FRAMERATE);
} }
cleanup();
printf("\nShutting down\n");
vr::VR_Shutdown();
glfwDestroyWindow(gl_window);
glfwTerminate();
return 0; return 0;
} }