diff options
Diffstat (limited to 'source/loo')
| -rw-r--r-- | source/loo/loo.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/loo/loo.cpp b/source/loo/loo.cpp new file mode 100644 index 0000000..e2de702 --- /dev/null +++ b/source/loo/loo.cpp | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #include "base/base_include.h" | ||
| 2 | |||
| 3 | ENTRYPOINT() | ||
| 4 | { | ||
| 5 | MemArena *arena = ArenaCreate(MiB(100)); | ||
| 6 | Assert(arena); | ||
| 7 | |||
| 8 | int fd = wayland_display_connect(arena); | ||
| 9 | |||
| 10 | state_t state = {0}; | ||
| 11 | state.wl_registry = wayland_wl_display_get_registry(fd), | ||
| 12 | state.w = 117, | ||
| 13 | state.h = 150, | ||
| 14 | state.stride = 117 * color_channels, | ||
| 15 | state.shm_pool_size = state.h * state.stride; | ||
| 16 | |||
| 17 | |||
| 18 | while (1) { | ||
| 19 | char read_buf[4096] = ""; | ||
| 20 | int64_t read_bytes = recv(fd, read_buf, sizeof(read_buf), 0); | ||
| 21 | if (read_bytes == -1) | ||
| 22 | exit(errno); | ||
| 23 | |||
| 24 | char *msg = read_buf; | ||
| 25 | uint64_t msg_len = (uint64_t)read_bytes; | ||
| 26 | |||
| 27 | while (msg_len > 0) | ||
| 28 | wayland_handle_message(fd, &state, &msg, &msg_len); | ||
| 29 | } | ||
| 30 | |||
| 31 | return 0; | ||
| 32 | |||
| 33 | |||
| 34 | } | ||
