News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[GUI] Contrast in counter for convoy size in depots

Started by Yona-TYT, May 19, 2020, 01:53:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT


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:

Yona-TYT

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);
            }