Optimizations for OPPO devices
Note: This document applies to Cocos2d-x 3.17.2 and later only. Cocos2d-x has a few optimizations for OPPO devices. These optimizations will only work on OPPO devices (specially Reno devices).
There are two places that are optimized:
- loading a scene
- engine's internal shaders compiling
Loading scene optimizations start when
Scene is created, and ended in
Scene::onEnter() and therefore you should create resources between them.
Invoke optimization codes manually
The application knows where more power is needed, better than the engine knows. You can invoke this API to get more power when needed. You can invoke this API in both C++ or Java.
Example usage in C++
// Notify device that an event happends, such as start loading a scene. // It is available after v3.17.2. DataManager::setOptimise(const string&, const string&); // Scene loading starts, need more power. DataManager::onSceneLoaderBegin(); // Scene loading ends. DataManager::onSceneLoaderEnd(); // Shader compiling begin, need more power. DataManager::onShaderLoaderBegin(); // Shader compiling ends. DataManager::onShaderLoaderEnd();
Example usage in Java:
Cocos2dxDataManager::setOptimise(String thing, float value);
Table Of Values
After v3.17.2, the type of
value changed from
string to make it more usable.