Skip to content

Commit

Permalink
add steamworks
Browse files Browse the repository at this point in the history
  • Loading branch information
trevyn committed Aug 8, 2024
1 parent 4c4adb4 commit fbd689d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
android/
.vscode/
addons/
Cargo.lock
Cargo.lock
steam_appid.txt
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ path-clean = "1.0.1"
pollster = "0.3"
puffin = "0.19.1"
puffin_egui = "0.29"
steamworks = {git = "https://github.com/trevyn/steamworks-rs", branch = "master"}
wgpu = {version = "22.1.0", default-features = false, features = ["metal", "naga-ir"]}
winit = "0.30"
# rapier2d = {version = "0.22.0", features = ["default", "debug-render"]}
Expand Down
30 changes: 30 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,35 @@ fn config() -> GlassConfig {
fn main() -> Result<(), GlassError> {
eprintln!("Hello world!");

match steamworks::Client::init() {
Ok(client) => {
let _cb = client.register_callback(|p: steamworks::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(steamworks::AppId(480))
);
println!(
"InstallDir(480): {}",
apps.app_install_dir(steamworks::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());
}

Err(e) => println!("Steam client error: {}", e),
}

Glass::run(config(), |context| Box::new(FluidSimApp::new(context)))
}

0 comments on commit fbd689d

Please sign in to comment.