Hello again,
At first I didn't wanted to start another thread but... my brain will explode !
I try to display data on a HUD, the SurfaceHUD in this case. The "BombMFD" tutorial, pt. 2-3 (yeah, it's my bible those days), explains very well how to do that.
But...
Orbiter seems to use it's own display method, "Sketchpad". I looked at the "DrawingAPI.h" file for more explanations, but, as it says, it's strictly a drawing API, used to display geometric shapes.
I tried Computerex's code sample, but it is based on the Windows API, which can display numerical values. So when I come to the part where the Textout functions asks a pointer for hDC, I'm doomed...
I've managed to display various text strings like "Hail Probe" or "Hello Probe", but I don't manage to display numerical data.
So I searched on the web and I tried what follows, that is my "best guess"... Because what I need is apparently to convert a double value into a char string. "sprintf" is the obvious answer, but how to adapt it to SketchPad ? It's where I get stucked.
Of course I could use a clbkDrawHud with hDC. But then I would have only data and no more fancy shapes like the landing gear or the nosecone indicators. Which would mean than you have to choose between the two (or that I'd make better how to draw shapes with the Windows API) ?
Where I'm surprised is that SketchPad was implemented to avoid the use of the Windows API :
So I'm completely confused... Do I have to choose between the 2 APIs, or is there a mean to have the best of each ?
Sorry for the disturbance. I know I'm probably looking at the problem from a wrong angle... but well I really don't see...
:compbash: :hail:
:compbash2:
At first I didn't wanted to start another thread but... my brain will explode !
I try to display data on a HUD, the SurfaceHUD in this case. The "BombMFD" tutorial, pt. 2-3 (yeah, it's my bible those days), explains very well how to do that.
But...
Orbiter seems to use it's own display method, "Sketchpad". I looked at the "DrawingAPI.h" file for more explanations, but, as it says, it's strictly a drawing API, used to display geometric shapes.
I tried Computerex's code sample, but it is based on the Windows API, which can display numerical values. So when I come to the part where the Textout functions asks a pointer for hDC, I'm doomed...
I've managed to display various text strings like "Hail Probe" or "Hello Probe", but I don't manage to display numerical data.
So I searched on the web and I tried what follows, that is my "best guess"... Because what I need is apparently to convert a double value into a char string. "sprintf" is the obvious answer, but how to adapt it to SketchPad ? It's where I get stucked.
Of course I could use a clbkDrawHud with hDC. But then I would have only data and no more fancy shapes like the landing gear or the nosecone indicators. Which would mean than you have to choose between the two (or that I'd make better how to draw shapes with the Windows API) ?
Where I'm surprised is that SketchPad was implemented to avoid the use of the Windows API :
Code:
// This API defines an abstraction layer for providing drawing support
// for surfaces (e.g. lines and text). It is closely modelled on the
// Windows GDI, but provides an overload mechanism to insert different
// drawing systems.
Code:
bool DeltaGlider::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp)
{
// draw the default HUD
VESSEL3::clbkDrawHUD (mode, hps, skp);
int cx = hps->CX, cy = hps->CY;
// trying to display a double class value on the HUD
if (oapiGetHUDMode() == HUD_SURFACE) {
char* buff;
buff = (char*) malloc(15);
double data = 1234.5678;
sprintf(buff, "%f", data);
skp->Text (0, hps->H-20,"??", ?);
}
return true;
}
:compbash: :hail:
:compbash2:

