APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.graphics.g2d

public Class PolygonRegionLoader

extends SynchronousAssetLoader<PolygonRegion, PolygonRegionLoader.PolygonRegionParameters>
Class Inheritance
Imports
java.io.BufferedReader, .IOException, com.badlogic.gdx.assets.AssetDescriptor, .AssetLoaderParameters, .AssetManager, com.badlogic.gdx.assets.loaders.FileHandleResolver, .SynchronousAssetLoader, com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver, com.badlogic.gdx.files.FileHandle, com.badlogic.gdx.graphics.Texture, com.badlogic.gdx.graphics.g2d.PolygonRegionLoader.PolygonRegionParameters, com.badlogic.gdx.math.EarClippingTriangulator, com.badlogic.gdx.utils.Array, .GdxRuntimeException, .StreamUtils

loads PolygonRegions using a com.badlogic.gdx.graphics.g2d.PolygonRegionLoader
Author
dermetfan

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private PolygonRegionLoader.PolygonRegionParameters
private EarClippingTriangulator

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public Array<AssetDescriptor<T>>
getDependencies(String fileName, FileHandle file, PolygonRegionLoader.PolygonRegionParameters params)

Implements abstract com.badlogic.gdx.assets.loaders.AssetLoader.getDependencies.

If the PSH file contains a line starting with params.texturePrefix, an AssetDescriptor for the file referenced on that line will be added to the returned Array.

public PolygonRegion
public PolygonRegion
load(TextureRegion textureRegion, FileHandle
file handle to the shape definition file
file
)

Loads a PolygonRegion from a PSH (Polygon SHape) file.

Field Detail

defaultParametersback to summary
private PolygonRegionLoader.PolygonRegionParameters defaultParameters
triangulatorback to summary
private EarClippingTriangulator triangulator

Constructor Detail

PolygonRegionLoaderback to summary
public PolygonRegionLoader()
PolygonRegionLoaderback to summary
public PolygonRegionLoader(FileHandleResolver resolver)

Method Detail

getDependenciesback to summary
public Array<AssetDescriptor<T>> getDependencies(String fileName, FileHandle file, PolygonRegionLoader.PolygonRegionParameters params)

Implements abstract com.badlogic.gdx.assets.loaders.AssetLoader.getDependencies.

If the PSH file contains a line starting with params.texturePrefix, an AssetDescriptor for the file referenced on that line will be added to the returned Array. Otherwise a sibling of the given file with the same name and the first found extension in params.textureExtensions will be used. If no suitable file is found, the returned Array will be empty.

Annotations
@Override
loadback to summary
public PolygonRegion load(AssetManager manager, String fileName, FileHandle file, PolygonRegionLoader.PolygonRegionParameters parameter)

Implements abstract com.badlogic.gdx.assets.loaders.SynchronousAssetLoader.load.

Annotations
@Override
loadback to summary
public PolygonRegion load(TextureRegion textureRegion, FileHandle file)

Loads a PolygonRegion from a PSH (Polygon SHape) file. The PSH file format defines the polygon vertices before triangulation:

s 200.0, 100.0, ...

Lines not prefixed with "s" are ignored. PSH files can be created with external tools, eg:
https://code.google.com/p/libgdx-polygoneditor/
http://www.codeandweb.com/physicseditor/

Parameters
file:FileHandle

file handle to the shape definition file

com.badlogic.gdx.graphics.g2d back to summary

public Class PolygonRegionLoader.PolygonRegionParameters

extends AssetLoaderParameters<PolygonRegion>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public int
readerBuffer

what buffer size of the reader should be used to read the texturePrefix line

public String[]
textureExtensions

the possible file name extensions of the texture file

public String
texturePrefix

what the line starts with that contains the file name of the texture for this PolygonRegion

Inherited from com.badlogic.gdx.assets.AssetLoaderParameters:
loadedCallback

Constructor Summary

AccessConstructor and Description
public

Field Detail

readerBufferback to summary
public int readerBuffer

what buffer size of the reader should be used to read the texturePrefix line

See Also
FileHandle#reader(int)
textureExtensionsback to summary
public String[] textureExtensions

the possible file name extensions of the texture file

texturePrefixback to summary
public String texturePrefix

what the line starts with that contains the file name of the texture for this PolygonRegion

Constructor Detail

PolygonRegionParametersback to summary
public PolygonRegionParameters()