【发布时间】:2014-03-12 12:44:54
【问题描述】:
所以我使用 ligbdx 已经有一段时间了,做这样的事情真的很简单。所以我想要实现的是,当我有一个大纹理时,我想通过给出 x,y(从哪里开始切割)和宽度,高度(切割部分的大小)来获得该纹理的一部分,然后使用它部分作为精灵或任何可以在 andengine 场景中绘制的东西。
在 libgdx 中是这样的:
//loads file from assets into texture
Texture texture = new Texture(Gdx.files.internal("data/texture5.png"));
//cuts a part of it into drawable element
TextureRegion part = new TexureRegion(texture, x, y, width, height);
部分只是我稍后需要在屏幕上绘制的那部分纹理。在 andengine 中做真的很难,以至于在互联网上的任何地方我都找不到 2 小时的搜索答案吗? :)
【问题讨论】: