I'm making a game right now. I'm laying down the framework currently, and I am having the most annoying issue: for some reason, I get an error when I try to draw text in my class file. It tells me that there's an assertion error.
But here's the kicker: I only get the error if I wait a second or two after starting the program, otherwise, it will let me bring up the exit menu.
Here's the class file instance of the function:
this is the header information in both the main and class file:
#pragma once #include <allegro5\allegro.h> #include<allegro5\allegro_image.h> #include<allegro5\allegro_audio.h> #include<allegro5\allegro_acodec.h> #include<allegro5\allegro_font.h> #include <allegro5\allegro_ttf.h> #include<allegro5\allegro_native_dialog.h> #include <ctime> #include "functions.h"
in case you wanted to see the entire main function, here it is too:
if you need to see anything else (i.e. another function), let me know. thanks in advance!
P.S.: Some of it may be confusing because it's set up for later in the game development process (e.g. the array of x values for droppers). Hope it doesn't confuse you too much
]]>One thing right off the bat: You need to set your display mode BEFORE you load any bitmaps or fonts.
See if that fixes the problem.
]]>didn't do anything =/
]]>Why are you calling al_set_new_display_flags in playerQuit? Why are you loading the font every single time in that function without destroying it (this is your error btw)?
Also... I object to you using keyboard state like that (you really should be using events)... and even if you do use keyboard state, then don't mix drawing and logic like that.
]]>I set the flags to see if I could fix it (prior to your response, I thought there might have been an issue with the display not being part of the current thread).
Thanks so much for the help, I fixed it now. Also, I'm not sure what you mean by events, but I'll read up on them now. Could you explain what you mean by mixing drawing and logic though?
]]>