0

I'm new to Cocos2d-HTML5, but think I'm getting the basics well enough. However, while following this tutorial, I'm hitting a weird snag. Since I'm using Cocos2d-HTML5 v2.2.1, I updated the cocos2dApp class declaration as described in the comment section, and everything works fine.

But when I try to remove the FPS counter by using director.setDisplayStats(false), or just commenting out the director.setDisplayStats(true) line, the canvas goes totally black. The code is still running; console.log() statements added to the sprite objects are still getting called every frame. Also strange: adding a call to director.setDisplayStats(false) during a frame update does not result in a blank canvas.

So my question is, by leaving out setDisplayStats or setting it to false, am I somehow messing up the scene's layers or something? I've tried tracing my way through how the code is executed after that statement, and haven't found anything obvious yet.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
smashuu
  • 193
  • 1
  • 7

1 Answers1

0

I change (in ccConfig.h)

#define CC_ENABLE_GL_STATE_CACHE 1

to

#define CC_ENABLE_GL_STATE_CACHE 0

It helps me to avoid the crash.

maslovsa
  • 1,589
  • 1
  • 14
  • 15
  • I'm assuming that's for the C++ version, not HTML5. The JS equivalent appears to be cc.ENABLE_GL_STATE_CACHE, but setting a value of 0 (or false) in my config section did not make any difference, unfortunately. – smashuu Jan 16 '14 at 18:00