andengine学习笔记

非常有道理的一篇文章

http://papermashup.com/steps-to-learning-a-new-programming-language/

 

BaseGameActivity:
The BaseGameActivity is the root of a game, that contains an Engine and manages to create a SurfaceView the contents of the Engine will be drawn into. There is always exactly one Engine for one BaseGameActivity. You can proceed from one BaseGameActivity to another using common Android mechanisms.

BaseGameActivety是游戏的根,包含一个引擎和负责生成画图的视图,如果您想正常使用AndEngine,那么当前Activity就必须继承自BaseGameActivity或其子类,否则你连初始化Engine也做不到。虽然它还有父类BaseActivity,但BaseActivity只提供了一些异步加载方法而无关AndEngine的主体实现。因此,BaseGameActivity就是实际上的AndEngine最基础用类无疑。


Engine:
The Engine make the game proceed in small discrete steps of time. The Engine manages to synchronize a periodic drawing and updating of the Scene, which contains all the content that your game is currently handling actively. There usually is one Scene per Engine, except for the SplitScreenEngines.

引擎使游戏处理时间,引擎管理同步

 



IResolutionPolicy:
An implementation of the IResolutionPolicy interface is part of the EngineOptions. It tells AndEngine how to deal with the different screen-sizes of different devices. I.e. RatioResolutionPolicy will maximize the SurfaceView to the limiting size of the screen, while keeping a specific ratio. That means objects won't be distorted while the SurfaceView has the maximum size possible.

Camera:
A Camera defines the rectangle of the scene that is drawn on the screen, as not the whole scene is visible all the time. Usually there is one Camera per Scene, except for the SplitScreenEngines. There are subclasses that allow zooming and smooth position changes of the Camera.


Scene:
The Scene class is the root container for all objects to be drawn on the screen. A Scene has a specific amount of Layers, which themselves can contain a (fixed or dynamic) amount of Entities. There are subclasses, like the CameraScene/HUD/MenuScene that are drawing themselves to the same position of the Scene no matter where the camera is positioned to.

Entity:
An Entitiy is an object that can be drawn, like Sprites, Rectangles, Text or Lines. An Entity has a position/rotation/scale/color/etc...

Texture:
A Texture is a 'image' in the memory of the graphics chip. On Android the width and height of a Texture has to be a power of 2. Therefore AndEngine assembles a Texture from a couple of ITextureSources, so the space can be used better.

ITextureSource:
An implmentation of the ITextureSource-interface like AssetTextureSource manages to load an image onto a specific position in the Texture.

TextureRegion:
A TextureRegion defines a rectangle on the Texture. A TextureRegion is used by Sprites to let the system know what part of the big Texture the Sprite is showing.

PhysicsConnector:
A PhysicsConnector manages to update the AndEngine-Shapes (like Rectangles/Sprites/etc...) when their physics representations "bodies" change. Once using Physics (and a PhysicsConnector) with an AndEngine-Shape you'd disable the Physics calculated by AndEngine itself, by calling setUpdatePhysics(false) to the Shape. Changes made to the AndEngine-Shape are not reflected in the Physics - you have to call the methods on the Body object you have used to create the PhysicsConnector

  • andengine的动画是更加纹理区域大小(Textture)和纹理区域的帧数设置数目createTiledFromAsset(行数和列数)然后来确定每帧的范围,所以在做sprite的动画时要算好每帧的尺寸,
  • .assets和res资源的不同: 在assets中保存的文件一般是原生的文件,通常很少用到,例如一个MP3文件,Android程序不能直接访问,必须通过AssetManager类以二进制流的形式来读取。而Res文件夹中的资源可以通过R资源类直接访问,经常使用。同样在res文件夹下还有一个文件夹raw也是用来存放原生文件的。
  •     在android中使用Asset或者res/raw时都要经过Asset Manager,使用这两种资源提供方式时,必须要注意文件大小。经过调试发 现,Asset或者res/raw中的资源文件的UNCOMPRESS_DATA_MAX取值为1048576字节,也就是最大为未压缩1MB。否则会在logcat下看到获取到Debug类型的信息,04-09 02:48:51.220: DEBUG/asset(10734): Data exceeds UNCOMPRESS_DATA_MAX (1905341 vs 1048576)可以看到接下产生了一个系统的错误,System.err,会发生java.io.IOException的异常






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值