So I redid the all the hdc redraw thing. But keep getting a CTD. This needs to be redone. But not sure what it should look like?
void Atlantis::RedrawPanel_MFDButton(SURFHANDLE surf, int mfd)
{
oapi::Font* font = oapiCreateFont(-11, true, "Arial");
//g_Param.font[0] = CreateFont (-11, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
oapi::Sketchpad* skp = oapiGetSketchpad(surf);
skp->SetFont(font);
skp->SetTextColor(0x0000FF);
skp->SetTextAlign(oapi::Sketchpad::CENTER);
if (oapiGetMFDMode(mfd) == MFD_NONE) {
RECT r = { 0, 0, 255, 13 };
FillRect(skp, &r, (HBRUSH)GetStockObject(BLACK_BRUSH));
}
else { // MFD powered on
HFONT pFont = (HFONT)SelectObject(skp);
const char* label;
int x = 24;
for (int bt = 0; bt < 5; bt++) {
if (label = oapiMFDButtonLabel(mfd, bt)) {
skp->Text( x, 1, label, strlen(label));
x += 42;
}
else break;
}
skp->Text(234, 1, "PG", 2);
SelectObject(skp, pFont);
}
oapiReleaseDC(surf, skp);
/* HDC hDC = oapiGetDC(surf);
// D. Beachy: BUGFIX: if MFD powered off, cover separator lines and do not paint buttons
if (oapiGetMFDMode(mfd) == MFD_NONE) {
RECT r = { 0, 0, 255, 13 };
FillRect(hDC, &r, (HBRUSH)GetStockObject(BLACK_BRUSH));
}
else { // MFD powered on
HFONT pFont = (HFONT)SelectObject(hDC, g_Param.font[0]);
SetTextColor(hDC, RGB(0, 255, 216));
SetTextAlign(hDC, TA_CENTER);
SetBkMode(hDC, TRANSPARENT);
const char *label;
int x = 24;
for (int bt = 0; bt < 5; bt++) {
if (label = oapiMFDButtonLabel(mfd, bt)) {
TextOut(hDC, x, 1, label, strlen(label));
x += 42;
}
else break;
}
TextOut(hDC, 234, 1, "PG", 2);
SelectObject(hDC, pFont);
}
oapiReleaseDC(surf, hDC);
*/
//oapi::Font* font = oapiCreateFont(40, true, "*Seven Segment");
//oapi::Sketchpad* skp = oapiGetSketchpad(surf);
//skp->SetFont(font);
//skp->SetTextColor(0x0000FF);
//skp->SetTextAlign(oapi::Sketchpad::LEFT);
}
From Atlantis :
void Atlantis::RedrawPanel_MFDButton (SURFHANDLE surf, int mfd)
{
HDC hDC = oapiGetDC (surf);
// D. Beachy: BUGFIX: if MFD powered off, cover separator lines and do not paint buttons
if (oapiGetMFDMode(mfd) == MFD_NONE) {
RECT r = { 0,0,255,13 };
FillRect(hDC, &r, (HBRUSH)GetStockObject(BLACK_BRUSH));
} else { // MFD powered on
HFONT pFont = (HFONT)SelectObject (hDC, g_Param.font[0]);
SetTextColor (hDC, RGB(0,255,216));
SetTextAlign (hDC, TA_CENTER);
SetBkMode (hDC, TRANSPARENT);
const char *label;
int x = 24;
for (int bt = 0; bt < 5; bt++) {
if (label = oapiMFDButtonLabel (mfd, bt)) {
TextOut (hDC, x, 1, label, strlen(label));
x += 42;
} else break;
}
TextOut (hDC, 234, 1, "PG", 2);
SelectObject (hDC, pFont);
}
oapiReleaseDC (surf, hDC);
}