一、为什么要用自适应矩阵
在UI界面设计过程中,由于每个玩家的屏幕尺寸不相同,为了使游戏界面在任何设备都能达到统一的布局,引入了通过屏幕信息计算出的自适应矩阵
二、原理讲解
比如我们游戏中先设定标准屏的高度和宽度:
public static float desiginWidth = 800.0f; //标准宽度
public static float desiginHeight = 480.0f; //标准高度
1、计算偏移量
计算lux位移距离
float lux = (Screen.width - ConstOfMenu.desiginWidth * Screen.height / ConstOfMenu