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

Performance methods #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Performance methods #1

wants to merge 5 commits into from

Conversation

raj
Copy link

@raj raj commented Aug 21, 2024

add some timer methods

fun get_ticks64 = SDL_GetTicks64 : UInt64
fun get_performance_counter = SDL_GetPerformanceCounter : UInt64
fun get_performance_frequency = SDL_GetPerformanceFrequency : UInt64
fun delay = SDL_Delay(ms : LibC::UInt) : Void

@Hadeweka
Copy link
Owner

Hadeweka commented Aug 21, 2024

First of all, thank you!

A few things:

Firstly, the files in the src directory are generated automatically. A simple rerun of the generator script would just overwrite your code as it currently is, so you'd have to make sure that the generator scripts explicitely generate the bindings by using the SDL header files. You'd have to include the methods or libraries there.

Secondly, is there a specific reason to use the SDL time measuring functions over the ones natively provided by Crystal? Because so far I don't see the need for these methods. A similar discussion arose some years ago in another SDL repository:
ysbaddaden/sdl.cr#17

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.

2 participants