mirror of
				https://github.com/NoelFB/blah.git
				synced 2025-11-04 01:41:34 +08:00 
			
		
		
		
	fixed batcher text bottom/middle vertical align
This commit is contained in:
		@ -784,9 +784,9 @@ void Batch::str(const SpriteFont& font, const String& text, const Vec2& pos, Tex
 | 
				
			|||||||
	if ((align & TextAlign::Top) == TextAlign::Top)
 | 
						if ((align & TextAlign::Top) == TextAlign::Top)
 | 
				
			||||||
		offset.y = font.ascent() + font.descent();
 | 
							offset.y = font.ascent() + font.descent();
 | 
				
			||||||
	else if ((align & TextAlign::Bottom) == TextAlign::Bottom)
 | 
						else if ((align & TextAlign::Bottom) == TextAlign::Bottom)
 | 
				
			||||||
		offset.y = font.ascent() + font.descent() - font.height_of(text);
 | 
							offset.y = font.height() - font.height_of(text);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		offset.y = font.ascent() + font.descent() - font.height_of(text) * 0.5f;
 | 
							offset.y = (font.ascent() + font.descent() + font.height() - font.height_of(text)) * 0.5f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (int i = 0, l = text.length(); i < l; i++)
 | 
						for (int i = 0, l = text.length(); i < l; i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -829,4 +829,4 @@ void Batch::str(const SpriteFont& font, const String& text, const Vec2& pos, Tex
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pop_matrix();
 | 
						pop_matrix();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user