tuio-rs

Crates.iotuio-rs
lib.rstuio-rs
version0.2.0
sourcesrc
created_at2023-02-14 13:23:33.749237
updated_at2023-02-15 14:42:38.46725
descriptionA TUIO 1.1 implementation in Rust
homepagehttps://github.com/LTBL-Studio/tuio-rs
repositoryhttps://github.com/LTBL-Studio/tuio-rs
max_upload_size
id784872
size87,208
(climoge)

documentation

README

tuio-rs

A Rust implementation of the TUIO 1.1 protocol based on rosc

Getting Started

Examples

A simple receiver loop

cargo run --example receive

A server and client communicating together

cargo run --example send_and_receive

Create and send TUIO inputs manually

cargo run --example manual_send

Create and send TUIO inputs through Server

use tuio_rs::{Server};

let mut server = Server::new("server_name").unwrap();

// All TUIO inputs manipulation must be made between [Server::init_frame()] and [Server::commit_frame()]
server.init_frame(); 
    let cursor_id = server.create_cursor(0., 0.);
    let object_id = server.create_object(1, 0., 0., 0.);
    let blob_id = server.create_blob(0., 0., 0., 0.1, 0.1, 0.01);
server.commit_frame();

server.init_frame();
    server.update_cursor(cursor_id, 1., 1.);
    server.update_object(object_id, 1., 1., 90f32.to_radians());
    server.update_blob(blob_id, 1., 1., 90f32.to_radians(), 0.2, 0.2, 0.04);
server.commit_frame();

server.init_frame();
    server.remove_cursor(cursor_id);
    server.remove_object(object_id);
    server.remove_blob(blob_id);
server.commit_frame();

Receive TUIO inputs through Client

use tuio_rs::{Client};

let client = Client::new().unwrap();
client.connect().expect("Client connecting");

loop {
    if let Ok(Some(events)) = client.refresh() {
        // Process events. See receiver example for a process function
    }
}
Commit count: 46

cargo fmt