zoukankan      html  css  js  c++  java
  • Cocos2dx报OpenGL error 0x0506错误

    近期做第三方sdk接入时,发现iOS8系统下,进行银联充值后,返回游戏有很大几率会报 
    OpenGL error 0x0506............ 
    之类的绘制问题,游戏卡死,花了很长时间,一直没有头绪 

    最终找到这篇文章: 
    http://blog.lessfun.com/blog/2014/09/24/ios8-issue-keyboard-orientation-and-idletimerdisabled-not-working/ 

    原来后台运行的app,是不允许进行openGL绘制的,而且iOS8要求更严格 

    好吧,切换到RootViewController.mm,加上这两个方法: 

    Mix代码  收藏代码
    1. - (void)viewWillDisappear:(BOOL)animated  
    2. {  
    3.     [super viewWillDisappear:animated];  
    4.     cocos2d::CCApplication::sharedApplication()->applicationDidEnterBackground();  
    5. }  
    6.   
    7. - (void)viewWillAppear:(BOOL)animated  
    8. {  
    9.     [super viewWillAppear:animated];  
    10.     cocos2d::CCApplication::sharedApplication()->applicationWillEnterForeground();  
    11. }  



    applicationDidEnterBackground主要是在切到后台时做这些: 

    C++代码  收藏代码
    1. CCDirector::sharedDirector()->stopAnimation();  
    2. SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();  
    3. SimpleAudioEngine::sharedEngine()->pauseAllEffects();  



    applicationWillEnterForeground是切回前台,做这些: 

    C++代码  收藏代码
      1. CCDirector::sharedDirector()->startAnimation();  
      2. SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();  
      3. SimpleAudioEngine::sharedEngine()->resumeAllEffects();  
  • 相关阅读:
    部分类Partial
    Ajax之XMLHttpRequest
    C#结构(Struct)
    sql数据管理语句
    mysql基本语句
    bootstrap插件-滚动监听
    一轮项目学习总结
    js滚动监听
    Ajax
    各框架、插件记录
  • 原文地址:https://www.cnblogs.com/Xujg/p/5660772.html
Copyright © 2011-2022 走看看