You are not advised to call the native method in the game engine to change the frame rate for a quick game. You are advised to use the qg.setPreferredFramesPerSecond API provided by Huawei to change the frame rate.
No. This object is a built-in object of Huawei Quick App Engine. After being packaged into an RPK, the game can run directly in Huawei Quick App Engine instead of browsers.
Files are stored in different paths before and after sign-in. You are advised to perform operations on files after sign-in. Otherwise, target files may not be found.
When FileSystemManager.readFile is used to read files, if encoding is set to binary or not specified, and the returned data is of the ArrayBuffer type, the returned data cannot be directly printed in logs or converted using json.stringify. If encoding is set to utf8, you can use json.stringify to convert data and print it in logs.
Set the input parameter dirPath to the user directory path without a slash (/) as the suffix.
If the source file used for calling the API is a temporary file, it cannot be cached. You need to call the FileSystemManager.saveFile API to save the temporary file to the local host, and then call the copyFile API to cache the file.
You should pass the URI in the response of the saveFile API to the source file path in the copyFile API.
The sample code is as follows:
var fileSystemManager = qg.getFileSystemManager();
var savedFilePath = '',
fileSystemManager.saveFile({
tempFilePath: 'temp file path',
filePath: 'target file path',
success : function(res) {
console.log("saveFile success res = " + JSON.stringify(res));
savedFilePath = res;
},
fail : function(data) {
console.log("saveFile fail " + JSON.stringify(data));
},
complete : function() {
console.log("saveFile complete" );
}
})
fileSystemManager.copyFile({
srcPath : 'savedFilePath', // Source file path. Set this parameter to the success callback address of the saveFile function.
destPath : 'target path',
success : function() {
console.log("copy success" );
},
fail : function(data) {
console.log("copy fail " + JSON.stringify(data));
},
complete : function() {
console.log("copy complete" );
}
}) The maximum size of the local data cache is 10 MB, and the maximum size of data that can be stored in the cache at a time is 1 MB. If the size exceeds 1 MB, the preceding error is reported. You are advised to control the size of data that can be cached at a time.
No. Currently, you can preset the screen orientation by setting the orientation attribute in the manifest file. The options are as follows: