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

Use built-in frame count #29

Open
alice-i-cecile opened this issue Nov 21, 2022 · 0 comments
Open

Use built-in frame count #29

alice-i-cecile opened this issue Nov 21, 2022 · 0 comments
Labels
blocked code quality Make the code faster or prettier good first issue Good for newcomers

Comments

@alice-i-cecile
Copy link
Contributor

Needs bevyengine/bevy#6676, so can't be done until Bevy 0.10.

@alice-i-cecile alice-i-cecile added good first issue Good for newcomers code quality Make the code faster or prettier blocked labels Nov 21, 2022
github-merge-queue bot pushed a commit to bevyengine/bevy that referenced this issue May 10, 2024
# Objective

I am emboldened by my last small PR and am here with another.

- **Describe the objective or issue this PR addresses.**

It would be nice if `FrameCount` could be used by downstream plugins
that want to use frame data. The example that I have in mind is
[`leafwing_input_playback`](Leafwing-Studios/leafwing_input_playback#29)
which has a [duplicate implementation of
`FrameCount`](https://github.com/Leafwing-Studios/leafwing_input_playback/blob/main/src/frame_counting.rs#L9-L37)
used in several structs which rely on those derives (or otherwise the
higher-level structs would have to implement these traits manually).
That crate, using `FrameCount`, tracks input frames and timestamps and
enables various playback modes.

I am aware that bevy org refrains from deriving lots of unnecessary
stuff on bevy types to avoid compile time creep. It is worth mentioning
the (equally reasonable) alternative that downstream crates _should_
implement some `FrameCount` themselves if they want special behavior
from it.

## Solution

- **Describe the solution used to achieve the objective above.**

I added derives for `PartialEq, Eq, PartialOrd, Ord` and implementations
for `serde::{Deserialize, Serialize}` to `FrameCount`.

## Testing

Manually confirmed that the serde implementation works, but that's all.
Let me know if I should do more here.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked code quality Make the code faster or prettier good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant