[comp.sys.amiga.programmer] Changing sprite colors?

aozer@next.com (Ali Ozer) (04/24/91)

Hey folks...

How do you change the colors of sprites (or more specifically, the mouse
pointer) on a screen with less than 32 colors? (For instance a hires or HAM
screen?) Calling SetRGB4(viewPort, reg, r, g, b) where reg >= 16 doesn't seem
to change the color under 1.3; under 2.0 it does, however I seem to get some
memory corruption (which doesn't occur when the SetRGB4() is removed).

Any ideas? Are there any known bugs/problems with this stuff or am I doing
something wrong?

Ali, Ali_Ozer@NeXT.com

aaron@stat.tamu.edu (Aaron Hightower) (04/25/91)

In article <549@rosie.NeXT.COM> aozer@next.com (Ali Ozer) writes:
>Hey folks...
>
>How do you change the colors of sprites (or more specifically, the mouse
>pointer) on a screen with less than 32 colors? (For instance a hires or HAM
>screen?) Calling SetRGB4(viewPort, reg, r, g, b) where reg >= 16 doesn't seem
>to change the color under 1.3; under 2.0 it does, however I seem to get some
>memory corruption (which doesn't occur when the SetRGB4() is removed).
>
>Any ideas? Are there any known bugs/problems with this stuff or am I doing
>something wrong?
>
>Ali, Ali_Ozer@NeXT.com

I ran into a similar problem once.  The SetRGB4 has some error trapping.  It
will not allow you to change colors beyond your colormap (what you are trying
to do) unless you have the SPRITES flag set in the modes of the viewPort.
This can be best accomplished on a customscreen by opening the screen with 
the SPRITES flag set.  If you have a program to modify the workbench color
palette, I could not tell you from experience what to do, but I would guess
that whatever you do, it should ultimately turn that bit (flag) in the
viewport's modes on (the SPRITES flag.)

It's amusing that this is unecessary in WB2.0.  I wonder if we are going to
start seeing software written on the 3000+ that won't work on other machines
because of these types of variations.  I've got a TETRIS game right now that
can't read the keyboard using the KBD_READMATRIX on my 1000, but it works
great on mine and my friend's 3000's.  I am now guessing that some field of the
request structure has become uneccessary to be filled in on the 3000 while 
still being necessary on the 1.3 machines.  Any clues, anyone?

Later,
 Aaron "I want a job writing Amiga code" Hightower