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

[rcore] GetFrameTime() counts time since application was minimized #4588

Open
Volcanic-Penguin opened this issue Dec 9, 2024 · 1 comment

Comments

@Volcanic-Penguin
Copy link

Volcanic-Penguin commented Dec 9, 2024

Issue description

I'm using Raylib 5.0 with Rust but I'm presuming this is not a Rust specific bug. If it is then I'm sorry for wasting your time. If you minimize a Raylib application, when you unminimize the app, GetFrameTime() will return the total amount of time that has passed since you minimized the app. I feel like this probably shouldn't happen, anything that's moving based on frame time will move way too far when opening a minimized application, so you could probably clip through walls and stuff.

Environment

Raylib 5.0 with Rust (raylib-rs)
Windows 10
Platform backend: DESKTOP (GLFW)
Renderer: Intel(R) HD Graphics 530

Code Example

Just print GetFrameTime() to the console if it's more than one second, so something like:

if GetFrameTime() > 1.0 {
  printf(GetFrameTime());
}
@Volcanic-Penguin
Copy link
Author

Wow well done, thanks for the fix!

That being said, I think that ideally you should be able to set FLAG_WINDOW_ALWAYS_RUN to false and still have GetFrameTime() work properly when the application stops and starts. I don't know how GetFrameTime() actually works but I could imagine maybe storing the time when the application stops and starts and subtracting that from the frame time or something like that.

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

No branches or pull requests

1 participant