Quick Start
Get Suduxu running in minutes and connect your first device.
This guide walks through starting a Suduxu server, connecting a device, and verifying input flow.
1. Install the native runtime
Place the latest Suduxu library files into your project:
DLL/suduxu.dll
DLL/suduxu.so
DLL/suduxu.dylibAlso ensure a suduxu.json configuration file exists in the same folder, optionally if enabled add a Files directory with custom files (if enabled in the suduxu.json). So your folder structure should look like this:
2. Choose an SDK
Suduxu currently provides official integrations for Rust and Unity.
Repository
- GitHub: https://github.com/Suduxu/Suduxu-Rust
- Crates.io: https://crates.io/crates/suduxu_rust
Add the crate to your project:
[dependencies]
suduxu-rust = "latest"Repository
Install through the Unity Package Manager:
https://github.com/Suduxu/Suduxu-Unity.git?path=/Playground/Assets/SuduxuThen add the Suduxu Component prefab to your scene.
3. Initialize Suduxu
Initialization differs depending on the environment.
Engine Integrations
Unity and other engine-based integrations automatically initialize the native runtime. When using Suduxu through a programming language SDK such as Rust, initialization must be performed manually.
Initialize Suduxu before using any API methods:
init_suduxu(
SuduxuBehaviourConfiguration::broadcast("DLL/suduxu")
)?;After initialization, launch the runtime:
launch_suduxu()?;See Reference/Data-Models for details on the
SuduxuBehaviourConfigurationdata model.
The Unity SDK automatically loads the native runtime through the Suduxu Component prefab.
Start the server by calling:
Suduxu.Instance.Launch();4. Wait for Configuration Loading
After startup, Suduxu loads configuration and address information asynchronously.
Important
Do not immediately access configuration, password, QR code, or address information directly after launch.
Allow the runtime a short amount of time to finish initialization before reading:
- Configuration
- Password
- Network addresses
- QR code information
5. Connect a Device
Open the Suduxu mobile app and scan the QR code generated by the server or enter the IP address and port manually.
Alternatively, generate a QR code using the CLI:
suduxu server codeOnce connected, the device will appear in the client list.
6. Receive Input
ON_CLIENT_CONNECTED.subscribe(|id| {
println!("Connected: {}", id);
});
ON_BUTTON_INPUT.subscribe(|(id, input)| {
println!("Input from {}: {:?}", id, input);
});Suduxu.Instance.Server.OnClientConnected += id =>
{
Debug.Log($"Connected: {id}");
};
Suduxu.Instance.Input.OnButtonInput += (id, input) =>
{
Debug.Log($"Input from {id}: {input}");
};7. Send Feedback
for_client(id).vibrate(
500,
VibrationStrength::Medium,
VibrationType::Custom
);
for_client(id).log(
LogLevel::Info,
"Hello from Suduxu",
None
);See Reference/Data-Models for details on the
VibrationStrength,VibrationTypeandLogLevel
Suduxu.Instance.Client
.For(id)
.Vibrate(
500,
VibrationStrength.Medium,
VibrationType.Custom
);
Suduxu.Instance.Client
.For(id)
.Log(
LogLevel.Info,
"Hello from Suduxu"
);See Reference/Data-Models for details on the
VibrationStrength,VibrationTypeandLogLevel
What's Next?
Now that your first device is connected, you can:
Setup
Learn about configuration, native libraries, and deployment.
API
Explore the complete Rust and Unity APIs.
Web Themes
Build custom controller and companion screen interfaces.