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

Enhance frame rate calculations with double and SDL performance counter #1843

Closed
wants to merge 3 commits into from

Conversation

MAJigsaw77
Copy link
Contributor

  • Updated frame rate calculations to improve timing accuracy.

  • Replaced Uint32 with double for precise timing values.

  • Switched from SDL_GetTicks() to SDL_GetPerformanceCounter() and SDL_GetPerformanceFrequency() for high-resolution timing.

@NeeEoo
Copy link

NeeEoo commented Sep 28, 2024

Just Fyi: SDL_AddTimer takes a uint32 (ms) and not a double, so this still causes the framerate to be slightly off. A possible fix would be using std::chrono

@Dimensionscape
Copy link
Member

Dimensionscape commented Sep 29, 2024

I appreciate the initiative, but this doesn't resolve any problems, and increases cpu usage. We are going to handle this in a very different way in the next(probably) version of lime.

@MAJigsaw77 MAJigsaw77 deleted the patch-2 branch September 29, 2024 03:17
@NeeEoo
Copy link

NeeEoo commented Sep 29, 2024

When sdl 3 is implemented we can use SDL_GetTicksNS to get nanoseconds instead and its in Uint64

@Dimensionscape
Copy link
Member

The plan is to stop using SDL to construct the main loop.

When sdl 3 is implemented we can use SDL_GetTicksNS to get nanoseconds instead and its in Uint64

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