Ninjabba, on Tue Oct 20, 2009 4:12 AM, said:
I'm quite new on lynx programming, but am getting a hang of it. As far as I am now, I try to have an animated sprite walking around against a background sprite. All is working fancy as long as I use the same color palette for both the sprite and the background. But I rather have different color palettes for the sprites, so when I try it like the code below, the whole screen flashes from one palette to the other. Now I have 2 questions:
Is it possible to use 2 completely different palettes for drawing on the same screen?
void DrawScene(void)
{
_SetRGB(pal_dungeon);
DrawSprite(Dungeon);
_SetRGB(pal_character);
DrawSprite(Character);
}
Or should I pick out the color palette in such a way that the character palette is a subset of the dungeon palette? By doing this, I can use other colors for other dungeons, but the total colors on the screen will be 16.. I hope someone reads this

This must look awful on the Lynx screen.
The first command _SetRGB will change the palette immediately.
The second command DrawSprite is hopefully drawing on a hidden draw page and not on the screen directly.
What this means is that the main screen will flicker every time you do a draw.
The correct way to do this is:
DrawSprite
DrawSprite
DrawSprite
wait for VBL
SetRGB
SwapBuffers
Now the screen is steady during all DrawSprites as they happen in background. The palette change and exchanging the draw page with the view page occur at a time when nothing happens on the screen.
I would create all my graphics on a giant bitmap and pick out the animated characters by sprpck. In this way you can use any colors while you design your backgrounds and characters. This also forces the same palette to all graphics on a single level. Then you can ask Gimp to convert the image to 16 bit indexed. At the conversion time you can also fine-tune the colors etc. Having the original data in RGB format makes life much easier. Don't overwrite the original design with the 16 bit indexed bitmap version.
Having a full color version of the design can also help in doing the box later. On the cover you can put full color versions instead of 16-color stuff.
If the sprites are very large like in Zaku you may need to use 3-bit, 2-bit or 1-bit sprites instead for your animations.
The sprpck has command line options for picking out a sprite from a bitmap.
-o020000
Offset 020 000 will start the sprite from this coordinate.
-S032032
Set size of the sprite in pixels
-r010004
Split picture into 10 by 4 tiles. This is good for animations your sprites will be named like;:
A000000
A000001
A000002
A000003
A001000
...
Combining these command line options makes it simple to extract the sprites out of the bitmap.
Keep the name of the animation as one character (like A). As the old tools you are using are very picky about the lenght of the file names.
--
Karri