1

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(...)
}
genpfault
  • 51,148
  • 11
  • 85
  • 139
Michu01
  • 15
  • 3

1 Answers1

1

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.

alk
  • 69,737
  • 10
  • 105
  • 255