About › Forums › Technical Support and Releases › Lynx how to define or change palette.
- This topic has 1 reply, 1 voice, and was last updated 1 year ago by kikems.
-
AuthorPosts
-
August 30, 2023 at 5:41 pm #1064kikemsParticipant
Lynx have 4096 palette and can use 16 colors. I need define 4 or 5 different palettes for my game. Some times I use bitmaps for exterior scenaries, and sometime in dark places and this graphics need different palettes.
How I can define a new custom palette for Lynx?.
It’s possible define new palette before load a bitmap from the script code of my game ( I’m using your script code as base of goblins) ?.Cheching the sources of your 8Bits Unity I found an aparently definition of your default palette in /unity/target/lynx/display.c
“// GFX Data
static char palette[] = { 0x01, 0x04, 0x08, 0x0c, 0x0c, 0x08, 0x05, 0x05, 0x07, 0x0e, 0x09, 0x03, 0x02, 0x0f, 0x08, 0x00, // Upper 8 bits
0xca, 0xb4, 0xc4, 0xc3, 0x53, 0x22, 0x52, 0x27, 0x5e, 0x0f, 0xaf, 0x4d, 0x48, 0xff, 0x88, 0x00 }; // Lower 8 bits
”
If this is the definition of your default palette really I can’t understand values. In this case you have a formula or color table to convert RGB values to this format?.Thanks in advance.
November 5, 2023 at 5:43 pm #1067kikemsParticipantI’d found a solution.
First I use AtariGamer website to convert my html colors to CC65 code.
https://atarigamer.com/pages/atari-lynx-palette-generatorI’d comment original palette in /unity/target/lynx/display.c and add code generated by AtariGamer website.
here example for my custom palette code now.
// GFX Data
//static char palette[] = { 0x01, 0x04, 0x08, 0x0c, 0x0c, 0x08, 0x05, 0x05, 0x07, 0x0e, 0x09, 0x03, 0x02, 0x0f, 0x08, 0x00, // Upper 8 bits
// 0xca, 0xb4, 0xc4, 0xc3, 0x53, 0x22, 0x52, 0x27, 0x5e, 0x0f, 0xaf, 0x4d, 0x48, 0xff, 0x88, 0x00 }; // Lower 8 bits// tgi_setpalette() array
unsigned char palette[] = {
// green
0x01ef >> 8,
0x0342 >> 8,
0x0435 >> 8,
0x0464 >> 8,
0x0666 >> 8,
0x0796 >> 8,
0x0000 >> 8,
0x065a >> 8,
0x0888 >> 8,
0x09b8 >> 8,
0x098d >> 8,
0x0ad8 >> 8,
0x0cdb >> 8,
0x0efc >> 8,
0x0ffe >> 8,
0x0122 >> 8,// blue + red
0x01ef & 0xff,
0x0342 & 0xff,
0x0435 & 0xff,
0x0464 & 0xff,
0x0666 & 0xff,
0x0796 & 0xff,
0x0000 & 0xff,
0x065a & 0xff,
0x0888 & 0xff,
0x09b8 & 0xff,
0x098d & 0xff,
0x0ad8 & 0xff,
0x0cdb & 0xff,
0x0efc & 0xff,
0x0ffe & 0xff,
0x0122 & 0xff,
}; -
AuthorPosts
- You must be logged in to reply to this topic.