Hi
I'm having some problem starting more than one timer. I've made a class where I create 2 timers, one for game logic and one for graphic. The problem is that when I start the timer only one of them is really starting. What should I do?
Sorry if my inglesh is bad
It's difficult to say without seeing your code that declares / sets up / starts these timers.
The error may also be when you obtain the timer events, are you sure that you are correctly finding the source of each timer event (the event's field ".timer.source" should be equal to the first timer OR the second timer)
I use 2 different event queues, one for timer.
I use this function to check if the timers has started and it returns 3 every time
Edit you posted right before I did. Reading your code now.
Edit2
It should return 3, they're both started. How are you checking for events?
1 / setting[SETTING_FPS]
setting[] is hopefully an array of floats/doubles. If it's an array of integers, the division will be integer division, where 1 / 60 is 0.
One way to foolproof such code is to write "1.0 / x", so that no matter the type of x, it gets 'promoted' to double in order to perform the division.
The problem is that only the first I start work. If I print their count the first counts right, but the second stays at zero. I tried starting gps.timer before timer and gps.timer work while timer don't. Event check actualy work.
Show more code.
I changed check_event to get timers count
Enough?
Both of those variables were declared as int64_t, but you're designating themas %d, which is a signed integer. Your displayed counts will likely be wrong. You need to use %llu instead. See printf reference for details.
Also, you didn't show us where your settings are declared and defined. As Audric said earlier, if settings[SETTINGS_TPS] or settings[SETTINGS_FPS] are integers , then your division will result in zero being passed to al_create_timer.
He did say to change your code to use 1.0 divided by settings[SETTINGS...] but I see you haven't.
I changed type of setting from int to float and now %d with %llu
I define setting in the constructor of INTERFACE
Now both of the counts are increasing.