FPS Drop (probably an easy fix)
I'll preface this by saying I'm pretty new to allegro, and a pretty bad programmer overall. The attatched code has been created expressly to reproduce my issue, and isn't currently in use in any project. I'm using the current stable release (5.0.10). I'm statically linking the -static-mt files with MinGW.
Description of my issue:
When I compile and run the attatched code, the game will run as normal (40fps) for around 4 seconds, and then suddenly drop down to 14fps, and remain like that for the rest of the time the game is running. I'm trying to figure out if this is an issue with my computer, or with the way I am coding... Hopfully someone can help me with this issue.
You should use
my code here
and past examples directly into messages in here in the future, makes life easier = faster replies... here's the code for other's convenience...
MAXIMAGES = 2; //only 2 images used in this test
MAXFONTS = 1; //font used to draw the fps
ScrW = 800; //display width
ScrH = 640; //display height
argc, char *
MAXIMAGES];//array of images
MAXFONTS];//same but for fonts
path = al_get_standard_path(
fps=0; //fps is 0 before any frames are rendered
fpstime = al_get_time(); // used to compare frame times and give FPS
37 while (1)
,0); //draws image 1 so its centered
,0); //draws image 2 so it fits with image 1
new_time = al_get_time();
fps = 1
One thing I see is that you are loading your bitmaps before you create your display. Without a display set as the current context you cannot create video bitmaps, so they are being created as memory bitmaps. Load your bitmaps after you create your display and see if that fixes things.
Thread #614271. Printed from Allegro.cc
That ended up doing the trick, thanks a lot.