如何在 LibGdx 中缩放标签
问题描述
我正在尝试为我的游戏编写 HUD,但我不知道如何正确缩放标签我正在使用此代码:
i am trying to code a HUD for my game but i cannot figure out how to scale a Label properly I am using this code:
HP 标签在屏幕上很大.我尝试在标签和桌子上使用 setScale 无济于事.任何帮助表示赞赏!谢谢
The HP tag is enormous on the screen. I tried using setScale on the label and on the table to no avail. Any help is appreciated! Thanks
这是当前屏幕的图片https://gyazo.com/57c190a9d7516bb8b2256bf1a7d17b4c
推荐答案
只需将标签添加到组,然后将比例应用于组.
Simply add the Label to a Group then apply the scale to the group.
我只在动画中缩放带有标签的组,在动画结束时缩放为 1.不应缩放字体,因为它看起来像素化.比如一个简单的放大缩小动画:
I only scale Groups with Labels in animations where at the end of the animation the scale is 1. One should not scale fonts, because it looks pixelated. For example, a simple scale up scale down animation:
这篇关于如何在 LibGdx 中缩放标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!