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>
loads PolygonRegions
using a PolygonRegionLoader
- Author:
- dermetfan
PolygonRegionLoader
public PolygonRegionLoader()
PolygonRegionLoader
public PolygonRegionLoader(FileHandleResolver resolver)
load
public PolygonRegion load(AssetManager manager,
String fileName,
FileHandle file,
PolygonRegionLoader.PolygonRegionParameters parameter)
- Specified by:
load
in class SynchronousAssetLoader<PolygonRegion,PolygonRegionLoader.PolygonRegionParameters>
getDependencies
public Array<AssetDescriptor> getDependencies(String fileName,
FileHandle file,
PolygonRegionLoader.PolygonRegionParameters params)
- 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.
- Specified by:
getDependencies
in class AssetLoader<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
Copyright © 2014. All Rights Reserved.