- Joined
- Nov 25, 2007
- Messages
- 1,665
- Reaction score
- 13
- 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:
Is there anything wrong here, or is it as bug?
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]
}