SDK Question CustomHUD Text in 2010P1

Ashaman42

New member
Joined
May 30, 2009
Messages
88
Reaction score
0
Points
0
Hi there.

I've finally restarted developing some addons for Orbiter having stopped just before 2010 replaced v2006 and I'm having a bit of trouble.

I'm trying to write custom text to the hud to display information on my addon.

Now I have managed this using DanSteph's UmmuExampleShuttlePB code but this text only displays when one of the three hud modes is active, if I turn off the hud the text also disappears.

This isn't ideal as the addon being a building it doesn't need surface, orbit or docking hud modes, is there a simple was to make my text display on it's own.

Cheers for any pointers.

Also is it worth me changing the addon from Vessel2 to Vessel3, I did have a go at this but it stopped the ummu hud text working at all.

I think because the vessel3 drawHud uses sketchpad instead of HDC.
 
I used BrianJ's Spotlight2 source code for ...ahem... inspiration, adding only a handy preprocessor macro and an array of line Y coordinates.
 
I used BrianJ's Spotlight2 source code for ...ahem... inspiration, adding only a handy preprocessor macro and an array of line Y coordinates.

Thanks for the tip though the source code was in the spotlight addon rather than the spotlight2.

That's given me some pointers (I like addons that include source code) on printing text to the hud in a vessel3 addon but still no clearer on how to have just the text without the usual huds up.

Most perplexing, looked back at one of my addons for 2006 and have managed to have just text there but running the same addon in 2010 and the text is only there if the hud is turned on.
 
Here's an exemple that will display your altitude, vertical, horizontal & lateral velocities...

You'll have to use VESSEL3, but there's no compatibility problem with uMMu.

Code:
bool RLM::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp)
{
	VESSEL3::clbkDrawHUD (mode, hps, skp);
	int cx = hps->CX, cy = hps->CY;

            int linespacing = 2, charwidth = 2, lineNo = 200, len;
           
            char buffer[512];
            memset(buffer, 0, sizeof(buffer));

            double TASkts = GetAirspeed();
            double ALTmt = GetAltitude();
			VECTOR3 ofs;
			double HAV = GetHorizonAirspeedVector(ofs);
			double VVel = ofs.y;
			double HVel = ofs.x + ofs.z;

			len = sprintf_s(buffer, "VEL %.2f", TASkts);	
			skp->Text(375, linespacing*150, buffer,  len);
			len = sprintf_s(buffer, "VRT %.2f", VVel);		
			skp->Text(825, linespacing*165, buffer,  len);
			len = sprintf_s(buffer, "LAT %.2f", HVel);
			skp->Text(375, linespacing*165, buffer,  len);
			len = sprintf_s(buffer, "ALT %.2f", ALTmt);
			skp->Text(825, linespacing*150, buffer,  len);
}
 
Back
Top