JMW
Aspiring Addon Developer
Hi,
I'm trying to print all bases loaded in a scenario to a hud displayed on an invisible mesh in VC.
I have in
but what I get doesn't fit on the mesh, (the longer names are truncated on the second column) whatever I try to do with the figures.
If I try to make the mesh bigger, the print just gets bigger too, and still truncated.
If I try to reduce the size of the font, it's still truncated the same.
To get it to appear at all, I had to have the strange
setup.
Is there an easier, more adaptable way of putting this on screen?
I'm trying to print all bases loaded in a scenario to a hud displayed on an invisible mesh in VC.
I have in
Code:
bool ShuttlePB::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp)
{
if(HUD2 == 1 && oapiGetHUDMode() == HUD_DOCKING &&oapiCockpitMode() == COCKPIT_VIRTUAL)
{
double line = 20;
oapi::Font *font = oapiCreateFont (15, false, "MyFont", FONT_NORMAL);
skp->SetFont(font);
char buf[256];
int len = 84;
char basename[84];
OBJHANDLE hPlanet = oapiGetGbodyByName("Earth");
int nBase=oapiGetBaseCount(hPlanet);
{
for (i=0; i <nBase; i++) {
double linespacing;
linespacing = linespacing + 11;
OBJHANDLE Bases = oapiGetBaseByIndex(hPlanet, i);
oapiGetObjectName(Bases, basename, len);
skp->SetTextColor( 0xffffff);
if(i <= nBase)
{
if (i <20)
{
len = sprintf_s(buf," %s", basename);
skp->Text(-126,line +linespacing, buf, len);
}
else
{
line = 20;
len = sprintf_s(buf," %s", basename);
skp->SetTextAlign (oapi::Sketchpad::LEFT, oapi::Sketchpad::TOP);
skp->Text(125,((line-220) +linespacing), buf, len);
}
}
}//oapiReleaseFont (oapi::Font *font);
}
}
return true;
}
If I try to make the mesh bigger, the print just gets bigger too, and still truncated.
If I try to reduce the size of the font, it's still truncated the same.
To get it to appear at all, I had to have the strange
Code:
len = sprintf_s(buf," %s", basename);
skp->Text(-126,line +linespacing, buf, len);
Is there an easier, more adaptable way of putting this on screen?
Last edited: