Package com.badlogic.gdx.graphics.g2d
Class PolygonRegionLoader
- java.lang.Object
-
- com.badlogic.gdx.assets.loaders.AssetLoader<T,P>
-
- com.badlogic.gdx.assets.loaders.SynchronousAssetLoader<PolygonRegion,PolygonRegionLoader.PolygonRegionParameters>
-
- com.badlogic.gdx.graphics.g2d.PolygonRegionLoader
-
public class PolygonRegionLoader extends SynchronousAssetLoader<PolygonRegion,PolygonRegionLoader.PolygonRegionParameters>
loadsPolygonRegions
using aPolygonRegionLoader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PolygonRegionLoader.PolygonRegionParameters
-
Constructor Summary
Constructors Constructor Description PolygonRegionLoader()
PolygonRegionLoader(FileHandleResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Array<AssetDescriptor>
getDependencies(java.lang.String fileName, FileHandle file, PolygonRegionLoader.PolygonRegionParameters params)
If the PSH file contains a line starting withparams.texturePrefix
, anAssetDescriptor
for the file referenced on that line will be added to the returned Array.PolygonRegion
load(AssetManager manager, java.lang.String fileName, FileHandle file, PolygonRegionLoader.PolygonRegionParameters parameter)
PolygonRegion
load(TextureRegion textureRegion, FileHandle file)
Loads a PolygonRegion from a PSH (Polygon SHape) file.-
Methods inherited from class com.badlogic.gdx.assets.loaders.AssetLoader
resolve
-
-
-
-
Constructor Detail
-
PolygonRegionLoader
public PolygonRegionLoader()
-
PolygonRegionLoader
public PolygonRegionLoader(FileHandleResolver resolver)
-
-
Method Detail
-
load
public PolygonRegion load(AssetManager manager, java.lang.String fileName, FileHandle file, PolygonRegionLoader.PolygonRegionParameters parameter)
- Specified by:
load
in classSynchronousAssetLoader<PolygonRegion,PolygonRegionLoader.PolygonRegionParameters>
-
getDependencies
public Array<AssetDescriptor> getDependencies(java.lang.String fileName, FileHandle file, PolygonRegionLoader.PolygonRegionParameters params)
If the PSH file contains a line starting withparams.texturePrefix
, anAssetDescriptor
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 inparams.textureExtensions
will be used. If no suitable file is found, the returned Array will be empty.- Specified by:
getDependencies
in classAssetLoader<PolygonRegion,PolygonRegionLoader.PolygonRegionParameters>
- Parameters:
fileName
- name of the asset to loadfile
- the resolved file to loadparams
- parameters for loading the asset- Returns:
- other assets that the asset depends on and need to be loaded first or null if there are no dependencies.
-
load
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
- file handle to the shape definition file
-
-