The International Simutrans Forum

Development => Patches & Projects => Topic started by: Yona-TYT on May 19, 2020, 01:53:58 AM

Title: [GUI] Contrast in counter for convoy size in depots
Post by: Yona-TYT on May 19, 2020, 01:53:58 AM

It occurs to me to use the player color here, but I don't know if it's the best solution:lb_convoi_number.set_color(color_idx_to_rgb(depot->get_owner()->get_player_color1()+env_t::gui_player_color_dark));

There is also the counter for stored (stacked) vehicles, which is a type of white font with black highlights, but I have no idea how to use this type of font I'm afraid.
In the image you see the example:
Title: Re: Contrast in counter for convoy size in depots
Post by: Yona-TYT on September 02, 2020, 06:50:40 AM
Sorry for reviving an old theme, I was researching the code a bit and I found how to show white numbers on a black background to improve the highlight, however it is very difficult for me to implement this I am afraid.

gui_image_list.cc  line 109
            // If necessary, display a number:
            if(idata.count > 0) {
                char text[20];

                sprintf(text, "%d", idata.count);

                // Let's make a black background to ensure visibility
                for(int iy = -3; iy < 0; iy++) {
                    for(int ix = 1; ix < 4; ix++) {
                        display_proportional_clip_rgb(xpos + ix, ypos + iy, text, ALIGN_LEFT, color_idx_to_rgb(COL_BLACK), true);
                    }
                }
                // Display the number white on black
                display_proportional_clip_rgb(xpos + 2, ypos - 2, text, ALIGN_LEFT, color_idx_to_rgb(COL_WHITE), true);
            }