APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.assets.loaders.resolvers

public Class ResolutionFileResolver

extends Object
implements FileHandleResolver
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.assets.loaders.FileHandleResolver
Imports
com.badlogic.gdx.Gdx, com.badlogic.gdx.assets.loaders.FileHandleResolver, com.badlogic.gdx.files.FileHandle

This FileHandleResolver uses a given list of Resolutions to determine the best match based on the current back buffer size. An example of how this resolver works:

Let's assume that we have only a single Resolution added to this resolver. This resolution has the following properties:

One would now supply a file to be found to the resolver. For this example, we assume it is "textures/walls/brick.png". Since there is only a single Resolution, this will be the best match for any screen size. The resolver will now try to find the file in the following ways:

The files are ultimately resolved via the given {baseResolver. In case the first version cannot be resolved, the fallback will try to search for the file without the resolution folder.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
protected final FileHandleResolver
protected final ResolutionFileResolver.Resolution[]

Constructor Summary

AccessConstructor and Description
public
ResolutionFileResolver(FileHandleResolver
The FileHandleResolver that will ultimately used to resolve the file.
baseResolver
,
ResolutionFileResolver.Resolution...
A list of Resolutions. At least one has to be supplied.
descriptors
)

Creates a ResolutionFileResolver based on a given FileHandleResolver and a list of Resolutions.

Method Summary

Modifier and TypeMethod and Description
public static ResolutionFileResolver.Resolution
public FileHandle
protected String
resolve(FileHandle originalHandle, String suffix)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseResolverback to summary
protected final FileHandleResolver baseResolver
descriptorsback to summary
protected final ResolutionFileResolver.Resolution[] descriptors

Constructor Detail

ResolutionFileResolverback to summary
public ResolutionFileResolver(FileHandleResolver baseResolver, ResolutionFileResolver.Resolution... descriptors)

Creates a ResolutionFileResolver based on a given FileHandleResolver and a list of Resolutions.

Parameters
baseResolver:FileHandleResolver

The FileHandleResolver that will ultimately used to resolve the file.

descriptors:ResolutionFileResolver.Resolution[]

A list of Resolutions. At least one has to be supplied.

Method Detail

chooseback to summary
public static ResolutionFileResolver.Resolution choose(ResolutionFileResolver.Resolution... descriptors)
resolveback to summary
public FileHandle resolve(String fileName)

Implements com.badlogic.gdx.assets.loaders.FileHandleResolver.resolve.

Annotations
@Override
resolveback to summary
protected String resolve(FileHandle originalHandle, String suffix)
com.badlogic.gdx.assets.loaders.resolvers back to summary

public Class ResolutionFileResolver.Resolution

extends Object
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.assets.loaders.resolvers.ResolutionFileResolver.Resolution

Field Summary

Modifier and TypeField and Description
public final String
folder

The name of the folder, where the assets which fit this resolution, are located.

public final int
public final int

Constructor Summary

AccessConstructor and Description
public
Resolution(int
This resolution's width.
portraitWidth
,
int
This resolution's height.
portraitHeight
,
String
The name of the folder, where the assets which fit this resolution, are located.
folder
)

Constructs a Resolution.

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

folderback to summary
public final String folder

The name of the folder, where the assets which fit this resolution, are located.

portraitHeightback to summary
public final int portraitHeight
portraitWidthback to summary
public final int portraitWidth

Constructor Detail

Resolutionback to summary
public Resolution(int portraitWidth, int portraitHeight, String folder)

Constructs a Resolution.

Parameters
portraitWidth:int

This resolution's width.

portraitHeight:int

This resolution's height.

folder:String

The name of the folder, where the assets which fit this resolution, are located.