The International Simutrans Forum

 

Author Topic: [GUI] Contrast in counter for convoy size in depots  (Read 594 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1613
    • Simutrans-BLOG
  • Languages: ES
[GUI] Contrast in counter for convoy size in depots
« 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:
Code: [Select]
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:
« Last Edit: September 02, 2020, 06:57:57 AM by Yona-TYT »

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1613
    • Simutrans-BLOG
  • Languages: ES
Re: Contrast in counter for convoy size in depots
« Reply #1 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
Code: [Select]
            // 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);
            }