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

entities/x: Allow actual metadata usage #225

Merged
merged 1 commit into from
Oct 6, 2024
Merged

Conversation

Implausiblyfun
Copy link
Contributor

Entities have a concept of metadata which is an unexported map.
This is a pretty cool feature and we've used it via unreleased branches before.

However since it is un-exported and uninitialized anyone who does not reimplement accessors on some wrapping class cannot use it.

In this PR we look to change that by allowing initialization of the map by default on entity creation.

To reproduce take an entity such as the one in platformer example https://github.com/oakmound/oak/blob/v4.1.0/examples/platformer/main.go#L28

char := entities.New(ctx, entities.WithRect(floatgeom.NewRect2WH(100, 100, 16, 32)), entities.WithColor(color.RGBA{255, 0, 0, 255}), entities.WithSpeed(floatgeom.Point2{3, 7}), )

then try to set some metadata
` char.SetMetadata("mykey", "somevalue")

`

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.98%. Comparing base (3b840e6) to head (99c5305).
Report is 2 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #225   +/-   ##
=======================================
  Coverage   94.98%   94.98%           
=======================================
  Files         143      143           
  Lines        6403     6403           
=======================================
  Hits         6082     6082           
  Misses        288      288           
  Partials       33       33           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@200sc 200sc merged commit fd7958f into master Oct 6, 2024
10 of 11 checks passed
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.

3 participants