--- Craig Belson <[EMAIL PROTECTED]> wrote:
> Alright, what I'd ideally like to do is assign a color
> at random to that, but it takes a const RGBColorType
> *, which I can't seem to be able to figure out how to
> code... I keep getting messages telling me that I
> can't set null as the first field of the struct, and
> the other message I get is that there's an illegal
> implicit conversion - for want of a better idea, what
> I have in my code right now is an RGBColorType set to
> (NULL, 255,0,0) and a const RGBColorType* that I'm
> trying to assign the RGBColorType to. 

Do you mean you did this:

  const RGBColorType* newRgb = (NULL, 255,0,0);  ???

That will not work.

Try something like this:

  // draw a red rectangle
  RGBColorType newRgb, prevRgb;
  RectangleType redRect = { 10, 20, 20, 20 };
  RectangleType defaultColorRect = { 10, 50, 20, 20 };

  MemSet( &newRgb, sizeof(RGBColorType), 0 );
  newRgb.r = 0xff;
  WinSetForeColorRGB( 
    (const RGBColorType*)&newRgb, (RGBColorType*)&prevRgb );
  WinDrawRectangle( &redRect, 0 );

  // draw a rectangle in the previous color
  WinSetForeColorRGB( (const RGBColorType*)&prevRgb, NULL );
  WinDrawRectangle( &defaultColorRect, 0 );

Now, that wasn't so hard, was it?


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to