Quote: "KISTech, how do you do your second loop within dgdk's one?"
The LoopGDK is your main loop.
Inside that you have the calculations to decide whether or not you'll call the Game loop or the Display loop.
dbSync() only happens at the end of the Display loop.
Like so,
while LoopGDK() {
gameLoops ++;
if (gameLoops => gameLoopThreshold) {
gameLoop();
gameLoops = 0;
}
dispLoops ++;
if (dispLoops => dispLoopThreshold) {
dispLoop();
dispLoops = 0;
}
}
I don't know what terminology you would use in C++ for gameLoop() or dispLoop(). They are basically just subroutines you call at the appropriate times.
On the TBM subject,
From your code I can't really tell how you're using it for movement. The idea is to have a value to multiply your movements by that is based solely on the amount of time that has passed, regardless of the framerate.
// TBM code
tim = dbTimer();
diff = tim - flast;
flast = tim;
factor = diff / 1000.0f;
// Moving an object with it
dbMoveObject obj, 1.0 * factor;
The code is only finding out how many milliseconds have elapsed since the last time through. There is no need to divide it by 30, or 60. The division by 1000 simply puts decimal point in the right place to calculate the proper distance to move.
At 60 FPS 16.667 milliseconds pass each frame, so you multiply the movement speed by 0.016667 seconds. Over 60 frames, you've moved the object 1 unit. ( 0.016667 * 60 = 1 )
This is true at any framerate. At 30 FPS, 33.333 milliseconds pass each frame. ( 0.033333 * 30 = 1 )