Jump to content
  • Advertisement

Archived

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

vaneger

problems with allegro

This topic is 5351 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

Advertisement

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
ok i got it to work but how can i make it out put larger text?

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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!