int designWidth = 1334;
int designHeight = 750;
int designRadio = designWidth / designHeight;
int ScreenWidth = 当前屏幕的宽;
int ScreenHeight = 当前屏幕的长;
int ScreenRadio = ScreenWidth / ScreenHeight;
int CanvasWidth = 0;
int CanvasHeight = 0;
if (ScreenRadio > designRadio)
{
CanvasWidth = designHeight * ScreenRadio;
CanvasHeight = designHeight;
}
else
{
CanvasWidth = designWidth;
CanvasHeight = designWidth / ScreenRadio;
}
int ZoomRadio = CanvasWidth / CanvasHeight; // Canvas与屏幕的缩放比
伪代码记录,之后更加了解之后再详细记录