Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Noxime committed Sep 15, 2024
1 parent cfc3bf6 commit b1a4472
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
args: --all
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0"
4 changes: 2 additions & 2 deletions examples/chat-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn window_conf() -> Conf {

#[macroquad::main(window_conf)]
async fn main() {
let (client, single) = Client::init().unwrap();
let client = Client::init().unwrap();

let matchmaking = client.matchmaking();
let networking = client.networking();
Expand All @@ -65,7 +65,7 @@ async fn main() {
let mut messages: Vec<String> = vec![];

loop {
single.run_callbacks();
client.run_callbacks();
clear_background(BLACK);

let local_sender_create_lobby = sender_create_lobby.clone();
Expand Down
4 changes: 2 additions & 2 deletions examples/lobby/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::mpsc;
use steamworks::*;

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

let matchmaking = client.matchmaking();

Expand All @@ -24,7 +24,7 @@ fn main() {
});

loop {
single.run_callbacks();
client.run_callbacks();

if let Ok(lobby_id) = receiver_create_lobby.try_recv() {
println!("Sending message to lobby chat...");
Expand Down
9 changes: 5 additions & 4 deletions examples/workshop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ fn delete_item(ugc: &UGC<ClientManager>, published_id: PublishedFileId) {

fn main() {
// create a client pair
let (client, single) = Client::init().expect("Steam is not running or has not been detected");
let client = Client::init().expect("Steam is not running or has not been detected");

// get a handle to Steam's UGC module (user-generated content)
let ugc = client.ugc();

// create a channel to communicate with the upcoming callback thread
// this is technically not *needed* but it is cleaner in order to properly exit the thread
Expand All @@ -113,7 +116,7 @@ fn main() {
let callback_thread = std::thread::spawn(move || {
loop {
// run callbacks
single.run_callbacks();
client.run_callbacks();
std::thread::sleep(std::time::Duration::from_millis(100));

// check if the channel is closed or if there is a message
Expand All @@ -125,8 +128,6 @@ fn main() {
}
});

// get a handle to Steam's UGC module (user-generated content)
let ugc = client.ugc();
create_item(&ugc);

// only do this once you received a successful callback for creating the item, else this WILL fail!
Expand Down

0 comments on commit b1a4472

Please sign in to comment.