Changeset - r28213:6eeb72755168
[Not reviewed]
master
0 2 0
Peter Nelson - 12 months ago 2023-11-30 19:18:28
peter1138@openttd.org
Change: Add extra padding to climate buttons to match pre-#11464. (#11525)

Padding used to be included in the SetMinimalSize() part which was removed, but also made it require specific sprite sizes.

This now adds padding on the already determined size, removing the need for hardcoding pixel dimensions and allowing the sprites to be any size.
2 files changed with 23 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/genworld_gui.cpp
Show inline comments
 
@@ -575,6 +575,12 @@ struct GenerateLandscapeWindow : public 
 
		Dimension d{0, (uint)GetCharacterHeight(FS_NORMAL)};
 
		const StringID *strs = nullptr;
 
		switch (widget) {
 
			case WID_GL_TEMPERATE: case WID_GL_ARCTIC:
 
			case WID_GL_TROPICAL: case WID_GL_TOYLAND:
 
				size->width += WidgetDimensions::scaled.fullbevel.Horizontal();
 
				size->height += WidgetDimensions::scaled.fullbevel.Vertical();
 
				break;
 

	
 
			case WID_GL_HEIGHTMAP_HEIGHT_TEXT:
 
				SetDParam(0, MAX_TILE_HEIGHT);
 
				d = GetStringBoundingBox(STR_JUST_INT);
 
@@ -1118,6 +1124,12 @@ struct CreateScenarioWindow : public Win
 
	{
 
		StringID str = STR_JUST_INT;
 
		switch (widget) {
 
			case WID_CS_TEMPERATE: case WID_CS_ARCTIC:
 
			case WID_CS_TROPICAL: case WID_CS_TOYLAND:
 
				size->width += WidgetDimensions::scaled.fullbevel.Horizontal();
 
				size->height += WidgetDimensions::scaled.fullbevel.Vertical();
 
				break;
 

	
 
			case WID_CS_START_DATE_TEXT:
 
				SetDParam(0, TimerGameCalendar::ConvertYMDToDate(CalendarTime::MAX_YEAR, 0, 1));
 
				str = STR_JUST_DATE_LONG;
src/intro_gui.cpp
Show inline comments
 
@@ -297,6 +297,17 @@ struct SelectGameWindow : public Window 
 
		}
 
	}
 

	
 
	void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
 
	{
 
		switch (widget) {
 
			case WID_SGI_TEMPERATE_LANDSCAPE: case WID_SGI_ARCTIC_LANDSCAPE:
 
			case WID_SGI_TROPIC_LANDSCAPE: case WID_SGI_TOYLAND_LANDSCAPE:
 
				size->width += WidgetDimensions::scaled.fullbevel.Horizontal();
 
				size->height += WidgetDimensions::scaled.fullbevel.Vertical();
 
				break;
 
		}
 
	}
 

	
 
	void OnResize() override
 
	{
 
		bool changed = false;
0 comments (0 inline, 0 general)