You are almost THERE!
Font releasing happens in wrong function.
The idea is following:
1) When you initialize your vessel Atlantis you also initialize additional resources including font. Than is reason why oapiCreateFont() happen in function clbkPostCreation()
2) Then you use this font in RedrawPanel_MFDButton(). This is called on every frame update. You don't need to allocate/deallocate/create/destroy/release font resource here.
3) When you don't need font anymore you must release/destroy it. Let me see in what function you need to release unneeded font.
So far I suggest to release font here (Atlantis class destructor):
But, maybe there is better place (function) where to deallocate/release/remove font. I will check it in sample code, but little later.
Font releasing happens in wrong function.
Code:
oapiReleaseFont(Atlantis::font3);
The idea is following:
1) When you initialize your vessel Atlantis you also initialize additional resources including font. Than is reason why oapiCreateFont() happen in function clbkPostCreation()
2) Then you use this font in RedrawPanel_MFDButton(). This is called on every frame update. You don't need to allocate/deallocate/create/destroy/release font resource here.
3) When you don't need font anymore you must release/destroy it. Let me see in what function you need to release unneeded font.
So far I suggest to release font here (Atlantis class destructor):
Code:
Atlantis::~Atlantis () {
oapiReleaseFont (Atlantis::font1);
}
But, maybe there is better place (function) where to deallocate/release/remove font. I will check it in sample code, but little later.