libgdx API

com.badlogic.gdx.graphics.g2d
Class PolygonRegion

java.lang.Object
  extended by com.badlogic.gdx.graphics.g2d.PolygonRegion

public class PolygonRegion
extends java.lang.Object

Defines a polygon shape on top of a #TextureRegion for minimising pixel drawing. Can either be constructed through a .psh file from an external editor or programmatically through a list of vertices defining a polygon. THIS STUFF IS WIP

Author:
Stefan Bachmann

Constructor Summary
PolygonRegion(TextureRegion region, FileHandle file)
          Creates a PolygonRegion by reading in the vertices and texture coordinates from the external file.
PolygonRegion(TextureRegion region, float[] vertices)
          Creates a PolygonRegin by triangulating the polygon coordinates in vertices and calculates uvs based on that.
 
Method Summary
 float[] getLocalVertices()
           
 TextureRegion getRegion()
           
 float[] getTextureCoords()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonRegion

public PolygonRegion(TextureRegion region,
                     FileHandle file)
Creates a PolygonRegion by reading in the vertices and texture coordinates from the external file. TextureRegion can come from an atlas.

Parameters:
region - the region used for drawing
file - polygon shape definition file

PolygonRegion

public PolygonRegion(TextureRegion region,
                     float[] vertices)
Creates a PolygonRegin by triangulating the polygon coordinates in vertices and calculates uvs based on that. TextureRegion can come from an atlas.

Parameters:
region - the region used for drawing
vertices - contains 2D polygon coordinates in pixels relative to source region
Method Detail

getLocalVertices

public float[] getLocalVertices()

getTextureCoords

public float[] getTextureCoords()

getRegion

public TextureRegion getRegion()

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)