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.
一个Camera会确定一个画在屏上的矩形的场景,由于整个场景并不是一直可见。通常每个Secene一个Camera,除非splitscreenengines。它允许放大,平滑的变换位置。
继承自BaseGameActivity的子类在onLoadEngine()时一般会初始化一个Camera对象
public Engine onLoadEngine() { this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT); return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera)); }
1.构造方法会生成一个矩形区域
public Camera(final float pX, final float pY, final float pWidth, final float pHeight) { this.mMinX = pX; this.mMaxX = pX + pWidth; this.mMinY = pY; this.mMaxY = pY + pHeight; }
2.从类看 public class Camera implements IUpdateHandler {}
public interface IUpdateHandler { public void onUpdate(final float pSecondsElapsed); public void reset(); }
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.
一个Texture是一个'图片'在内存中的图形片段。在操作系统一个质地的宽度和高度有是2的度。因此andengine集成一个Texture从一对itexturesources,所以空间可以被使用更好。
当继承自BaseGameActivity的类覆写onLoadResources()时
public void onLoadResources() { this.mFontTexture = new Texture(256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.mFont = new Font(this.mFontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32, true, Color.BLACK); this.mEngine.getTextureManager().loadTexture(this.mFontTexture); this.mEngine.getFontManager().loadFont(this.mFont); }
1.构造方法:
/** * @param pWidth must be a power of 2 (i.e. 32, 64, 128, 256, 512, 1024). * @param pHeight must be a power of 2 (i.e. 32, 64, 128, 256, 512, 1024). */ public Texture(final int pWidth, final int pHeight) { this(pWidth, pHeight, TextureOptions.DEFAULT, null); }
2.engine加载Texture
this.mEngine.getTextureManager().loadTexture(this.mFontTexture);
1。更新固件: http://blog.csdn.net/lightsoure