aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: a6e261d110b9bea37154632f460d702e6eabe92b (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
#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;
	}

	// bind globals and roundtrip
	setup_registry_and_globals(&state);
	wl_display_roundtrip(state.display);

	// set up other objects and roundtrip
	setup_seat(&state);
	create_surface(&state);
	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);
	}
}