zoukankan      html  css  js  c++  java
  • 转 降频的时候处理方法

    /**
     * EnterFrame事件处理
     */
    private var frameRate:uint = stage.frameRate;
    private var halfRate:uint = frameRate >> 1;
    private var intervalTime:uint = 1000/frameRate;
    private var deltaTime:Number = 0;
    private var lastTime:uint = 0;
    private function enterFrame(e:Event):void
    {
         //计算实际帧频
        var nowTime:uint = getTimer();
          deltaTime = nowTime - lastTime;
          lastTime= nowTime;
          var realFrame:uint = uint(1000/deltaTime);//上一帧的实际帧频
        if(realFrame >= halfRate){
            gameLoop();
          }else{
            //flashplayer最小化后要做的事
            trace('浏览器最小化了');
            /** 补帧 */
            var tweenFrames:uint = frameRate/realFrame;
            for(var i:uint=0; i<tweenFrames; i++){
                   gameLoop();
            }
          }
    }

    事实上,没有什么要比发现、培养、呵护、调整自己的心智的力量更重要的事情了.........

  • 相关阅读:
    游吟诗人阿严
    学霸女
    sql group by 分组后查询最新的一条数据
    腐朽
    我喜欢不说话的山川
    redis启动
    php 时间轴,数据统计(最近7天的数据)
    php options 请求跨域
    mac关机声音
    JVM-内存模型
  • 原文地址:https://www.cnblogs.com/appleseed/p/1954170.html
Copyright © 2011-2022 走看看