-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add more configuration options to fps overlay #21326
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
base: main
Are you sure you want to change the base?
Conversation
| // Enable or disable the entire fps overlay | ||
| enabled: true, | ||
| frame_time_graph_config: FrameTimeGraphConfig { | ||
| enabled: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of enabled , I suggest rename
- in
FrameTimeGraphConfigchangeenabledtograph_enabled - in
FpsOverlayTextConfigchangeenabledtotext_enabled
And then for FpsOverlayConfig remove enabled and replace any usage with frame_time_graph_config.graph_enabled || text_config.text_enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well rename frame_time_graph_config to graph_config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with removing enabled from FpsOverlayConfig is that if the user wanna hide the overlay, like using some toggle key, it needs to work with two nested enabled properties, like described in #21201. Ideally to hide/show there should be only one property config for the entire overlay.
I'm ok with the other suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe set_enabled(bool) could be a method that sets both text_enabled and graph_enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still keeps the problem of "verbosity", because Bevy uses a lot of "declaration config". Imagine that I wanna it disabled so I can enable it with hotkey later on:
app.add_plugins(FpsOverlayPlugin {
config: FpsOverlayConfig {
text_config: FpsOverlayTextConfig {
enabled: false,
..default()
},
frame_time_graph_config: FrameTimeGraphConfig {
enabled: false,
..default()
},
..default()
},
});vs
app.add_plugins(FpsOverlayPlugin {
config: FpsOverlayConfig {
enabled: false,
..default()
},
});
Objective
Solution
FpsOverlayPositionConfigintoFpsOverlayConfigto enable fine configuration of overlay root node position.min_colorandmax_colortoFrameTimeGraphConfigto enable frame graph color configuration.FpsOverlayTextConfigto enable/disable only the text part of overlay.This PR is kinda blocked by #21022, since there is an intent to convert the fps overlay to use
bevy_sprite, but I decided to do it anyways because I don't think the benefits of convertingfps_overlaytobevy_spriteworth it.The fix for #21021 may not be ideal, since it can be confusing to have 3
enableoptions on a simple component likefps_overlay, but I think it would be nice to be able to only use the graph of the overlay, without the text itself:Testing
fps_overlayexample as testing and its working fine.