1/* 2* Copyright (c) 2022 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 20 } 21 static ReSize(w, h) { 22 Scr.width = w; 23 Scr.height = h; 24 if (Scr.keeplogicworh == "width") 25 Scr.logich = Scr.logicw * h / w 26 else 27 Scr.logicw = Scr.logich * w / h 28 } 29 static setLogicScreenSize(w, h) { 30 if (Scr.logicw == w && Scr.width == w && Scr.logich == h && Scr.height == h) return; 31 Scr.logicw = w 32 Scr.logich = h 33 Scr.width = w 34 Scr.height = h 35 NapiLog.logError("setLogicScreenSize") 36 if ("undefined" != typeof wx) { 37 var info = wx.getSystemInfoSync(); 38 Scr.width = info.windowWidth; 39 Scr.height = info.windowHeight; 40 } 41 } 42} 43 44Scr.width = 320 45Scr.height = 240 46Scr.keeplogicworh = "height" 47Scr.logicw = 320 48Scr.logich = 240 49Scr.fps = 60 50 51 52 53 54