diff options
| author | adumbidiot <[email protected]> | 2020-09-26 17:38:14 -0700 |
|---|---|---|
| committer | adumbidiot <[email protected]> | 2020-09-26 17:38:14 -0700 |
| commit | 4b75ac0339e6944d73e36d82fb1251eff21691f9 (patch) | |
| tree | 8cc50eb89ed228d9e566787c68fe8915def445b2 | |
| parent | Merge pull request #24 from adumbidiot/remove-failure (diff) | |
| download | steamworks-rs-4b75ac0339e6944d73e36d82fb1251eff21691f9.tar.xz steamworks-rs-4b75ac0339e6944d73e36d82fb1251eff21691f9.zip | |
Create README.md
| -rw-r--r-- | README.md | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..107c809 --- /dev/null +++ b/README.md @@ -0,0 +1,70 @@ +# steamworks +[](https://crates.io/crates/steamworks) +[](https://docs.rs/steamworks) + + +This crate provides rust friendly bindings to the [steamworks sdk](https://partner.steamgames.com/doc/sdk). + + +## Usage +Add the following to your `Cargo.toml`: + +```toml +[dependencies] +steamworks = "0.6.1" +``` + +Ensure that your computer has all the needed [requirements](https://rust-lang.github.io/rust-bindgen/requirements.html) to use [bindgen](https://github.com/rust-lang/rust-bindgen). + +Download and install the [steamworks sdk](https://partner.steamgames.com/doc/sdk) and set the environment variable `STEAM_SDK_LOCATION` to point to it. + +## Example +```rust +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](./LICENSE-APACHE) and [MIT](./LICENSE-MIT).
\ No newline at end of file |