Southclaws / progress2

A SA:MP UI library for rendering progress bars used to visualise all manner of data from health to a countdown timer.
67 stars 64 forks source link

Gradient and leveled bars #15

Open Crayder opened 8 years ago

Crayder commented 8 years ago

Two suggestions:

  1. Gradient bars. Function that gives input of up to 10 colors and each color's level. You will make the gradient where each color is full at its level.
  2. Leveled bars. Same as the first suggestion, but the color just switches at once.
Southclaws commented 8 years ago

Shouldn't be too hard, I'll try and get this in the next update, thanks!

Crayder commented 8 years ago

Yeah, I actually have the gradient code basically. It's simple stuff though.

Crayder commented 8 years ago
enum
{
    BAR_COLOUR_MODE_SINGLE = 1,
    BAR_COLOUR_MODE_LEVELED,
    BAR_COLOUR_MODE_GRADIENT
}

pbar_colourMode

// pbar_colourMode
stock GetPlayerProgressBarColourMode(playerid, PlayerBar:barid)
{
    if(!IsValidPlayerProgressBar(playerid, barid))
        return 0;

    return pbar_Data[playerid][_:barid][pbar_colourMode];
}

stock SetPlayerProgressBarDirection(playerid, PlayerBar:barid, mode)
{
    if(!IsValidPlayerProgressBar(playerid, barid))
        return 0;

    pbar_Data[playerid][_:barid][pbar_colourMode] = mode;

    _RenderBar(playerid, _:barid);

    return 1;
}

This is what I've done in the past 5 minutes... planned on doing more but leaving... xD