2019-07-21 14:45:50 +00:00
|
|
|
// Copyright 2019, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief Main entrypoint for the Monado GUI program.
|
|
|
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
|
|
|
* @ingroup gui
|
|
|
|
*/
|
|
|
|
|
2019-09-02 12:20:09 +00:00
|
|
|
#include "util/u_var.h"
|
2019-07-21 14:45:50 +00:00
|
|
|
#include "gui_common.h"
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
struct program p = {0};
|
|
|
|
int ret;
|
|
|
|
|
2019-09-02 12:20:09 +00:00
|
|
|
// Need to do this as early as possible.
|
|
|
|
u_var_force_on();
|
|
|
|
|
2019-07-21 14:45:50 +00:00
|
|
|
ret = gui_sdl2_init(&p);
|
|
|
|
if (ret != 0) {
|
|
|
|
gui_sdl2_quit(&p);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-09-02 12:20:09 +00:00
|
|
|
// To manage the scenes.
|
|
|
|
gui_scene_manager_init(&p);
|
|
|
|
|
|
|
|
// Start all of the devices.
|
|
|
|
gui_prober_init(&p);
|
|
|
|
|
|
|
|
// First scene to start with.
|
|
|
|
gui_scene_select_video(&p);
|
|
|
|
|
|
|
|
// Main loop.
|
|
|
|
gui_imgui_loop(&p);
|
|
|
|
|
|
|
|
// Clean up after us.
|
|
|
|
gui_prober_teardown(&p);
|
|
|
|
|
|
|
|
// All scenes should be destroyed by now.
|
|
|
|
gui_scene_manager_destroy(&p);
|
2019-07-21 14:45:50 +00:00
|
|
|
|
2019-09-02 12:20:09 +00:00
|
|
|
// Final close.
|
2019-07-21 14:45:50 +00:00
|
|
|
gui_sdl2_quit(&p);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|