private static EntitySprite createSprite(final Object owner) { final EntitySprite entitySprite = EntitySprite.Factory.newPooledInstance(); entitySprite.m_owner = owner; final GeometrySprite geom = ((MemoryObject.ObjectFactory<GeometrySprite>) GLGeometrySprite.Factory).newPooledInstance(); entitySprite.setGeometry(geom); geom.removeReference(); return entitySprite; }
private void addGeometry(final ImageData data) { final GeometrySprite geom = ((MemoryObject.ObjectFactory<GeometrySprite>) GLGeometrySprite.Factory).newPooledInstance(); final Pixmap pixmap = data.getPixmap(); geom.setTextureCoordinates( pixmap.getTop(), pixmap.getLeft(), pixmap.getBottom(), pixmap.getRight()); geom.setSize(pixmap.getWidth(), pixmap.getHeight()); this.m_entity3D.addTexturedGeometry(geom, pixmap.getTexture(), null); geom.removeReference(); }
public void updateVertex( final Dimension size, final Insets margin, final Insets border, final Insets padding) { this.m_entity.setVisible(true); this.m_entity3D.setVisible(true); this.m_particleEntity.setVisible(true); final int left = margin.left + border.left + padding.left; final int bottom = margin.bottom + border.bottom + padding.bottom; this.m_entity.getTransformer().setTranslation(0, this.m_x, this.m_y); if (this.m_modulationColor != null) { this.m_entity3D.setColor( this.m_modulationColor.getRed(), this.m_modulationColor.getGreen(), this.m_modulationColor.getBlue(), this.m_modulationColor.getAlpha()); for (int i = 0, isize = this.m_textDataList.size(); i < isize; ++i) { this.m_textDataList .get(i) .getParticle() .setGlobalColor( this.m_modulationColor.getRed() * this.m_modulationColor.getAlpha(), this.m_modulationColor.getGreen() * this.m_modulationColor.getAlpha(), this.m_modulationColor.getBlue() * this.m_modulationColor.getAlpha(), this.m_modulationColor.getAlpha()); } } else { this.m_entity3D.setColor(1.0f, 1.0f, 1.0f, 1.0f); for (int i = 0, isize = this.m_textDataList.size(); i < isize; ++i) { this.m_textDataList.get(i).getParticle().setGlobalColor(1.0f, 1.0f, 1.0f, 1.0f); } } for (int i = 0, listSize = this.m_imageDataList.size(); i < listSize; ++i) { final ImageData imageData = this.m_imageDataList.get(i); final int x = imageData.getX() * this.m_chunkWidth + left; final int y = imageData.getY() * this.m_chunkHeight + bottom + size.height; final GeometrySprite geometry = (GeometrySprite) this.m_entity3D.getGeometry(i); geometry.setTopLeft(y, x); } for (int i = 0, listSize = this.m_textDataList.size(); i < listSize; ++i) { final TextData textData = this.m_textDataList.get(i); final GeometryMesh geom = (GeometryMesh) this.m_entity3D.getGeometry(i + this.m_imageDataList.size()); this.setTextGeometryPosition(geom.getVertexBuffer(), textData); } }