feat: add game loop

sending and receiving moves from server, client

implementation of this in a simple cli
This commit is contained in:
2026-08-17 23:23:45 +02:00
parent bb2599a3ca
commit e2a37d8a91
2 changed files with 146 additions and 14 deletions

View File

@@ -237,6 +237,24 @@ impl Client {
});
}
pub async fn send_capture(&mut self, capture: CapturePath) {
debug!("Requesting sending capture: {:?}", capture);
if let Some(sender) = &self.commands_sender {
let _ = sender.send(ClientCommands::SendCapture(capture)).await;
} else {
error!("Command sender not set!");
}
}
pub async fn send_move(&mut self, from: Position, to: Position) {
debug!("Requested sending move from: {} to: {}", from, to);
if let Some(sender) = &self.commands_sender {
let _ = sender.send(ClientCommands::SendMove { from, to }).await;
} else {
error!("Command sender not set!");
}
}
pub async fn send_text_message(&mut self, content: String) {
if let Some(sender) = &self.commands_sender {
let _ = sender.send(ClientCommands::SendText(content)).await;