How would i set an index of a player's palette, for the color of text?
The player's palette is stored in the palette[16] array.
Thanks.
Set text palette
Moderator: Stef
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Set text palette
You define which palette to use for each sprite. By default it uses the first palette (on the four availables) but you can change attributes of a sprite by using :
where TILE_ATTR is defined as :
Edit:
I did not read correctly, do you mean you want different text color ? with one color per player ?
In this case you need to use different palettes, but text only use the last color (index 15) from the palette so you can build your different player palette so color 15 is the one to display text for this player.
Code: Select all
SPR_setAttribut(&sprites[1], TILE_ATTR(PAL1, FALSE, FALSE, FALSE))
Code: Select all
/**
* \brief
* Encode tile attributes for tilemap data.
*
* \param pal
* Palette index
* \param prio
* Tile priority
* \param flipV
* Vertical flip
* \param flipH
* Horizontal flip
*/
#define TILE_ATTR(pal, prio, flipV, flipH)
I did not read correctly, do you mean you want different text color ? with one color per player ?
In this case you need to use different palettes, but text only use the last color (index 15) from the palette so you can build your different player palette so color 15 is the one to display text for this player.
Re: Set text palette
Yeah, i meant that i want to choose the color index the text is using, from the palettes i placed into the palette array. Say the player's palette is set to PAL1, and i want to get the index where the bright peal color is, to set the text color (example)Stef wrote:You define which palette to use for each sprite. By default it uses the first palette (on the four availables) but you can change attributes of a sprite by using :
where TILE_ATTR is defined as :Code: Select all
SPR_setAttribut(&sprites[1], TILE_ATTR(PAL1, FALSE, FALSE, FALSE))
Edit:Code: Select all
/** * \brief * Encode tile attributes for tilemap data. * * \param pal * Palette index * \param prio * Tile priority * \param flipV * Vertical flip * \param flipH * Horizontal flip */ #define TILE_ATTR(pal, prio, flipV, flipH)
I did not read correctly, do you mean you want different text color ? with one color per player ?
In this case you need to use different palettes, but text only use the last color (index 15) from the palette so you can build your different player palette so color 15 is the one to display text for this player.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Set text palette
You can't really do that. The default SGDK font use color index 15 and then you can select which palette to use (0, 1, 2 or 3). If you want to use another internal color index to display text you need another font. It's why i told you to always put your wanted text color in last index entry of the palette (15) but that mean you can have at max only 4 different text color at once (one per palette).
Re: Set text palette
Oh okay, i understand now. Thanks.Stef wrote:You can't really do that. The default SGDK font use color index 15 and then you can select which palette to use (0, 1, 2 or 3). If you want to use another internal color index to display text you need another font. It's why i told you to always put your wanted text color in last index entry of the palette (15) but that mean you can have at max only 4 different text color at once (one per palette).
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Set text palette
By the way you can have a look on this topic which is related to your question :
viewtopic.php?f=19&t=2134
viewtopic.php?f=19&t=2134