org.andengine.util.adt.io.in.IInputStreamOpener Java Examples

The following examples show how to use org.andengine.util.adt.io.in.IInputStreamOpener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceLoader.java    From sopa with Apache License 2.0 6 votes vote down vote up
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;
    }
 
Example #2
Source File: BitmapTexture.java    From tilt-game-android with MIT License 6 votes vote down vote up
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;
}
 
Example #3
Source File: BitmapTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: TextureManager.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
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;
	}
}
 
Example #5
Source File: TextureManager.java    From tilt-game-android with MIT License 5 votes vote down vote up
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;
	}
}
 
Example #6
Source File: BitmapTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener) throws IOException {
	this(pTextureManager, pInputStreamOpener, BitmapTextureFormat.RGBA_8888, TextureOptions.DEFAULT, null);
}
 
Example #7
Source File: TextureManager.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions) throws IOException {
	return this.getTexture(pID, pInputStreamOpener, pBitmapTextureFormat, pTextureOptions, true);
}
 
Example #8
Source File: TextureManager.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener, final TextureOptions pTextureOptions) throws IOException {
	return this.getTexture(pID, pInputStreamOpener, BitmapTextureFormat.RGBA_8888, pTextureOptions);
}
 
Example #9
Source File: TextureManager.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener) throws IOException {
	return this.getTexture(pID, pInputStreamOpener, TextureOptions.DEFAULT);
}
 
Example #10
Source File: BitmapTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions) throws IOException {
	this(pTextureManager, pInputStreamOpener, pBitmapTextureFormat, pTextureOptions, null);
}
 
Example #11
Source File: BitmapTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener, final TextureOptions pTextureOptions) throws IOException {
	this(pTextureManager, pInputStreamOpener, BitmapTextureFormat.RGBA_8888, pTextureOptions, null);
}
 
Example #12
Source File: BitmapTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat) throws IOException {
	this(pTextureManager, pInputStreamOpener, pBitmapTextureFormat, TextureOptions.DEFAULT, null);
}
 
Example #13
Source File: BitmapTexture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener) throws IOException {
	this(pTextureManager, pInputStreamOpener, BitmapTextureFormat.RGBA_8888, TextureOptions.DEFAULT, null);
}
 
Example #14
Source File: TextureManager.java    From tilt-game-android with MIT License 4 votes vote down vote up
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions) throws IOException {
	return this.getTexture(pID, pInputStreamOpener, pBitmapTextureFormat, pTextureOptions, true);
}
 
Example #15
Source File: TextureManager.java    From tilt-game-android with MIT License 4 votes vote down vote up
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener, final TextureOptions pTextureOptions) throws IOException {
	return this.getTexture(pID, pInputStreamOpener, BitmapTextureFormat.RGBA_8888, pTextureOptions);
}
 
Example #16
Source File: TextureManager.java    From tilt-game-android with MIT License 4 votes vote down vote up
public synchronized ITexture getTexture(final String pID, final IInputStreamOpener pInputStreamOpener) throws IOException {
	return this.getTexture(pID, pInputStreamOpener, TextureOptions.DEFAULT);
}
 
Example #17
Source File: BitmapTexture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions) throws IOException {
	this(pTextureManager, pInputStreamOpener, pBitmapTextureFormat, pTextureOptions, null);
}
 
Example #18
Source File: BitmapTexture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener, final TextureOptions pTextureOptions) throws IOException {
	this(pTextureManager, pInputStreamOpener, BitmapTextureFormat.RGBA_8888, pTextureOptions, null);
}
 
Example #19
Source File: BitmapTexture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public BitmapTexture(final TextureManager pTextureManager, final IInputStreamOpener pInputStreamOpener, final BitmapTextureFormat pBitmapTextureFormat) throws IOException {
	this(pTextureManager, pInputStreamOpener, pBitmapTextureFormat, TextureOptions.DEFAULT, null);
}