well... ive combined some information from all the examples here and across the web... and i have an ugly yet functional fix (gonna start making it nicer and less cluttered tonight).
#include <windows.h>
#include <iostream>
using namespace std;
int main(){
timeBeginPeriod(1);
double acc = 0.0;
unsigned tick = timeGetTime();
unsigned lasttick = timeGetTime();
unsigned currtick = 0;
unsigned fps = 0;
unsigned second = (unsigned)(timeGetTime() / 1000.0);
double update = 1000.0 / 60.0; // <- change 60.0 to whatever you want :)
while(1){
currtick = timeGetTime();
if(acc >= update){
acc -= update;
lasttick = currtick;
fps++;
cout << "-";
}
if(second != (unsigned)(currtick / 1000.0)){
second = (unsigned)(currtick / 1000.0);
cout << "\n\nfps : " << fps << "\n";
cout << "acc : " << acc << "\n\n";
fps = 0;
}
if(tick != currtick){
acc+=currtick - tick;
tick = currtick;
}
if((update - acc) > 5){
Sleep(5);
tick = currtick;
}
}
timeEndPeriod(0);
cin.get();
return 0;
}
it still requires winmm (-lwinmm for G++ linker command) for the high resolution timers on windows... also its not cross platform...
ANYWAY... it works... regardless of fps... so im happy XD
thanks everyone! and feel free to use my code if you actually think its decent