public final void dispose() { this.keySize = 0; if (batch != null) { batch.dispose(); batch = null; } if (content != null) { content.dispose(); content = null; } if (indexTile != null) { indexTile.dispose(); indexTile = null; } if (objects != null) { objects.clear(); objects = null; } if (pendingAdd != null) { pendingAdd.clear(); pendingAdd = null; } if (pendingRemove != null) { pendingRemove.clear(); pendingRemove = null; } tiles.clear(); close(); }
public void draw(SpriteBatch sb) { sb.drawSprite( mAnimation.getFrame(), mPhysics.getX() + mDrawOffsetX, mPhysics.getY() + mDrawOffsetY, mDrawWidth, mDrawHeight); }
public final void draw(GLEx g) { if (isOnLoadComplete()) { batch.begin(); before(batch); for (TileMap tile : tiles) { tile.draw(g, batch, offset.x(), offset.y()); } for (SpriteBatchObject o : objects) { objX = o.getX() + offset.x; objY = o.getY() + offset.y; if (contains(objX, objY)) { o.draw(batch, offset.x, offset.y); } } if (content.isVisible()) { content.drawNode(batch); } after(batch); batch.end(); } }
public void draw(SpriteBatch batch) { if (currentFrame >= 0) { batch.draw( this.image, getDestRectLeft(), getDestRectTop(), getDestRectRight(), getDestRectBottom(), getSpriteLeft(), getSpriteTop(), getSpriteRight(), getSpriteBottom(), color); } }
// --Draw Text--// // D: draw text at the specified x,y position // A: text - the string to draw // x, y - the x,y position to draw text at (bottom left of text; including descent) // R: [none] public void draw(String text, float x, float y) { float chrHeight = cellHeight * scaleY; // Calculate Scaled Character Height float chrWidth = cellWidth * scaleX; // Calculate Scaled Character Width int len = text.length(); // Get String Length x += (chrWidth / 2.0f) - (fontPadX * scaleX); // Adjust Start X y += (chrHeight / 2.0f) - (fontPadY * scaleY); // Adjust Start Y for (int i = 0; i < len; i++) { // FOR Each Character in String int c = (int) text.charAt(i) - CHAR_START; // Calculate Character Index (Offset by First Char in Font) if (c < 0 || c >= CHAR_CNT) // IF Character Not In Font c = CHAR_UNKNOWN; // Set to Unknown Character Index batch.drawSprite(x, y, chrWidth, chrHeight, charRgn[c]); // Draw the Character x += (charWidths[c] + spaceX) * scaleX; // Advance X Position by Scaled Character Width } }
// --Draw Font Texture--// // D: draw the entire font texture (NOTE: for testing purposes only) // A: width, height - the width and height of the area to draw to. this is used // to draw the texture to the top-left corner. public void drawTexture(int width, int height) { batch.beginBatch(textureId); // Begin Batch (Bind Texture) batch.drawSprite( textureSize / 2, height - (textureSize / 2), textureSize, textureSize, textureRgn); // Draw batch.endBatch(); // End Batch }
public void end() { batch.endBatch(); // End Batch gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Restore Default Color/Alpha }
public void begin(float red, float green, float blue, float alpha) { gl.glColor4f(red, green, blue, alpha); // Set Color+Alpha gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId); // Bind the Texture batch.beginBatch(); // Begin Batch }