- Joined
- Jun 6, 2012
- Messages
- 317
- Reaction score
- 126
- Points
- 43
- Location
- Sydney, Australia, Earth, Sol
- Website
- www.orbithangar.com
Hi All,
I was hoping for some advice for how to go about printing text on the exterior of a vessel's mesh. I want this text to be dynamic and based on text declared in the class's clbkSetClassCaps function. The default DeltaGlider does exactly this witht he craft's name printed on the verticle stabilizers. The function in the default DeltaGLider appears simple enough (below):
I have used this exact code in my vessel class, called from clbkPostCreation, where the input is a SURFHANDLE defined in clbkSetClassCaps. I cannot get this to work at all though. When debugging, I can see that skp returns null pointer (debugger reads 0x00000000 {surf = ???}), and so noting in 'if (skp)' is called. When I debug in Orbiter_ng.exe and call this function I get an error on load (below).
If anyone could offer any advice on this I would really appreciate it. It seems like a very simple procedure, and I feel like there is probably just some library I am not linking with. Note that I have all settings and inclusions pretty much the same as the default ShuttlePB, so pretty barebones.
Thank you all,
MrMartian
I was hoping for some advice for how to go about printing text on the exterior of a vessel's mesh. I want this text to be dynamic and based on text declared in the class's clbkSetClassCaps function. The default DeltaGlider does exactly this witht he craft's name printed on the verticle stabilizers. The function in the default DeltaGLider appears simple enough (below):
C++:
void DeltaGlider::PaintMarkings (SURFHANDLE tex)
{
oapi::Font *font = oapiCreateFont (38, true, "Sans", FONT_BOLD);
oapi::Sketchpad *skp = oapiGetSketchpad (tex);
if (skp) {
skp->SetFont (font);
skp->SetTextColor (0xD0D0D0);
skp->SetTextAlign (oapi::Sketchpad::CENTER);
char cbuf[32];
strncpy (cbuf, GetName(), 10);
int len = min(strlen(GetName()), 10);
skp->Text (196, 10, cbuf, len);
skp->Text (196, 74, cbuf, len);
skp->SetTextColor (0x808080);
skp->SetTextAlign (oapi::Sketchpad::RIGHT);
skp->Text (120, 158, cbuf, len);
skp->SetTextAlign (oapi::Sketchpad::LEFT);
skp->Text (133, 158, cbuf, len);
oapiReleaseSketchpad (skp);
}
oapiReleaseFont (font);
}
I have used this exact code in my vessel class, called from clbkPostCreation, where the input is a SURFHANDLE defined in clbkSetClassCaps. I cannot get this to work at all though. When debugging, I can see that skp returns null pointer (debugger reads 0x00000000 {surf = ???}), and so noting in 'if (skp)' is called. When I debug in Orbiter_ng.exe and call this function I get an error on load (below).
If anyone could offer any advice on this I would really appreciate it. It seems like a very simple procedure, and I feel like there is probably just some library I am not linking with. Note that I have all settings and inclusions pretty much the same as the default ShuttlePB, so pretty barebones.
Thank you all,
MrMartian