org.andengine.opengl.texture.TextureOptions Java Examples

The following examples show how to use org.andengine.opengl.texture.TextureOptions. 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: PipePair.java    From OpenFlappyBird with Do What The F*ck You Want To Public License 6 votes vote down vote up
public static void onCreateResources(SimpleBaseGameActivity activity){

		// upper pipe		
		BitmapTextureAtlas upperPipeTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 130, 60, TextureOptions.BILINEAR);
		mUpperPipeTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(upperPipeTextureAtlas, activity, "pipeupper.png", 0, 0);
		upperPipeTextureAtlas.load();

		// upper pipe section	
		BitmapTextureAtlas upperPipeSectionTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 120, 1, TextureOptions.BILINEAR);
		mUpperPipeSectionTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(upperPipeSectionTextureAtlas, activity, "pipesectionupper.png", 0, 0);
		upperPipeSectionTextureAtlas.load();


		// lower pipe		
		BitmapTextureAtlas lowerPipeTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 130, 60, TextureOptions.BILINEAR);
		mLowerPipeTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(lowerPipeTextureAtlas, activity, "pipelower.png", 0, 0);
		lowerPipeTextureAtlas.load();

		// lower pipe section	
		BitmapTextureAtlas lowerPipeSectionTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 120, 1, TextureOptions.BILINEAR);
		mLowerPipeSectionTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(lowerPipeSectionTextureAtlas, activity, "pipesectionlower.png", 0, 0);
		lowerPipeSectionTextureAtlas.load();
	}
 
