在Andengine中将图像作为Sprite加载

Jaw*_*jad 2 android sprite andengine

我搜索了所有论坛,但我无法获得任何正常工作的代码.我想从SD卡和引擎加载图像作为精灵.任何人都可以为我提供代码吗?我在用

    File imageFile = new File("/path/to/image");
    BitmapTextureAtlas texture = new BitmapTextureAtlas(width , height , TextureOptions.DEFAULT);
    ITextureSource fileTextureSource = new FileTextureSource(imageFile);
    TextureRegion textureRegion = TextureRegionFactory.createFromSource(texture,fileTextureSource ,0,0);
Run Code Online (Sandbox Code Playgroud)

ITextureSource fileTextureSource = new FileTextureSource(imageFile);
Run Code Online (Sandbox Code Playgroud)

给我一个ITextureSource无法解析为类型的错误.我正在使用AndEngine GLES1.请帮帮我,给我一个从SD卡制作精灵的方法.

Joh*_*Eye 6

我没有尝试过代码,但我把它放在Eclipse中并尝试修复它以便编译.这是结果:

File imageFile = new File("/path/to/image");
BitmapTextureAtlas texture = new BitmapTextureAtlas(width , height , TextureOptions.DEFAULT);
FileBitmapTextureAtlasSource fileTextureSource = new FileBitmapTextureAtlasSource(imageFile);
TextureRegion textureRegion = TextureRegionFactory.createFromSource(texture,fileTextureSource ,0,0, true);
Run Code Online (Sandbox Code Playgroud)