Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically scale overmap legend width #36662

Merged
merged 1 commit into from
Jan 4, 2020
Merged

Dynamically scale overmap legend width #36662

merged 1 commit into from
Jan 4, 2020

Conversation

Night-Pryanik
Copy link
Contributor

Summary

SUMMARY: Interface "Dynamic overmap legend width."

Purpose of change

Current overmap legend width is fixed to 28 symbols, which is very low and isn't enough for long descriptions. This is especially bad for high-resolution monitors since there is a lot of free space to fit long texts.

Describe the solution

Made overmap legend width scale dynamically based on size of terminal. Its width now is one-fifth of the terminal size, clamped to be no less than 28 and no more than 55 symbols.

Describe alternatives you've considered

Use folding for all strings where it should be considered appropriate, but it cures the symptoms, not the cause of the problem.

Testing

Started game, opened overmap, checked for overmap legend width.

Additional context

Before (in Russian). Russian translation is longer than the original text, so it is overlapped to the next string
изображение

After (clamped to max of 55 symbols on my resolution)
изображение

@Night-Pryanik Night-Pryanik added <Enhancement / Feature> New features, or enhancements on existing Info / User Interface Game - player communication, menus, etc. labels Jan 3, 2020
@kevingranade kevingranade merged commit a758fa6 into CleverRaven:master Jan 4, 2020
@Night-Pryanik Night-Pryanik deleted the dynamic-overmap-legend-width branch January 4, 2020 04:20
@GGgatherer
Copy link
Contributor

I guess this is what broke my overmap legend :)
cataclysm-tiles_2020_01_04_11_22_39_157
Hotkeys still work, though.

  • OS: Windows 7 x64
  • Game Version: 0.D-10984-ged9e547 [64-bit]
  • Graphics Version: Tiles
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Modular Turrets [modular_turrets],
    Salvaged Robots [Salvaged_Robots],
    Alternative Map Key [alt_map_key],
    sees-player icon, retrodays [sees_player_retro],
    Stats Through Skills [StatsThroughSkills]
    ]

@Night-Pryanik
Copy link
Contributor Author

Did you resize the game window?

@GGgatherer
Copy link
Contributor

GGgatherer commented Jan 4, 2020

No, I play in borderless windowed mode, no scaling, 192x54 terminal(according to the game it equals 1920x1080, my display native resolution).

@ZhilkinSerg
Copy link
Contributor

Font settings?

@Lamandus
Copy link
Contributor

Lamandus commented Jan 4, 2020

same for me. Fonts are own settings and this will cause the error.
For me:
{
"typeface": [ "Atari", "unifont" ],
"map_typeface": "unifont",
"overmap_typeface": "map_font_LARWICK.png"
}

@anothersimulacrum
Copy link
Member

Did you change fontsize? I triggered this with just a different font size (10x10, instead of 8x16).

@Lamandus
Copy link
Contributor

Lamandus commented Jan 4, 2020

reverted back to the old font size resolves the issue, true, but the map mod is now not working correctly of course.

grafik

@Lamandus
Copy link
Contributor

Lamandus commented Jan 4, 2020

grafik
my standard setting.
Interestingly enough, when setting to 10x10 it just shows the city name, nothing else:
grafik

@GGgatherer
Copy link
Contributor

my fonts.json:

{
 "fontblending": true,
 "fontwidth": 16,
 "fontheight": 32,
 "fontsize": 32,
 "typeface": "Consolas Bold",
 "map_fontwidth": 16,
 "map_fontheight": 32,
 "map_fontsize": 32,
 "map_typeface": "Consolas Bold",
 "overmap_typeface": "unifont"
}

So yeah, different font size from default.

@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/no-sidebar-in-overmap-screen/22394/2

@@ -518,7 +518,7 @@ void game::init_ui( const bool resized )
/**
* Doing the same thing as above for the overmap
*/
static const int OVERMAP_LEGEND_WIDTH = 28;
OVERMAP_LEGEND_WIDTH = clamp( TERMX / 5, 28, 55 );
OVERMAP_WINDOW_HEIGHT = TERMY;
OVERMAP_WINDOW_WIDTH = TERMX - OVERMAP_LEGEND_WIDTH;
to_overmap_font_dimension( OVERMAP_WINDOW_WIDTH, OVERMAP_WINDOW_HEIGHT );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overmap window can have a different w´font than the rest of the game windows. Have you checked what happens when the overmap font is much larger and what if it the font is much smaller? I assume it's possible the overmap window itself overlays the legend window. Or the legend window is just too much to the left, so it's under the overmap window.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked what happens when the overmap font is much larger and what if it the font is much smaller?

No, I tested it only on default font dimensions.

@doktorstick
Copy link

Same problem. Adding my info here as I have a 16:10 screen (2560x1600).

Settings:
image

Font:

{
       "fontblending": true,
       "fontwidth": 12,
       "fontheight": 24,
       "fontsize": 24,
       "typeface": ["Consolas Bold", "unifont"],
       "map_fontwidth": 12,
       "map_fontheight": 24,
       "map_fontsize": 24,
       "map_typeface": "Consolas Bold",
       "overmap_fontwidth": 22,
       "overmap_fontheight": 22,
       "overmap_fontsize": 22,
       "overmap_typeface": "whitrabt"
}

@AdonaiJr
Copy link

AdonaiJr commented Jan 9, 2020

Same here. 1920x1080, overmap fontsizes 10x10x10. I can see only a litte bit of the legend window on the bottom of the screen. Looks like in my case happened what BevapDin said: "Or the legend window is just too much to the left, so it's under the overmap window".

@doktorstick
Copy link

Since this new feature broke the overmap for non-default players, would you please revert these changes until a proper fix can be made?

@anothersimulacrum
Copy link
Member

No need to revert it, #36879 will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Enhancement / Feature> New features, or enhancements on existing Info / User Interface Game - player communication, menus, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants