Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(friends): adding getFriendsFromSource & avatar wrappers #166

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dan-myles
Copy link
Contributor

Added a new function wrapper get_friends_from_source...
Unfortunately the name is very misleading. This will not only get "friends" from the source (gameserver, lobby, chat room), but it will return all users. However the steamworks api has it named the same way so I thought I would keep it.

Also it requires a client to be connected to the source in order to work. Once connected you will be able to get all users on that particular gameserver etc.

}
let mut friends = Vec::with_capacity(count as usize);
for idx in 0..count {
let friend = SteamId(sys::SteamAPI_ISteamFriends_GetFriendFromSourceByIndex(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be implemented as an iterator instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the vec is initialized with size count to make it explicit that the index is important.
the steam api requires the index to get further information

what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's the issue I'm raising here. Forcing this into Vec requires it to allocate on each call. If we had a lazy iterator, the caller can the n decide whether to collect it into a Vec or just iterate/filter/postprocess or whatever they please with it instead.

@dan-myles dan-myles changed the title feat(friends): adding getFriendsFromSource feat(friends): adding getFriendsFromSource & avatar work Apr 2, 2024
@dan-myles dan-myles changed the title feat(friends): adding getFriendsFromSource & avatar work feat(friends): adding getFriendsFromSource & avatar wrappers Apr 2, 2024
@dan-myles
Copy link
Contributor Author

i've gone ahead an added some more wrappers here for avatar.
the steam api mentions the ability to pass in the steamid of the local users to get the current users avatar.

saw that this hadn't been implemented... as of right now we can only get avatars of "friends"

let me know what you think!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants