Question Sketchpad Pen for Orbiter 2009 RC1

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,667
Reaction score
19
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
Hia

Did anybody try using oapi:: Pen with success? I'm trying to create various pens, but I always end up with drawing with the default green pen. My code looks more or less like this:

Code:
#define MFDLine(skp, x0, y0, x1, y1)    {    skp->Line(x0, y0, x1, y1);\
                                        }

#define GREEN        RGB(0x00, 0xFF, 0x00)
#define YELLOW        RGB(0xDF, 0xDF, 0x00)
#define WHITE        RGB(0xFF, 0xFF, 0xFF)
#define RED            RGB(0xFF, 0x00, 0x00)
#define GREY        RGB(0xE0, 0xE0, 0xE0)

#define NUM_PENS    4

class LaunchCompass : public MFDPage
{
    enum LineStyle
    {
        Green,
        Yellow,
        GreenDashed,
        White
    };
    LaunchCompass (DWORD w, DWORD h, VESSEL *v)
   {
    pens[Green]         = new oapi::Pen(1, 1, GREEN);
    pens[Yellow]     = new oapi::Pen(1, 1, YELLOW);
    pens[GreenDashed]= new oapi::Pen(2, 1, GREEN);
    pens[White]      = new oapi::Pen(1, 1, WHITE);
   }
    virtual ~LaunchCompass ()
   {
     for(int i = 0; i < NUM_PENS; ++i)
     {
         delete pens[i];
     }
    }

     void LaunchCompass::DrawVessel ( oapi::Sketchpad * skp )

     {

        [B]skp->SetPen(pens[Yellow]);
        // my drawing macro
        MFDLine(skp, x, y,    (int)(x - linelength * cos(up)),
                            (int)(y + linelength * sin(up)));
       // still drawing green[/B]
     }
Is there anything wrong here, or is it as bug?
 
Sketchpad, and Pens in Orbiter? I use the RC1, and for whatever reason I never heard anything about this. What is it exactly?
 
... you have to use the API call to create a pen. oapiCreatePen(...)

Ahhh, yet undocumented feature. Thank you Agent, your child is well now :) A big problem is that the HUD compass and flight director don't work after recompilation but luckily I copied flight director into the MFD context earlier.

Turbinator:
Sketchpad is a wrapper class (from my point of view) that will help in drawing lines in various graphics clients. Until now, everything was done only by using Windows device contexts.
Pen is what you use for drawing lines. Have a read of
orbiter091124beta\Orbitersdk\doc\API_Reference.chm
 
Last edited:
Sketchpad, and Pens in Orbiter? I use the RC1, and for whatever reason I never heard anything about this. What is it exactly?
If you aren't developing and coding addons, you don't need to worry about it.
 
Back
Top