Changeset - r26359:5cfea551cd8a
[Not reviewed]
master
0 1 0
Peter Nelson - 21 months ago 2022-09-06 16:46:01
peter1138@openttd.org
Fix: Change duration of news window scroll depending on GUI zoom.
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/news_gui.cpp
Show inline comments
 
@@ -267,6 +267,7 @@ struct NewsWindow : Window {
 
	const NewsItem *ni;   ///< News item to display.
 
	static int duration;  ///< Remaining time for showing the current news message (may only be access while a news item is displayed).
 

	
 
	static const uint TIMER_INTERVAL = 210; ///< Scrolling interval, scaled by line text line height. This value chosen to maintain the 15ms at normal zoom.
 
	GUITimer timer;
 

	
 
	NewsWindow(WindowDesc *desc, const NewsItem *ni) : Window(desc), ni(ni)
 
@@ -278,8 +279,6 @@ struct NewsWindow : Window {
 

	
 
		this->flags |= WF_DISABLE_VP_SCROLL;
 

	
 
		this->timer.SetInterval(15);
 

	
 
		this->CreateNestedTree();
 

	
 
		/* For company news with a face we have a separate headline in param[0] */
 
@@ -323,6 +322,11 @@ struct NewsWindow : Window {
 
		PositionNewsMessage(this);
 
	}
 

	
 
	void OnInit() override
 
	{
 
		this->timer.SetInterval(TIMER_INTERVAL / FONT_HEIGHT_NORMAL);
 
	}
 

	
 
	void DrawNewsBorder(const Rect &r) const
 
	{
 
		GfxFillRect(r.left,  r.top,    r.right, r.bottom, PC_WHITE);
0 comments (0 inline, 0 general)