即时通讯新手Android游戏并启动andengine并面临问题,同时使用createTiledFromAsset代码,我的问题是
@Override
public void onLoadResources() {
mBitmapTextureAtlas = new BitmapTextureAtlas(128, 128,
TextureOptions.BILINEAR);
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createTiledFromAsset(this.mBitmapTextureAtlas, this,
"move.png", 0, 0, 10, 1);
mEngine.getTextureManager().loadTexture(mBitmapTextureAtlas);
}
@Override
public Scene onLoadScene() {
mEngine.registerUpdateHandler(new FPSLogger());
mMainScene = new Scene();
mMainScene
.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));
player = new AnimatedSprite(0, 0, mPlayerTextureRegion);
mMainScene.attachChild(player);
return mMainScene;
}
Run Code Online (Sandbox Code Playgroud)
我没有得到错误,因为我的BitmapTextureAtlas是128*128并且来自createTiledFromAsset的每个平铺部分应该是78*85,因为传递给它的参数是1行10列,我的源图像是779*85,这意味着什么时候宽度平铺为10个部分,然后779/10 = 78个近似,这将是每个平铺部分的宽度,因为行是1所以85/1 = 85因此每个平铺部分的宽度*高度将被放置在BitmapTextureAtlas上是78*85而BitmapTextureAtlas本身的大小是128*128那么为什么错误说Supplied pTextureAtlasSource must not exceed bounds of Texture
这里发生了什么...?或者我不了解实际的功能......?如果我错了那么createTiledFromAsset的过程如何工作........?
| 归档时间: |
|
| 查看次数: |
4074 次 |
| 最近记录: |