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('../ir/NapiLog'); 17export class Scr { 18 constructor() {} 19 static ReSize(w, h) { 20 Scr.width = w; 21 Scr.height = h; 22 if (Scr.keeplogicworh == 'width') Scr.logich = (Scr.logicw * h) / w; 23 else Scr.logicw = (Scr.logich * w) / h; 24 } 25 static setLogicScreenSize(w, h) { 26 if (Scr.logicw == w && Scr.width == w && Scr.logich == h && Scr.height == h) 27 return; 28 Scr.logicw = w; 29 Scr.logich = h; 30 Scr.width = w; 31 Scr.height = h; 32 33 if ('undefined' != typeof wx) { 34 var info = wx.getSystemInfoSync(); 35 Scr.width = info.windowWidth; 36 Scr.height = info.windowHeight; 37 } 38 } 39} 40 41Scr.width = 320; 42Scr.height = 240; 43Scr.keeplogicworh = 'height'; 44Scr.logicw = 320; 45Scr.logich = 240; 46Scr.fps = 60; 47