Monado OpenXR Runtime
gui_sdl2.h
Go to the documentation of this file.
1 // Copyright 2019, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief Common file for the Monado SDL2 based GUI program.
6  * @author Jakob Bornecrantz <jakob@collabora.com>
7  * @ingroup gui
8  */
9 
10 #pragma once
11 
12 #include "gui/gui_common.h"
13 #include <SDL2/SDL.h>
14 
15 /*!
16  * @defgroup gui GUI Config Interface
17  * @ingroup xrt
18  *
19  * @brief Small GUI interface to configure Monado based on SDL2.
20  */
21 
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 
28 /*!
29  * Common struct holding state for the GUI interface.
30  *
31  * @ingroup gui
32  */
34 {
35  struct gui_program base;
36 
38  SDL_Window *win;
39  SDL_GLContext ctx;
40 };
41 
42 
43 /*!
44  * Init SDL2, create and show a window and bring up any other structs needed.
45  *
46  * @ingroup gui
47  */
48 int
49 gui_sdl2_init(struct sdl2_program *p);
50 
51 /*!
52  * Loop until user request quit and show Imgui interface.
53  *
54  * @ingroup gui
55  */
56 void
58 
59 /*!
60  * Loop until quit signal has been received.
61  *
62  * @ingroup gui
63  */
64 void
65 gui_sdl2_loop(struct sdl2_program *p);
66 
67 /*!
68  * Destroy all SDL things and quit SDL.
69  *
70  * @ingroup gui
71  */
72 void
73 gui_sdl2_quit(struct sdl2_program *p);
74 
75 
76 #ifdef __cplusplus
77 }
78 #endif
SDL_GLContext ctx
Definition: gui_sdl2.h:39
void gui_sdl2_quit(struct sdl2_program *p)
Destroy all SDL things and quit SDL.
Definition: gui_sdl2.c:114
void gui_sdl2_loop(struct sdl2_program *p)
Loop until quit signal has been received.
Definition: gui_sdl2.c:37
SDL_Window * win
Definition: gui_sdl2.h:38
Common file for the Monado GUI program.
A gui program.
Definition: gui_common.h:43
struct gui_program base
Definition: gui_sdl2.h:35
Common struct holding state for the GUI interface.
Definition: gui_sdl2.h:33
int gui_sdl2_init(struct sdl2_program *p)
Init SDL2, create and show a window and bring up any other structs needed.
Definition: gui_sdl2.c:56
void gui_sdl2_imgui_loop(struct sdl2_program *p)
Loop until user request quit and show Imgui interface.
Definition: gui_sdl2_imgui.c:47
bool sdl_initialized
Definition: gui_sdl2.h:37