Example #2
Source File: ETC1Texture.java    From tilt-game-android with MIT License 6 votes vote down vote up
public ETC1Texture(final TextureManager pTextureManager, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IOException {
	super(pTextureManager, PixelFormat.RGB_565, pTextureOptions, pTextureStateListener);

	InputStream inputStream = null;
	try {
		inputStream = this.getInputStream();

		this.mETC1TextureHeader = new ETC1TextureHeader(StreamUtils.streamToBytes(inputStream, ETC1.ETC_PKM_HEADER_SIZE));

		if (BuildConfig.DEBUG) {
			if (!(MathUtils.isPowerOfTwo(this.mETC1TextureHeader.mWidth) && MathUtils.isPowerOfTwo(this.mETC1TextureHeader.mHeight))) {
				Debug.w("ETC1 textures with NPOT sizes can cause a crash on PowerVR GPUs!");
			}
		}
	} finally {
		StreamUtils.close(inputStream);
	}
}
 
Example #3
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 #4
Source File: RenderTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public RenderTexture(final TextureManager pTextureManager, final int pWidth, final int pHeight, final PixelFormat pPixelFormat, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) {
	super(pTextureManager, pPixelFormat, pTextureOptions, pTextureStateListener);

	this.mWidth = pWidth;
	this.mHeight = pHeight;

	this.mPixelFormat = pPixelFormat;
}
 
Example #5
Source File: ETC1Texture.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public ETC1Texture(final TextureManager pTextureManager, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IOException {
	super(pTextureManager, PixelFormat.RGB_565, pTextureOptions, pTextureStateListener);

	InputStream inputStream = null;
	try {
		inputStream = this.getInputStream();

		this.mETC1TextureHeader = new ETC1TextureHeader(StreamUtils.streamToBytes(inputStream, ETC1.ETC_PKM_HEADER_SIZE));
	} finally {
		StreamUtils.close(inputStream);
	}
}
 
Example #6
Source File: AndEngineActivity.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreateResources() throws IOException {
    mTexture = new AssetBitmapTexture(getTextureManager(), getAssets(), "player.png");
    mTextureRegion = TextureRegionFactory.extractFromTexture(mTexture);
    mTexture.load();

    mBitmapTextureAtlas = new BitmapTextureAtlas(getTextureManager(), 100, 100, TextureOptions.BILINEAR);
    mTiledTextureRegion = BitmapTextureAtlasTextureRegionFactory
            .createTiledFromAsset(mBitmapTextureAtlas, getAssets(), "npc-oldman1.png", 0, 0, 4, 1);

    mBitmapTextureAtlas.load();
}
 
Example #7
Source File: PVRTexture.java    From tilt-game-android with MIT License 5 votes vote down vote up
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final IPVRTexturePixelBufferStrategy pPVRTexturePixelBufferStrategy, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IllegalArgumentException, IOException {
	super(pTextureManager, pPVRTextureFormat.getPixelFormat(), pTextureOptions, pTextureStateListener);
	this.mPVRTexturePixelBufferStrategy = pPVRTexturePixelBufferStrategy;

	InputStream inputStream = null;
	try {
		inputStream = this.getInputStream();
		this.mPVRTextureHeader = new PVRTextureHeader(StreamUtils.streamToBytes(inputStream, PVRTextureHeader.SIZE));
	} finally {
		StreamUtils.close(inputStream);
	}

	if (this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() != pPVRTextureFormat.getPixelFormat()) {
		throw new IllegalArgumentException("Other PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat() + "' found than expected: '" + pPVRTextureFormat.getPixelFormat() + "'.");
	}

	if (this.mPVRTextureHeader.getPVRTextureFormat().isCompressed()) { // TODO && ! GLHELPER_EXTENSION_PVRTC] ) {
		throw new IllegalArgumentException("Invalid PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat() + "'.");
	}

	if (this.hasMipMaps()) {
		switch (pTextureOptions.mMinFilter) {
			case GLES20.GL_NEAREST_MIPMAP_NEAREST:
			case GLES20.GL_NEAREST_MIPMAP_LINEAR:
			case GLES20.GL_LINEAR_MIPMAP_NEAREST:
			case GLES20.GL_LINEAR_MIPMAP_LINEAR:
				break;
			default:
				if (BuildConfig.DEBUG) {
					Debug.w("This '" + this.getClass().getSimpleName() + "' contains mipmaps, but the provided '" + pTextureOptions.getClass().getSimpleName() + "' don't have MipMaps enabled on the MinFilter!");
				}
		}
	}

	this.mUpdateOnHardwareNeeded = true;
}
 
Example #8
Source File: ResourceLoader.java    From sopa with Apache License 2.0 5 votes vote down vote up
IFont getFont(final String name, float size, int color, float strokeWidth, int strokeColor) {

        FontFactory.setAssetBasePath("fonts/");

        final ITexture mainFontTexture = new BitmapTextureAtlas(textureManager, 1024, 1024, TextureOptions.BILINEAR);
        IFont font = FontFactory.createStrokeFromAsset(fontManager, mainFontTexture, assetManager, name, size, true,
                color, strokeWidth, strokeColor);
        font.load();

        return font;
    }
 
Example #9
Source File: AssetBitmapTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public AssetBitmapTexture(final TextureManager pTextureManager, final AssetManager pAssetManager, final String pAssetPath, final TextureOptions pTextureOptions) throws IOException {
	super(pTextureManager, new AssetInputStreamOpener(pAssetManager, pAssetPath), pTextureOptions);
}
 
Example #10
Source File: PVRGZTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public PVRGZTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final TextureOptions pTextureOptions) throws IllegalArgumentException, IOException {
	super(pTextureManager, pPVRTextureFormat, pTextureOptions);
}
 
Example #11
Source File: ETC1Texture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public ETC1Texture(final TextureManager pTextureManager) throws IOException {
	this(pTextureManager, TextureOptions.DEFAULT, null);
}
 
Example #12
Source File: ETC1Texture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public ETC1Texture(final TextureManager pTextureManager, final ITextureStateListener pTextureStateListener) throws IOException {
	this(pTextureManager, TextureOptions.DEFAULT, pTextureStateListener);
}
 
Example #13
Source File: BitmapTextureAtlas.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
/**
 * @param pBitmapTextureFormat use {@link BitmapTextureFormat#RGBA_8888} or {@link BitmapTextureFormat#RGBA_4444} for a {@link BitmapTextureAtlas} with transparency and {@link BitmapTextureFormat#RGB_565} for a {@link BitmapTextureAtlas} without transparency.
 */
public BitmapTextureAtlas(final TextureManager pTextureManager, final int pWidth, final int pHeight, final BitmapTextureFormat pBitmapTextureFormat) {
	this(pTextureManager, pWidth, pHeight, pBitmapTextureFormat, TextureOptions.DEFAULT, null);
}
 
Example #14
Source File: ResourceBitmapTexture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public ResourceBitmapTexture(final TextureManager pTextureManager, final Resources pResources, final int pDrawableResourceID, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IOException {
	super(pTextureManager, new ResourceInputStreamOpener(pResources, pDrawableResourceID), pBitmapTextureFormat, pTextureOptions, pTextureStateListener);
}
 
Example #15
Source File: PVRTexture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final IPVRTexturePixelBufferStrategy pPVRTexturePixelBufferStrategy, final TextureOptions pTextureOptions) throws IllegalArgumentException, IOException {
	this(pTextureManager, pPVRTextureFormat, pPVRTexturePixelBufferStrategy, pTextureOptions, null);
}
 
Example #16
Source File: FontFactory.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public static Font create(final FontManager pFontManager, final TextureManager pTextureManager, final int pTextureWidth, final int pTextureHeight, final Typeface pTypeface, final float pSize, final int pColor) {
	return FontFactory.create(pFontManager, pTextureManager, pTextureWidth, pTextureHeight, TextureOptions.DEFAULT, pTypeface, pSize, FontFactory.ANTIALIAS_DEFAULT, pColor);
}
 
Example #17
Source File: FontFactory.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public static Font create(final FontManager pFontManager, final TextureManager pTextureManager, final int pTextureWidth, final int pTextureHeight, final TextureOptions pTextureOptions, final Typeface pTypeface, final float pSize, final int pColor) {
	return FontFactory.create(pFontManager, pTextureManager, pTextureWidth, pTextureHeight, pTextureOptions, pTypeface, pSize, FontFactory.ANTIALIAS_DEFAULT, pColor);
}
 
Example #18
Source File: PVRTexture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final TextureOptions pTextureOptions) throws IllegalArgumentException, IOException {
	this(pTextureManager, pPVRTextureFormat, new GreedyPVRTexturePixelBufferStrategy(), pTextureOptions, null);
}
 
Example #19
Source File: PVRTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat, final IPVRTexturePixelBufferStrategy pPVRTexturePixelBufferStrategy, final ITextureStateListener pTextureStateListener) throws IllegalArgumentException, IOException {
	this(pTextureManager, pPVRTextureFormat, pPVRTexturePixelBufferStrategy, TextureOptions.DEFAULT, pTextureStateListener);
}
 
Example #20
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 #21
Source File: ETC1Texture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public ETC1Texture(final TextureManager pTextureManager, final ITextureStateListener pTextureStateListener) throws IOException {
	this(pTextureManager, TextureOptions.DEFAULT, pTextureStateListener);
}
 
Example #22
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 #23
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 #24
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);
}
 
