引擎初始化过程

1.加载js

CC.loadjs = function(filename)

{

    //add the file to the que

    var script = CC.$new('script');

    script.src = CC.CCDir + filename;

    script.order = CC.loadQue.length;

    CC.loadQue.push(script);



    script.onload = function()

    {

        //file have finished loading,

        //if there is more file to load, we should put the next file on the head

        if(this.order+1 < CC.loadQue.length)

        {

            CC.$('head').appendChild(CC.loadQue[this.order+1]);

        }

        else

        {

            //we are ready to run the game

            CC.AppController.didFinishLaunchingWithOptions();

        }

    };

    if(script.order === 0)//if the first file to load, then we put it on the head

    {

        CC.$('head').appendChild(script);

    }

};


2. 加载成功之后,调用CC.AppController.didFinishLaunchingWithOptions();

3. 开始加载AppDelegate,初始化运行Director,canvas。设置帧率和引擎参数。

4. 创建出具体的scene,并加入Director。

5. 开始主循环的loop。 

 

先记录这么多,再补充更关键实现方法。 

posted on 2012-03-08 21:00  SeanLin  阅读(386)  评论(0编辑  收藏  举报

导航