mirror of https://github.com/axmolengine/axmol.git
add a macro to stip fps related data and functions (#17934)
This commit is contained in:
parent
78d5a809c8
commit
3e912ffee3
|
@ -337,7 +337,9 @@ void Director::drawScene()
|
|||
|
||||
if (_displayStats)
|
||||
{
|
||||
#if !CC_STRIP_FPS
|
||||
showStats();
|
||||
#endif
|
||||
}
|
||||
|
||||
_renderer->render();
|
||||
|
@ -356,7 +358,9 @@ void Director::drawScene()
|
|||
|
||||
if (_displayStats)
|
||||
{
|
||||
#if !CC_STRIP_FPS
|
||||
calculateMPF();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1257,6 +1261,8 @@ void Director::updateFrameRate()
|
|||
_frameRate = 1.0f / _deltaTime;
|
||||
}
|
||||
|
||||
#if !CC_STRIP_FPS
|
||||
|
||||
// display the FPS using a LabelAtlas
|
||||
// updates the FPS every frame
|
||||
void Director::showStats()
|
||||
|
@ -1402,6 +1408,8 @@ void Director::createStatsLabel()
|
|||
_FPSLabel->setPosition(Vec2(0, height_spacing*0)+CC_DIRECTOR_STATS_POSITION);
|
||||
}
|
||||
|
||||
#endif // #if !CC_STRIP_FPS
|
||||
|
||||
void Director::setContentScaleFactor(float scaleFactor)
|
||||
{
|
||||
if (scaleFactor != _contentScaleFactor)
|
||||
|
|
|
@ -593,10 +593,12 @@ protected:
|
|||
void setNextScene();
|
||||
|
||||
void updateFrameRate();
|
||||
#if !CC_STRIP_FPS
|
||||
void showStats();
|
||||
void createStatsLabel();
|
||||
void calculateMPF();
|
||||
void getFPSImageData(unsigned char** datapointer, ssize_t* length);
|
||||
#endif
|
||||
|
||||
/** calculates delta time since last time it was called */
|
||||
void calculateDeltaTime();
|
||||
|
|
|
@ -398,4 +398,11 @@ THE SOFTWARE.
|
|||
# define CC_ENABLE_PREMULTIPLIED_ALPHA 1
|
||||
#endif
|
||||
|
||||
/** @def CC_STRIP_FPS
|
||||
* Whether to strip FPS related data and functions, such as cc_fps_images_png
|
||||
*/
|
||||
#ifndef CC_STRIP_FPS
|
||||
#define CC_STRIP_FPS 0
|
||||
#endif
|
||||
|
||||
#endif // __CCCONFIG_H__
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "base/ccFPSImages.h"
|
||||
|
||||
#if !CC_STRIP_FPS
|
||||
|
||||
unsigned char cc_fps_images_png[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x03, 0xe7, 0x00, 0x00, 0x00, 0x36,
|
||||
|
@ -2376,3 +2378,5 @@ unsigned int cc_fps_images_len(void)
|
|||
{
|
||||
return sizeof(cc_fps_images_png);
|
||||
}
|
||||
|
||||
#endif // #if !CC_STRIP_FPS
|
||||
|
|
|
@ -23,20 +23,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BASE_CCFPSIMAGES__H
|
||||
#define __BASE_CCFPSIMAGES__H
|
||||
#pragma once
|
||||
|
||||
#include "base/ccConfig.h"
|
||||
|
||||
/// @cond DO_NOT_SHOW
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !CC_STRIP_FPS
|
||||
extern unsigned char cc_fps_images_png[];
|
||||
unsigned int cc_fps_images_len(void);
|
||||
unsigned int cc_fps_images_len();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/// @endcond
|
||||
#endif // __BASE_CCFPSIMAGES__H
|
||||
|
|
Loading…
Reference in New Issue