Skip to content
New issue

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

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

Already on GitHub? # to your account

Decouple Generated Sprite IDs #3

Closed
Alan-FGR opened this issue Oct 22, 2017 · 1 comment
Closed

Decouple Generated Sprite IDs #3

Alan-FGR opened this issue Oct 22, 2017 · 1 comment

Comments

@Alan-FGR
Copy link
Owner

Alan-FGR commented Oct 22, 2017

Use a custom resolver for sprites you can extend from your game project, currently IDs are generated into the engine assembly, a better solution is to store in a list you can extend from your code, and store the indexes, there are drawbacks though:

  • not stable, removing an item from list breaks serialization (what doesn't happen with enum if you serialize the key as string)
  • no intellisense
  • no free efficient serialization
  • no free compile-time safety check
  • other stuff i don't remember :P
@Alan-FGR
Copy link
Owner Author

Alan-FGR commented Oct 23, 2017

I think there's no way to do this other than an engine-provided dict using string keys that the user adds entries for their sprites, for autocompletion we could generate an enum of strings, we lose safety checks though, and also efficiency since it's not going to be trivial to convert the collection to list and access items by index as opposed to accessing dict by key for the release version.

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

No branches or pull requests

1 participant