Example #25
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 #26
Source File: BitmapFont.java    From tilt-game-android with MIT License 4 votes vote down vote up
public BitmapFont(final TextureManager pTextureManager, final AssetManager pAssetManager, final String pAssetPath, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions) {
	this(pTextureManager, pAssetManager, pAssetPath, pBitmapTextureFormat, pTextureOptions, BitmapFontOptions.DEFAULT);
}
 
Example #27
Source File: ETC1Texture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public ETC1Texture(final TextureManager pTextureManager, final TextureOptions pTextureOptions) throws IOException {
	this(pTextureManager, pTextureOptions, null);
}
 
Example #28
Source File: FontFactory.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public static Font createFromAsset(final FontManager pFontManager, final TextureManager pTextureManager, final int pTextureWidth, final int pTextureHeight, final BitmapTextureFormat pBitmapTextureFormat, final TextureOptions pTextureOptions, final AssetManager pAssetManager, final String pAssetPath, final float pSize, final boolean pAntiAlias, final int pColor) {
	return new Font(pFontManager, new BitmapTextureAtlas(pTextureManager, pTextureWidth, pTextureHeight, pBitmapTextureFormat, pTextureOptions), Typeface.createFromAsset(pAssetManager, FontFactory.sAssetBasePath + pAssetPath), pSize, pAntiAlias, pColor);
}
 
Example #29
Source File: PVRTexture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public PVRTexture(final TextureManager pTextureManager, final PVRTextureFormat pPVRTextureFormat) throws IllegalArgumentException, IOException {
	this(pTextureManager, pPVRTextureFormat, new GreedyPVRTexturePixelBufferStrategy(), TextureOptions.DEFAULT, null);
}
 
Example #30
Source File: RenderTexture.java    From tilt-game-android with MIT License 4 votes vote down vote up
public RenderTexture(final TextureManager pTextureManager, final int pWidth, final int pHeight) {
	this(pTextureManager, pWidth, pHeight, PixelFormat.RGBA_8888, TextureOptions.NEAREST);
}