1/*
2 * Copyright (c) 2022-2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16const { NapiLog } = require('./../hcs/NapiLog');
17export class Scr {
18  constructor() {}
19  static ReSize(w, h) {
20    Scr.width = w;
21    Scr.height = h;
22    if (Scr.keeplogicworh === 'width') {
23      Scr.logich = (Scr.logicw * h) / w;
24    } else {
25      Scr.logicw = (Scr.logich * w) / h;
26    }
27  }
28  static setLogicScreenSize(w, h) {
29    if (Scr.logicw === w && Scr.width === w && Scr.logich === h && Scr.height === h) {
30      return;
31    }
32    Scr.logicw = w;
33    Scr.logich = h;
34    Scr.width = w;
35    Scr.height = h;
36    NapiLog.logError('setLogicScreenSize');
37    if ('undefined' !== typeof wx) {
38      var info = wx.getSystemInfoSync();
39      Scr.width = info.windowWidth;
40      Scr.height = info.windowHeight;
41    }
42  }
43}
44
45Scr.width = 320;
46Scr.height = 240;
47Scr.keeplogicworh = 'height';
48Scr.logicw = 320;
49Scr.logich = 240;
50Scr.fps = 60;
51