Why is winbgi function settextstyle() occupying memory on the heap?

89 views Asked by At

I am making a snake game in C using winbgi library. I have a problem with function settextstyle(). Every call of function adds memory to the heap (about 50kb). I have to use this function in loop, so at some point the heap starts to overflow. Is there a way to release memory occupied by this function? Or some other way to change the size of the text in winbgi?

while(1)
{
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 4)
    outtext(...)
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 2)
    outtext(...)
}
1

There are 1 answers

0
alk On BEST ANSWER

Pull the latest winbgi sources from here.

There was a bug (missing call to DeleteObject() after SelectObject() to set a new font in set_font()) within text.cxx which the code linked fixes.