当前位置: 首页>>代码示例>>Java>>正文


Java IInputStreamOpener类代码示例

本文整理汇总了Java中org.andengine.util.adt.io.in.IInputStreamOpener的典型用法代码示例。如果您正苦于以下问题:Java IInputStreamOpener类的具体用法?Java IInputStreamOpener怎么用?Java IInputStreamOpener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IInputStreamOpener类属于org.andengine.util.adt.io.in包,在下文中一共展示了IInputStreamOpener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTextureFromAsset

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
private TextureRegion getTextureFromAsset(final String path) {
    try {
        texture = new BitmapTexture(engine.getTextureManager(), new IInputStreamOpener() {
            @Override
            public InputStream open() throws IOException {
                return context.getAssets().open("gfx/" + path); // path of the image
            }
        }, TextureOptions.BILINEAR);
        texture.load();
        return TextureRegionFactory.extractFromTexture(texture);
    } catch (IOException e) {
        e.printStackTrace();
        Log.e(ASSETS_ERROR_TAG, e.toString());
    }
    return null;
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:17,代码来源:ResourceManager.java

示例2: getTiledTextureFromAsset

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
private TiledTextureRegion getTiledTextureFromAsset(final String path, int rows, int columns) {
    try {
        texture = new BitmapTexture(engine.getTextureManager(), new IInputStreamOpener() {
            @Override
            public InputStream open() throws IOException {
                return context.getAssets().open("gfx/" + path); // path of the image
            }
        }, TextureOptions.BILINEAR);
        texture.load();
        return TextureRegionFactory.extractTiledFromTexture(texture, rows, columns);
    } catch (IOException e) {
        e.printStackTrace();
        Log.e(ASSETS_ERROR_TAG, e.toString());
    }
    return null;
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:17,代码来源:ResourceManager.java

示例3: BitmapTexture

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IOException {
	super(pTextureManager, pBitmapTextureFormat.getPixelFormat(), pTextureOptions, pTextureStateListener);

	this.mInputStreamOpener = pInputStreamOpener;
	this.mBitmapTextureFormat = pBitmapTextureFormat;

	final BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
	decodeOptions.inJustDecodeBounds = true;

	final InputStream in = null;
	try {
		BitmapFactory.decodeStream(pInputStreamOpener.open(), null, decodeOptions);
	} finally {
		StreamUtils.close(in);
	}

	this.mWidth = decodeOptions.outWidth;
	this.mHeight = decodeOptions.outHeight;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:20,代码来源:BitmapTexture.java

示例4: uploadTexture

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
public void uploadTexture(final String assetPath) throws IOException {
    if (mTextures.containsKey(assetPath)) {
        return;
    }
    final BaseGameActivity gameActivity = mActivityReference.get();
    if (gameActivity == null) {
        return;
    }
    ITexture texture = new BitmapTexture(gameActivity.getTextureManager(), new IInputStreamOpener() {
        @Override
        public InputStream open() throws IOException {
            return gameActivity.getAssets().open(assetPath);
        }
    });
    texture.load();
    mTextures.put(assetPath, texture);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:18,代码来源:ResourcesManager.java

示例5: addTextureAndLoad

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
public void addTextureAndLoad(final String assetPath) throws IOException {
    if (resources.containsKey(assetPath)) {
        return;
    }
    final BaseGameActivity gameActivity = mActivityReference.get();
    if (gameActivity == null) {
        return;
    }
    ITexture texture = new BitmapTexture(gameActivity.getTextureManager(), new IInputStreamOpener() {
        @Override
        public InputStream open() throws IOException {
            return gameActivity.getAssets().open(assetPath);
        }
    });
    resources.put(assetPath, texture);
    texture.load();
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:18,代码来源:GameResources.java

示例6: getTexture

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
TextureRegion getTexture(final String path) {

        try {
            ITexture texture = new BitmapTexture(textureManager, new IInputStreamOpener() {

                        @Override
                        public InputStream open() throws IOException {

                            return assetManager.open(path);
                        }
                    }, TextureOptions.BILINEAR);

            return TextureRegionFactory.extractFromTexture(texture);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return null;
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:20,代码来源:ResourceLoader.java

示例7: doInBackground

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
@Override
protected Sprite doInBackground(final String... params) {
    try {
        ITexture mTexture = new BitmapTexture(engine.getTextureManager(), new IInputStreamOpener() {
            @Override
            public InputStream open() throws IOException {

                URL url = new URL(params[0]);

                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                connection.setDoInput(true);
                connection.connect();
                InputStream input = connection.getInputStream();
                return new BufferedInputStream(input);
            }
        });
        mTexture.load();
        textureRegionAnotherPlayer = TextureRegionFactory.extractFromTexture(mTexture);
        if (GameManager.getInstance() != null && GameManager.getInstance().players != null &&
                GameManager.getInstance().players.length > 0 && engine != null) {
            IEntity entity = GameManager.getInstance().players[1].tabSprite;
            Sprite user = new Sprite(0, 0, textureRegionAnotherPlayer, engine.getVertexBufferObjectManager());
            user.setWidth(entity.getHeight() - 27);
            user.setHeight(entity.getHeight() - 27);
            user.setX(-13 + entity.getWidth() / 2);
            user.setY(+4 + entity.getHeight() / 2);
            return user;
        }

    } catch (IOException e) {
        Debug.e(e);
    }
    return null;
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:35,代码来源:ResourceManager.java

示例8: getTexture

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions, final boolean pLoadToHardware) throws IOException {
	if (this.hasMappedTexture(pID)) {
		return this.getMappedTexture(pID);
	} else {
		final ITexture texture = new BitmapTexture(this, pInputStreamOpener, pBitmapTextureFormat, pTextureOptions);
		if (pLoadToHardware) {
			this.loadTexture(texture);
		}
		this.addMappedTexture(pID, texture);

		return texture;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:14,代码来源:TextureManager.java

示例9: getTexture

import org.andengine.util.adt.io.in.IInputStreamOpener; //导入依赖的package包/类
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions, final boolean pLoadToHardware) throws IOException {
	if(this.hasMappedTexture(pID)) {
		return this.getMappedTexture(pID);
	} else {
		final ITexture texture = new BitmapTexture(this, pInputStreamOpener, pBitmapTextureFormat, pTextureOptions);
		if(pLoadToHardware) {
			this.loadTexture(texture);
		}
		this.addMappedTexture(pID, texture);

		return texture;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:14,代码来源:TextureManager.java


注:本文中的org.andengine.util.adt.io.in.IInputStreamOpener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。