AndEngine引擎的生命周期
来源:互联网 发布:网络平台建设 编辑:程序博客网 时间:2024/05/16 05:42
在下面的图中,可以看到游戏在创建、最小化、销毁的时间
AndEngine引擎包含一些的方法,用来创建EngineOptions对象、Scene对象和用子实体来填充Scene。这些方法按照一下顺序被调用:
1)定义onCreateEngineOptions()方法
mCamera = new Camera(0, 0, WIDHT, HEIGHT);//Declare & Define our engine options to be applied to our//Engine objectEngineOptions engineOptions = new EngineOptions(true,ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(),mCamera);//It is necessary in a lot of applications to define the following wake lock options // in order to disable the device's display from turning off during gameplay due to
//inactivityengineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);// Return the engineOptions object, passing it to the enginereturn engineOptions;2、定义onCreateResources()方法
@Overridepublic void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback)throws Exception {// We should notify the pOnCreateResourcesCallback that we've finished//loading all of the necessary resources in our game AFTER they are loaded.//onCreateResourcesFinished() should be the last method called. pOnCreateResourcesCallback.onCreateResourcesFinished();}3、定义onCreateScene()方法
@Overridepublic void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback)throws Exception {// Create the Scene objectfinal Scene mScene = new Scene();// Notify the callback that we're finished creating the scene,// returning mScene to the mEngine object (handled automatically)pOnCreateSceneCallback.onCreateSceneFinished(mScene);}
4、定义onPopulateScene()方法
@Overridepublic void onPopulateScene(Scene pScene,OnPopulateSceneCallback pOnPopulateSceneCallback) throws Exception {// onPopulateSceneFinished(), similar to the resource and scene//callback methods, should be called once we are finished populating the scene.pOnPopulateSceneCallback.onPopulateSceneFinished();}在启动期间生命周期如下:
- AndEngine引擎的生命周期
- AndEngine引擎生命周期
- AndEngine游戏引擎之【生命周期】
- AndEngine游戏引擎之【生命周期】
- AndEngine引擎的配置
- AndEngine引擎的学习笔记(一)
- AndEngine引擎的学习笔记(二)
- AndEngine引擎的学习笔记(三)
- andengine引擎下detachChild的问题
- AndEngine游戏结构生命周期
- android游戏引擎 andengine
- Android AndEngine引擎运用
- AndEngine游戏引擎简介
- AndEngine引擎运行原理
- 游戏引擎Andengine总结(三):AndEngine与Android的粘合点
- ANDROID游戏引擎ANDENGINE的常用模块介绍
- android游戏引擎andengine学习系列二:简单的例子
- 游戏引擎Andengine总结(五):TexturePacker的使用
- 内存分配知识(全局,局部,静态变量)
- hdu2833
- jadclipse反编译时出现异常
- 放下我执
- selenium 初学一
- AndEngine引擎的生命周期
- Android源码编译问题汇总
- Github上README.md介绍
- Linux 命令点滴积累
- 最佳vim技巧
- flex表格---(1)单元格设置tooltip、
- grub2
- 怎样将结构完全一样的两个表的内容合并到一个表中,SQL语句
- 保持文件系统的完整性