blob: 9627cb5f6085d5143968204c02130d4be586df33 (
plain)
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
|
#include <stdio.h>
#include "state.h"
#include "wayland.h"
#include "graphics.h"
int main() {
client_state state = {0};
state.running = true;
state.display = wl_display_connect(NULL);
if (!state.display) {
fprintf(stderr, "Failed to Connect to wayland display\n");
return 0;
}
// set up globals
setup_registry_and_globals(&state);
wl_display_roundtrip(state.display);
// create non global objects
create_surface(&state);
// roundtrip to recieve the rest of the events
wl_display_roundtrip(state.display);
// set up graphics
if (!init_gl(&state)) {
fprintf(stderr, "Failed to Initalize EGL/OpenGL\n");
return 1;
}
// event loop
while (state.running) {
wl_display_dispatch_pending(state.display);
render_frame(&state);
}
}
|