aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-13 00:49:14 +0100
committerubq323 <ubq323@ubq323.website>2024-04-13 00:49:14 +0100
commitbf03e2a0d86a4b5202a72aa66da5dc0e2c0b412b (patch)
treeda47f07c9f3c7946044153f21b7d4bcf991ea1bf /client
parent0eeff114b44ccdd6bc430bc5f9583e2a3eea9823 (diff)
multiple packet types. code quality is declining steadily
Diffstat (limited to 'client')
-rw-r--r--client/main.ha13
1 files changed, 9 insertions, 4 deletions
diff --git a/client/main.ha b/client/main.ha
index fa63004..242a101 100644
--- a/client/main.ha
+++ b/client/main.ha
@@ -87,16 +87,21 @@ export fn main() void = {
case void => yield;
case let op: drawing::op =>
drawing::perform(pictures, op);
- drawing::send_op(conn, op)!;
+ packet_reader::send(conn, op: packet_reader::packet_drawop)!;
};
const n = poll::poll(pollfd, poll::NONBLOCK)!;
if (n > 0) {
fmt::println("data available")!;
packet_reader::read(&packet_reader, conn)!;
- for (const packet_bytes => packet_reader::next(&packet_reader)) {
- const op = drawing::deser_op(packet_bytes);
- drawing::perform(pictures, op);
+ for (const packet => packet_reader::next(&packet_reader)!) {
+ match (packet) {
+ case let op: packet_reader::packet_drawop =>
+ const opc = op as drawing::op_circle;
+ drawing::perform(pictures, opc);
+ case =>
+ abort("other packet not supported yet");
+ };
};
};