jadpole / jadpole.github.io

https://jadpole.github.io
64 stars 21 forks source link

1.5 doesn't declare `timer` or `get_ticks()` #1

Closed IslandUsurper closed 9 years ago

IslandUsurper commented 9 years ago

While I noticed the call to timer() when building the sdl_context, I can't figure out how to actually use the frame timing code. I guessed that it was added to src/main.rs, but that isn't completely obvious, either.

What do I declare to make the third code example work?

jadpole commented 9 years ago

You use it just under current_view.resume(&mut context). A few lines down, there is the bigger picture (in Abstracting the game loop).

I modified slightly the snippet to make it more obvious.

IslandUsurper commented 9 years ago

What really threw me is that there wasn't any mention of use ::sdl2::timer; in any of your code snippets. I don't mind that it wasn't said to add it in explicitly, but none of your code samples included that line either, so I didn't know if it was part of std or where in the sdl2 crate it existed either. I had to go look at their repository to find it.

jadpole commented 9 years ago

Thanks, I didn't notice that. It is now fixed. Hopefully, it should be less confusing! :-)