-
Notifications
You must be signed in to change notification settings - Fork 220
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
Add docs to the book how to retrieve a component for a given entity #310
Comments
So, I just cloned and changed the world method to take an Index then changed Index to a usize, and was met with loads of compile errors - is there a reason for this discrepancy, or is it just a bit messy? (i.e. should I even bother trying to clean up or is there a deeper reason they're different here) |
Nevermind, figured it out. The 'id' is referring to a component id. |
Yes you could basically have multiple component storages of the same type, which is useful for scripting. Let's reopen it so the docs get improved. |
312: Added more documentation to world read / write methods. r=torkleyy a=tomc1998 Whilst there was already documentation explaining component / resource IDs, it was easy to skim over and no reference was made by the read_with_id and write_with_id methods. This made it seem like it expected an entity ID to search for a component, whereas in reality it's used for more complex component / resource setups. This is meant to address #310 . <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/slide-rs/specs/312) <!-- Reviewable:end -->
Is this still relevant? |
@Rhuagh I'm not sure. If you're reading the book very closely you can see how to do it, but it should be more obvious I think. Probably worth its own chapter together with how relationships shall be modeled. |
What I was getting at here is that this ticket refers to a feature that no longer exists ( |
I concur with @Rhuagh , the ambiguity no longer exists because the function that caused confusion has been removed. So I'll close this |
Hey!
So, unless I'm seriously misunderstanding something here, these types are mismatched!
Is there any reason why world doesn't use Index, and Index is not a usize?
To be clear, here is the
read_with_id()
method:https://docs.rs/specs/0.10.0/specs/struct.World.html#method.read_with_id
And here is the Entity's
id()
method:https://docs.rs/specs/0.10.0/specs/struct.Entity.html#method.id
Here is the definition of the
Index
typedef:https://docs.rs/specs/0.10.0/specs/type.Index.html
I'd want to try & fix this myself, but i'm so new to the library I'm worried it's a misunderstanding - plus I wouldn't know whether to go with usize / u32, do you have any pointers?:P
The text was updated successfully, but these errors were encountered: