Mercurial > tablet-emu
diff src/server.rs @ 17:0bce7fe96937
Add a client, copy of the GTK interface.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 26 Aug 2021 22:00:55 +0200 |
parents | 478cf2a7d577 |
children |
line wrap: on
line diff
--- a/src/server.rs +++ b/src/server.rs @@ -23,7 +23,7 @@ use std::net::UdpSocket; bitflags! { /// This is the memory layout of the buttons on the 3DS. #[derive(Default)] - struct Buttons: u32 { + pub struct Buttons: u32 { const A = 0x00000001; const B = 0x00000002; const SELECT = 0x00000004; @@ -40,7 +40,7 @@ bitflags! { // Nothing const ZL = 0x00004000; const ZR = 0x00008000; - // Nothing + const RESIZE = 0x00010000; // Not an actual 3DS button! // Nothing // Nothing // Nothing @@ -60,11 +60,11 @@ bitflags! { } #[derive(Debug, Default)] -struct Event { - buttons: Buttons, +pub struct Event { + pub buttons: Buttons, pad: (i16, i16), c_pad: (i16, i16), - touch: (u16, u16), + pub touch: (u16, u16), } pub fn run_server(address: &str) -> io::Result<()> { @@ -112,6 +112,9 @@ pub fn run_server(address: &str) -> io:: state.select_tool(Key::ButtonToolPencil); } else if event.buttons.contains(Buttons::SELECT) { state.select_tool(Key::ButtonToolAirbrush); + } else if event.buttons.contains(Buttons::RESIZE) { + println!("set_size({}, {})", event.touch.0 as i32, event.touch.1 as i32); + state.set_size(event.touch.0 as i32, event.touch.1 as i32); } let (x, y) = event.touch; if event.buttons.contains(Buttons::TOUCH) {