#steamworks

sys steamworks-sys

Provides raw bindings to the steamworks sdk

16 releases (10 breaking)

0.11.0 Feb 7, 2024
0.10.0 Mar 25, 2023
0.9.0 Apr 22, 2022
0.8.0 Nov 23, 2021
0.2.1 Mar 1, 2018

#309 in Game dev

Download history 333/week @ 2023-11-06 264/week @ 2023-11-13 716/week @ 2023-11-20 318/week @ 2023-11-27 356/week @ 2023-12-04 305/week @ 2023-12-11 269/week @ 2023-12-18 289/week @ 2023-12-25 162/week @ 2024-01-01 219/week @ 2024-01-08 248/week @ 2024-01-15 360/week @ 2024-01-22 235/week @ 2024-01-29 333/week @ 2024-02-05 385/week @ 2024-02-12 652/week @ 2024-02-19

1,607 downloads per month
Used in 7 crates (via steamworks)

MIT/Apache

13MB
88K SLoC

Contains (ELF lib, 1.5MB) libsdkencryptedappticket.so, (ELF lib, 1.5MB) libsdkencryptedappticket.so, (Windows DLL, 1MB) sdkencryptedappticket.dll, (Windows DLL, 1MB) sdkencryptedappticket64.dll, (ELF lib, 380KB) libsteam_api.so, (ELF lib, 395KB) libsteam_api.so and 6 more.

steamworks

crates.io Documentation License

This crate provides Rust bindings to the Steamworks SDK.

Usage

Add the following to your Cargo.toml:

[dependencies]
steamworks = "0.11.0"
Crate SDK MSRV
git 1.58a 1.71.1
0.11.0 1.58a 1.71.1
0.10.0 1.54 1.56.1
0.9.0 1.53a 1.56.1

Example

You can find more examples in examples.

use steamworks::AppId;
use steamworks::Client;
use steamworks::FriendFlags;
use steamworks::PersonaStateChange;

fn main() {
    let (client, single) = Client::init().unwrap();

    let _cb = client.register_callback(|p: PersonaStateChange| {
        println!("Got callback: {:?}", p);
    });

    let utils = client.utils();
    println!("Utils:");
    println!("AppId: {:?}", utils.app_id());
    println!("UI Language: {}", utils.ui_language());

    let apps = client.apps();
    println!("Apps");
    println!("IsInstalled(480): {}", apps.is_app_installed(AppId(480)));
    println!("InstallDir(480): {}", apps.app_install_dir(AppId(480)));
    println!("BuildId: {}", apps.app_build_id());
    println!("AppOwner: {:?}", apps.app_owner());
    println!("Langs: {:?}", apps.available_game_languages());
    println!("Lang: {}", apps.current_game_language());
    println!("Beta: {:?}", apps.current_beta_name());

    let friends = client.friends();
    println!("Friends");
    let list = friends.get_friends(FriendFlags::IMMEDIATE);
    println!("{:?}", list);
    for f in &list {
        println!("Friend: {:?} - {}({:?})", f.id(), f.name(), f.state());
        friends.request_user_information(f.id(), true);
    }

    for _ in 0..50 {
        single.run_callbacks();
        ::std::thread::sleep(::std::time::Duration::from_millis(100));
    }
}

Features

serde: This feature enables serialization and deserialization of some types with serde.

License

This crate is dual-licensed under Apache and MIT.

Help, I can't run my game!

If you are seeing errors like STATUS_DLL_NOT_FOUND, Image not found etc. You are likely missing the Steamworks SDK Redistributable files. Steamworks-rs loads the SDK dynamically, so the libraries need to exist somewhere the operating system can find them. This is likely next to your game binary (.exe on windows). You can find the required files in the SDK release ZIP, under lib\steam\redistributable_bin. See #63 for further details

No runtime deps