comparison src/server.rs @ 15:d103f7cca0bd

Update to GTKĀ 4.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 26 Aug 2021 19:34:40 +0200
parents adab13145994
children 478cf2a7d577
comparison
equal deleted inserted replaced
14:adab13145994 15:d103f7cca0bd
90 println!("Listening on {:?}", socket); 90 println!("Listening on {:?}", socket);
91 println!("Here is an example client: https://hg.linkmauve.fr/remote-gamepad"); 91 println!("Here is an example client: https://hg.linkmauve.fr/remote-gamepad");
92 92
93 let mut event: Event = Default::default(); 93 let mut event: Event = Default::default();
94 let mut last = Some((0., 0.)); 94 let mut last = Some((0., 0.));
95 state.set_size((320, 240)); 95 state.set_size(320, 240);
96 loop { 96 loop {
97 // TODO: Yolo-alignment. 97 // TODO: Yolo-alignment.
98 let buf: &mut [u8; 16] = unsafe { std::mem::transmute(&mut event) }; 98 let buf: &mut [u8; 16] = unsafe { std::mem::transmute(&mut event) };
99 let (amount, source) = socket.recv_from(buf)?; 99 let (amount, source) = socket.recv_from(buf)?;
100 if amount != std::mem::size_of::<Event>() { 100 if amount != std::mem::size_of::<Event>() {