org.andengine.opengl.texture.ITexture Java Examples
The following examples show how to use
org.andengine.opengl.texture.ITexture.
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 |
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: TextureRegion.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
public void updateUV() { final ITexture texture = this.mTexture; final float textureWidth = texture.getWidth(); final float textureHeight = texture.getHeight(); final float x = this.getTextureX(); final float y = this.getTextureY(); this.mU = x / textureWidth; this.mU2 = (x + this.mTextureWidth) / textureWidth; this.mV = y / textureHeight; this.mV2 = (y + this.mTextureHeight) / textureHeight; // this.mU = (x + 0.5f) / textureWidth; // this.mU2 = (x + this.mTextureWidth - 0.5f) / textureWidth; // // this.mV = (y + 0.5f) / textureHeight; // this.mV2 = (y + this.mTextureHeight - 0.5f) / textureHeight; }
Example #3
Source File: AnimationPackTiledTextureRegion.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
public AnimationPackTiledTextureRegion(final String pAnimationName, final long[] pFrameDurations, final int pLoopCount, final ITexture pTexture, final ITextureRegion ... pTextureRegions) { super(pTexture, pTextureRegions); this.mAnimationName = pAnimationName; final int frameCount = pFrameDurations.length; final int[] frames= new int[frameCount]; for(int i = 0; i < frameCount; i++) { frames[i] = i; } this.mAnimationData = new AnimationData(pFrameDurations, frames, pLoopCount); }
Example #4
Source File: TiledTextureRegion.java From tilt-game-android with MIT License | 5 votes |
/** * @param pTexture * @param pPerformSameTextureSanityCheck checks whether all supplied {@link ITextureRegion} are on the same {@link Texture} * @param pTextureRegions */ public TiledTextureRegion(final ITexture pTexture, final boolean pPerformSameTextureSanityCheck, final ITextureRegion ... pTextureRegions) { super(pTexture); this.mTextureRegions = pTextureRegions; this.mTileCount = this.mTextureRegions.length; if (pPerformSameTextureSanityCheck) { for (int i = this.mTileCount - 1; i >= 0; i--) { if (pTextureRegions[i].getTexture() != pTexture) { throw new IllegalArgumentException("The " + ITextureRegion.class.getSimpleName() + ": '" + pTextureRegions[i].toString() + "' at index: '" + i + "' is not on the same " + ITexture.class.getSimpleName() + ": '" + pTextureRegions[i].getTexture().toString() + "' as the supplied " + ITexture.class.getSimpleName() + ": '" + pTexture.toString() + "'."); } } } }
Example #5
Source File: StrokeFont.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
public StrokeFont(final FontManager pFontManager, final ITexture pTexture, final Typeface pTypeface, final float pSize, final boolean pAntiAlias, final int pColorARGBPackedInt, final float pStrokeWidth, final int pStrokeColorARGBPackedInt, final boolean pStrokeOnly) { super(pFontManager, pTexture, pTypeface, pSize, pAntiAlias, pColorARGBPackedInt); this.mStrokeWidth = pStrokeWidth; this.mStrokePaint = new Paint(); this.mStrokePaint.setTypeface(pTypeface); this.mStrokePaint.setStyle(Style.STROKE); this.mStrokePaint.setStrokeWidth(pStrokeWidth); this.mStrokePaint.setColor(pStrokeColorARGBPackedInt); this.mStrokePaint.setTextSize(pSize); this.mStrokePaint.setAntiAlias(pAntiAlias); this.mStrokeOnly = pStrokeOnly; }
Example #6
Source File: SpriteBatch.java From tilt-game-android with MIT License | 5 votes |
public SpriteBatch(final float pX, final float pY, final ITexture pTexture, final int pCapacity, final ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject, final ShaderProgram pShaderProgram) { super(pX, pY, pShaderProgram); this.mTexture = pTexture; this.mCapacity = pCapacity; this.mSpriteBatchVertexBufferObject = pSpriteBatchVertexBufferObject; this.setBlendingEnabled(true); this.initBlendFunction(this.mTexture); }
Example #7
Source File: BitmapFont.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
private void parseCharacters(final int pCharacterCount, final BufferedReader pBufferedReader) throws IOException { for(int i = pCharacterCount - 1; i >= 0; i--) { final String character = pBufferedReader.readLine(); final String[] charAttributes = TextUtils.SPLITPATTERN_SPACES.split(character, BitmapFont.TAG_CHAR_ATTRIBUTECOUNT + 1); if((charAttributes.length - 1) != BitmapFont.TAG_CHAR_ATTRIBUTECOUNT) { throw new FontException("Expected: '" + BitmapFont.TAG_CHAR_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_CHAR + " attributes, found: '" + (charAttributes.length - 1) + "'."); } if(!charAttributes[0].equals(BitmapFont.TAG_CHAR)) { throw new FontException("Expected: '" + BitmapFont.TAG_CHAR + "' attributes."); } final char id = BitmapFont.getCharAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_ID_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_ID); final int x = this.mBitmapFontOptions.mTextureOffsetX + BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_X_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_X); final int y = this.mBitmapFontOptions.mTextureOffsetY + BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_Y_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_Y); final int width = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_WIDTH_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_WIDTH); final int height = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_HEIGHT_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_HEIGHT); final int xOffset = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_XOFFSET_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_XOFFSET); final int yOffset = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_YOFFSET_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_YOFFSET); final int xAdvance = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_XADVANCE_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_XADVANCE); final int page = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_PAGE_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_PAGE); // final int channel = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_CHANNEL_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_CHANNEL); final ITexture bitmapFontPageTexture = this.mBitmapFontPages[page].getTexture(); final float textureWidth = bitmapFontPageTexture.getWidth(); final float textureHeight = bitmapFontPageTexture.getHeight(); final float u = x / textureWidth; final float v = y / textureHeight; final float u2 = (x + width) / textureWidth; final float v2 = (y + height) / textureHeight; this.mCharacterToLetterMap.put(id, new Letter(id, x, y, width, height, xOffset, yOffset, xAdvance, u, v, u2, v2)); } }
Example #8
Source File: BitmapFont.java From tilt-game-android with MIT License | 5 votes |
private void parseCharacters(final int pCharacterCount, final BufferedReader pBufferedReader) throws IOException { for (int i = pCharacterCount - 1; i >= 0; i--) { final String character = pBufferedReader.readLine(); final String[] charAttributes = TextUtils.SPLITPATTERN_SPACES.split(character, BitmapFont.TAG_CHAR_ATTRIBUTECOUNT + 1); if ((charAttributes.length - 1) != BitmapFont.TAG_CHAR_ATTRIBUTECOUNT) { throw new FontException("Expected: '" + BitmapFont.TAG_CHAR_ATTRIBUTECOUNT + "' " + BitmapFont.TAG_CHAR + " attributes, found: '" + (charAttributes.length - 1) + "'."); } if (!charAttributes[0].equals(BitmapFont.TAG_CHAR)) { throw new FontException("Expected: '" + BitmapFont.TAG_CHAR + "' attributes."); } final char id = BitmapFont.getCharAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_ID_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_ID); final int x = this.mBitmapFontOptions.mTextureOffsetX + BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_X_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_X); final int y = this.mBitmapFontOptions.mTextureOffsetY + BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_Y_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_Y); final int width = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_WIDTH_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_WIDTH); final int height = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_HEIGHT_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_HEIGHT); final int xOffset = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_XOFFSET_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_XOFFSET); final int yOffset = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_YOFFSET_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_YOFFSET); final int xAdvance = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_XADVANCE_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_XADVANCE); final int page = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_PAGE_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_PAGE); // final int channel = BitmapFont.getIntAttribute(charAttributes, BitmapFont.TAG_CHAR_ATTRIBUTE_CHANNEL_INDEX, BitmapFont.TAG_CHAR_ATTRIBUTE_CHANNEL); final ITexture bitmapFontPageTexture = this.mBitmapFontPages[page].getTexture(); final float textureWidth = bitmapFontPageTexture.getWidth(); final float textureHeight = bitmapFontPageTexture.getHeight(); final float u = x / textureWidth; final float v = y / textureHeight; final float u2 = (x + width) / textureWidth; final float v2 = (y + height) / textureHeight; this.mCharacterToLetterMap.put(id, new Letter((char) id, x, y, width, height, xOffset, yOffset, xAdvance, u, v, u2, v2)); } }
Example #9
Source File: TexturePackTextureRegion.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
public TexturePackTextureRegion(final ITexture pTexture, final int pX, final int pY, final int pWidth, final int pHeight, final int pID, final String pSource, final boolean pRotated, final boolean pTrimmed, final int pSourceX, final int pSourceY, final int pSourceWidth, final int pSourceHeight) { super(pTexture, pX, pY, pWidth, pHeight, pRotated); this.mID = pID; this.mSource = pSource; this.mTrimmed = pTrimmed; this.mSourceX = pSourceX; this.mSourceY = pSourceY; this.mSourceWidth = pSourceWidth; this.mSourceHeight = pSourceHeight; }
Example #10
Source File: AnimationPackTiledTextureRegion.java From tilt-game-android with MIT License | 5 votes |
public AnimationPackTiledTextureRegion(final String pAnimationName, final long[] pFrameDurations, final int pLoopCount, final ITexture pTexture, final ITextureRegion ... pTextureRegions) { super(pTexture, pTextureRegions); this.mAnimationName = pAnimationName; final int frameCount = pFrameDurations.length; final int[] frames = new int[frameCount]; for (int i = 0; i < frameCount; i++) { frames[i] = i; } this.mAnimationData = new AnimationData(pFrameDurations, frames, pLoopCount); }
Example #11
Source File: NineSliceSprite.java From tilt-game-android with MIT License | 5 votes |
public NineSliceSprite(final float pX, final float pY, final float pWidth, final float pHeight, final ITextureRegion pTextureRegion, final float pInsetLeft, final float pInsetTop, final float pInsetRight, final float pInsetBottom, final VertexBufferObjectManager pVertexBufferObjectManager, final ShaderProgram pShaderProgram) { super(pX, pY, pWidth, pHeight); this.mTextureRegion = pTextureRegion; this.mInsetLeft = pInsetLeft; this.mInsetTop = pInsetTop; this.mInsetRight = pInsetRight; this.mInsetBottom = pInsetBottom; final ITexture texture = pTextureRegion.getTexture(); this.mSpriteBatch = new SpriteBatch(texture, NINESLICESPRITE_CHILD_COUNT, pVertexBufferObjectManager, pShaderProgram); this.mTopLeftTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.mTopCenterTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.mTopRightTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.mCenterLeftTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.mCenterTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.mCenterRightTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.mBottomLeftTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.mBottomCenterTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.mBottomRightTextureRegion = new TextureRegion(texture, 0, 0, 0, 0); this.updateTextureRegions(); this.updateVertices(); this.attachChild(this.mSpriteBatch); }
Example #12
Source File: BaseTextureRegion.java From tilt-game-android with MIT License | 4 votes |
public BaseTextureRegion(final ITexture pTexture) { this.mTexture = pTexture; }
Example #13
Source File: TiledTextureRegion.java From tilt-game-android with MIT License | 4 votes |
public TiledTextureRegion(final ITexture pTexture, final ITextureRegion ... pTextureRegions) { this(pTexture, true, pTextureRegions); }
Example #14
Source File: TexturePack.java From tilt-game-android with MIT License | 4 votes |
public ITexture getTexture() { return this.mTexture; }
Example #15
Source File: SpriteBatch.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public SpriteBatch(final ITexture pTexture, final int pCapacity, final ISpriteBatchVertexBufferObject pSpriteBatchVertexBufferObject) { this(pTexture, pCapacity, pSpriteBatchVertexBufferObject, PositionColorTextureCoordinatesShaderProgram.getInstance()); }
Example #16
Source File: BitmapFont.java From tilt-game-android with MIT License | 4 votes |
@Override public ITexture getTexture() { return this.mBitmapFontPages[0].getTexture(); }
Example #17
Source File: FontFactory.java From tilt-game-android with MIT License | 4 votes |
public static StrokeFont createStrokeFromAsset(final FontManager pFontManager, final ITexture pTexture, final AssetManager pAssetManager, final String pAssetPath, final float pSize, final boolean pAntiAlias, final int pColor, final float pStrokeWidth, final int pStrokeColor) { return new StrokeFont(pFontManager, pTexture, Typeface.createFromAsset(pAssetManager, FontFactory.sAssetBasePath + pAssetPath), pSize, pAntiAlias, pColor, pStrokeWidth, pStrokeColor); }
Example #18
Source File: TextureRegion.java From tilt-game-android with MIT License | 4 votes |
public TextureRegion(final ITexture pTexture, final float pTextureX, final float pTextureY, final float pTextureWidth, final float pTextureHeight, final boolean pRotated) { this(pTexture, pTextureX, pTextureY, pTextureWidth, pTextureHeight, SCALE_DEFAULT, pRotated); }
Example #19
Source File: FontFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static StrokeFont createStroke(final FontManager pFontManager, final ITexture pTexture, final Typeface pTypeface, final float pSize, final boolean pAntiAlias, final int pColor, final float pStrokeWidth, final int pStrokeColor, final boolean pStrokeOnly) { return new StrokeFont(pFontManager, pTexture, pTypeface, pSize, pAntiAlias, pColor, pStrokeWidth, pStrokeColor, pStrokeOnly); }
Example #20
Source File: FontFactory.java From tilt-game-android with MIT License | 4 votes |
public static StrokeFont createStroke(final FontManager pFontManager, final ITexture pTexture, final float pSize, final int pColor, final float pStrokeWidth, final int pStrokeColor) { return FontFactory.createStroke(pFontManager, pTexture, pSize, FontFactory.ANTIALIAS_DEFAULT, pColor, pStrokeWidth, pStrokeColor); }
Example #21
Source File: FontFactory.java From tilt-game-android with MIT License | 4 votes |
public static StrokeFont createStroke(final FontManager pFontManager, final ITexture pTexture, final float pSize, final boolean pAntiAlias, final float pStrokeWidth, final int pStrokeColor) { return FontFactory.createStroke(pFontManager, pTexture, pSize, pAntiAlias, FontFactory.COLOR_DEFAULT, pStrokeWidth, pStrokeColor); }
Example #22
Source File: Font.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public Font(final FontManager pFontManager, final ITexture pTexture, final Typeface pTypeface, final float pSize, final boolean pAntiAlias, final Color pColor) { this(pFontManager, pTexture, pTypeface, pSize, pAntiAlias, pColor.getARGBPackedInt()); }
Example #23
Source File: FontFactory.java From tilt-game-android with MIT License | 4 votes |
public static Font createFromAsset(final FontManager pFontManager, final ITexture pTexture, final AssetManager pAssetManager, final String pAssetPath, final float pSize, final boolean pAntiAlias, final int pColor) { return new Font(pFontManager, pTexture, Typeface.createFromAsset(pAssetManager, FontFactory.sAssetBasePath + pAssetPath), pSize, pAntiAlias, pColor); }
Example #24
Source File: FontFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static StrokeFont createStrokeFromAsset(final FontManager pFontManager, final ITexture pTexture, final AssetManager pAssetManager, final String pAssetPath, final float pSize, final boolean pAntiAlias, final int pColor, final float pStrokeWidth, final int pStrokeColor) { return new StrokeFont(pFontManager, pTexture, Typeface.createFromAsset(pAssetManager, FontFactory.sAssetBasePath + pAssetPath), pSize, pAntiAlias, pColor, pStrokeWidth, pStrokeColor); }
Example #25
Source File: SpriteBatch.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public ITexture getTexture() { return this.mTexture; }
Example #26
Source File: SpriteBatch.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public SpriteBatch(final float pX, final float pY, final ITexture pTexture, final int pCapacity, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) { this(pX, pY, pTexture, pCapacity, new HighPerformanceSpriteBatchVertexBufferObject(pVertexBufferObjectManager, pCapacity * SpriteBatch.SPRITE_SIZE, pDrawType, true, SpriteBatch.VERTEXBUFFEROBJECTATTRIBUTES_DEFAULT)); }
Example #27
Source File: FontFactory.java From tilt-game-android with MIT License | 4 votes |
public static Font create(final FontManager pFontManager, final ITexture pTexture, final float pSize) { return FontFactory.create(pFontManager, pTexture, pSize, FontFactory.ANTIALIAS_DEFAULT, FontFactory.COLOR_DEFAULT); }
Example #28
Source File: TiledTextureRegion.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static TiledTextureRegion create(final ITexture pTexture, final int pTextureX, final int pTextureY, final int pTextureWidth, final int pTextureHeight, final int pTileColumns, final int pTileRows) { return TiledTextureRegion.create(pTexture, pTextureX, pTextureY, pTextureWidth, pTextureHeight, pTileColumns, pTileRows, false); }
Example #29
Source File: FontFactory.java From tilt-game-android with MIT License | 4 votes |
public static Font create(final FontManager pFontManager, final ITexture pTexture, final float pSize, final boolean pAntiAlias) { return FontFactory.create(pFontManager, pTexture, pSize, pAntiAlias, FontFactory.COLOR_DEFAULT); }
Example #30
Source File: FontFactory.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public static Font create(final FontManager pFontManager, final ITexture pTexture, final Typeface pTypeface, final float pSize, final boolean pAntiAlias, final int pColor) { return new Font(pFontManager, pTexture, pTypeface, pSize, pAntiAlias, pColor); }