3
\$\begingroup\$

I'm having trouble finding documentation on SDL_gfx, and I can't figure this out. I've managed to use SDL_gfx to automatically cap the framerate, and I it's working a lot better than my manual attempt (combining SDL_Delay and SDL_Getticks).

Now I've been trying to learn more about it, and I stumbled onto something.
Here's the whole struct:

typedef struct {
             Uint32 framecount;
             float rateticks;
             Uint32 lastticks;
             Uint32 rate;
     } FPSmanager;

Most variables in this struct are pretty straightforward, but I have no idea of what lastticks stands for. Does anyone know?

\$\endgroup\$
2
\$\begingroup\$

To put it simply, lastticks is used to to store the result of calling SDL_GetTicks(), or in other words, the number of miliseconds that have passed since the SDL library was initialized.

This is supported by looking at the SDL_framerate.cpp implementation file, and noticing that every assignment to lastticks is as follows:

manager->lastticks = SDL_GetTicks();       // Lines 23 and 81
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.