AndEngine Most important concepts

In this article, I will try to cover description, of the most important engine concepts. Brief information, such as description of most frequently used classes and their extensions.
1. AndEngine - Core Terminology (by  Nicolas Gramlich + updates and addons)

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. You can use also subclasses:
  • LimitedFPSEngine - tries to achieve a specific amount of updates per second.


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.
  • RatioResolutionPolicy - keep everything scaled in in proper ratio (disadvantage - black lines might occur)
  • FillResolutionPolicy - fill whole resolution (disadvantage - images might be stretched)

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. There are subclasses with more functions, example:
  • BoundCamera - you might specify bounds for your scene.
  • ZoomCamera - you might enable zooming, pinch zoom, and scrolling 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.
  • HUD - usage for example for score (it has to be all the time in the same position, follow camera changes)

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.
  • Sprite - entity with texture
  • TiledSprite - entity with tiled texture, you may switch between tiles.
  • AnimatedSprite - extension of the TiledSprite, you may animate tiles in specified intervals.

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 (in latest GLES2 this rule  is not required, so its really useful to reduce memory usage) Therefore AndEngine assembles a Texture from a couple of ITextureSources, so the space can be used better.

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.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风口猪炒股指标

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值