新增Time/String/Array/Keyboard/Random/Object/Texture辅助类

This commit is contained in:
yhh
2020-07-17 14:34:42 +08:00
parent e686ba64d7
commit c96e8b3a04
18 changed files with 7173 additions and 92 deletions

View File

@@ -1,33 +1,27 @@
class GraphicsCapabilities {
public supportsTextureFilterAnisotropic: boolean;
public supportsNonPowerOfTwo: boolean;
public supportsDepth24: boolean;
public supportsPackedDepthStencil: boolean;
public supportsDepthNonLinear: boolean;
public supportsTextureMaxLevel: boolean;
public supportsS3tc: boolean;
public supportsDxt1: boolean;
public supportsPvrtc: boolean;
public supportsAtitc: boolean;
public supportsFramebufferObjectARB: boolean;
class GraphicsCapabilities extends egret.Capabilities {
public initialize(device: GraphicsDevice){
this.platformInitialize(device);
}
private platformInitialize(device: GraphicsDevice){
let gl: WebGLRenderingContext = new egret.sys.RenderBuffer().context.getInstance();
this.supportsNonPowerOfTwo = false;
this.supportsTextureFilterAnisotropic = gl.getExtension("EXT_texture_filter_anisotropic") != null;
this.supportsDepth24 = true;
this.supportsPackedDepthStencil = true;
this.supportsDepthNonLinear = false;
this.supportsTextureMaxLevel = true;
this.supportsS3tc = gl.getExtension("WEBGL_compressed_texture_s3tc") != null ||
gl.getExtension("WEBGL_compressed_texture_s3tc_srgb") != null;
this.supportsDxt1 = this.supportsS3tc;
this.supportsPvrtc = false;
this.supportsAtitc = gl.getExtension("WEBGL_compressed_texture_astc") != null;
this.supportsFramebufferObjectARB = false;
let capabilities = this;
capabilities["isMobile"] = true;
let systemInfo = wx.getSystemInfoSync();
let systemStr = systemInfo.system.toLowerCase();
if (systemStr.indexOf("ios") > -1){
capabilities["os"] = "iOS";
} else if(systemStr.indexOf("android") > -1){
capabilities["os"] = "Android";
}
let language = systemInfo.language;
if (language.indexOf('zh') > -1){
language = "zh-CN";
} else {
language = "en-US";
}
capabilities["language"] = language;
}
}