Archived

This topic is now archived and is closed to further replies.

problems with allegro

This topic is 5048 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


starttime = gettime();
fps=0;
counter=0;
while(running) {
counter++;
if (gettime() - starttime > 1 sec) {
fps=counter;
counter=0;
starttime=gettime();
}
Draw the time on the screen



Now don''t you have feel the pride for having figured it out for yourself?

Share this post


Link to post
Share on other sites
thats one method. allegro has several built-in functions to help with this


int fps,framecount;

void fps_counter(void)
{
fps = framecount;
framecount = 0;
}
END_OF_FUNCTION(fps_counter)


int main()
{
...
init_timer();
LOCK_FUNCTION(fps_counter);
LOCK_VARIABLE(fps);
LOCK_VARIABLE(framecount);

install_int(fps_counter,1000);

...
//somewhere in draw loop
textprintf(screen,x,y,font,color,"Fps = %d",fps);
}

Share this post


Link to post
Share on other sites
the problem is when i do this:


textprintf(screen,0,0,font,makecol(255,255,255),"Fps = %d",lastF);

it says it cant convert parameter 4 from font* to int

Share this post


Link to post
Share on other sites