Drawing on HUD in VESSEL3 class causes CTD

BrianJ

Addon Developer
Addon Developer
Joined
Apr 19, 2008
Messages
1,877
Reaction score
1,284
Points
128
Location
Code 347
Using latest Orbiter beta version 150307.

Writing text or drawing lines on the HUD in any of my VESSEL3 class add-ons causes a CTD when HUD is displayed(cockpit view).

Still works fine for my VESSEL2 class add-ons.

This works OK(VESSEL2 class)
Code:
///// class interface
class f9h_stg2: public VESSEL2 
{
public:
    f9h_stg2 (OBJHANDLE hVessel, int flightmodel);
    ~f9h_stg2 ();
    void clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, HDC hDC);
}

///// HUD 
void f9h_stg2::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, HDC hDC)
{

    char kbuf[256];
    sprintf(kbuf,"TEST TEST TEST");
    TextOut(hDC,(100),(100),kbuf,strlen(kbuf));
  
}
This causes CTD (VESSEL3 class)
Code:
///// class interface
class f9h_stg2: public VESSEL3 
{
public:
    f9h_stg2 (OBJHANDLE hVessel, int flightmodel);
    ~f9h_stg2 ();
    bool clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp);
}

///// HUD
bool f9h_stg2::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, oapi::Sketchpad *skp)
{
    // draw the default HUD
    VESSEL3::clbkDrawHUD (mode, hps, skp);

    char kbuf[256];
    sprintf(kbuf,"TEST TEST TEST");
    skp->Text((100),(100),kbuf,strlen(kbuf));

    return true;
}
I see the default shuttle Atlantis manages to draw on the HUD with no problems, and from the sample sdk code it looks like Atlantis is VESSEL3 class - so, am I missing something from my code?

Cheers,
BrianJ

EDIT------------------------------
Compiling with the OrbiterBeta r.13 SDK libraries solves the problem.
 
Last edited:
Back
Top