|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.resources.ResourceManager
public class ResourceManager
Class for getting resources (images, audio etc).
| Field Summary | |
|---|---|
private static ResourceMapping |
baseMapping
|
private static ResourceMapping |
campaignMapping
|
private static boolean |
dirty
|
private static java.awt.Dimension |
lastWindowSize
|
private static ResourceMapping |
mergedContainer
|
private static java.util.List<ResourceMapping> |
modMappings
|
private static java.lang.Thread |
preloadThread
|
private static ResourceMapping |
scenarioMapping
|
private static ResourceMapping |
tcMapping
|
| Constructor Summary | |
|---|---|
ResourceManager()
|
|
| Method Summary | ||
|---|---|---|
private static void |
createMergedContainer()
Creates a merged container for easy access to resources. |
|
static java.awt.Color |
getColor(java.lang.String resource)
Returns the Color with the given name. |
|
static java.awt.Image |
getGrayscaleImage(java.lang.String resource,
java.awt.Dimension size)
Returns the a grayscale version of the image specified by the given name. |
|
static java.awt.Image |
getGrayscaleImage(java.lang.String resource,
double scale)
Returns the grayscale version of the image specified by the given name. |
|
static java.awt.Image |
getImage(java.lang.String resource)
Returns the image specified by the given name. |
|
static java.awt.Image |
getImage(java.lang.String resource,
java.awt.Dimension size)
Returns the image specified by the given name. |
|
static java.awt.Image |
getImage(java.lang.String resource,
double scale)
Returns the image specified by the given name. |
|
static javax.swing.ImageIcon |
getImageIcon(java.lang.String resource)
Creates an ImageIcon for the image of
the given name. |
|
private static
|
getResource(java.lang.String resourceId,
java.lang.Class<T> type)
Returns the resource of the given type. |
|
static SimpleZippedAnimation |
getSimpleZippedAnimation(java.lang.String resource)
Returns the animation specified by the given name. |
|
static SimpleZippedAnimation |
getSimpleZippedAnimation(java.lang.String resource,
double scale)
Returns the animation specified by the given name. |
|
static Video |
getVideo(java.lang.String resource)
Gets the Video represented by the given resource. |
|
static void |
preload(java.awt.Dimension windowSize)
Preload resources. |
|
static void |
setBaseMapping(ResourceMapping _baseMapping)
Sets the mappings specified in the date/base-directory |
|
static void |
setCampaignMapping(ResourceMapping _campaignMapping)
Sets the mappings specified in a campaign. |
|
static void |
setModMappings(java.util.List<ResourceMapping> _modMappings)
Sets the mappings specified by mods. |
|
static void |
setScenarioMapping(ResourceMapping _scenarioMapping)
Sets the mappings specified in a scenario. |
|
static void |
setTcMapping(ResourceMapping _tcMapping)
Sets the mappings specified for a Total Conversion (TC). |
|
static void |
startBackgroundPreloading(java.awt.Dimension windowSize)
Starts background preloading of resources. |
|
private static void |
updateIfDirty()
Updates the resource mappings after making changes. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static ResourceMapping baseMapping
private static ResourceMapping tcMapping
private static ResourceMapping campaignMapping
private static ResourceMapping scenarioMapping
private static java.util.List<ResourceMapping> modMappings
private static ResourceMapping mergedContainer
private static volatile java.lang.Thread preloadThread
private static volatile boolean dirty
private static java.awt.Dimension lastWindowSize
| Constructor Detail |
|---|
public ResourceManager()
| Method Detail |
|---|
public static void setBaseMapping(ResourceMapping _baseMapping)
_baseMapping - The mapping between IDs and files.public static void setTcMapping(ResourceMapping _tcMapping)
_tcMapping - The mapping between IDs and files.public static void setModMappings(java.util.List<ResourceMapping> _modMappings)
_modMappings - A list of the mapping between IDs and files.public static void setCampaignMapping(ResourceMapping _campaignMapping)
_campaignMapping - The mapping between IDs and files.public static void setScenarioMapping(ResourceMapping _scenarioMapping)
_scenarioMapping - The mapping between IDs and files.public static void preload(java.awt.Dimension windowSize)
background preloading thread
is started.
windowSize - public static void startBackgroundPreloading(java.awt.Dimension windowSize)
windowSize - The window size to use when scaling
full screen size images.private static void updateIfDirty()
private static void createMergedContainer()
private static <T> T getResource(java.lang.String resourceId,
java.lang.Class<T> type)
T - The type of the resource to get.resourceId - The resource to get.type - The type of the resource to get.
null.public static SimpleZippedAnimation getSimpleZippedAnimation(java.lang.String resource)
resource - The name of the resource to return.
resource
or null if there is no animation
identified by that name.public static Video getVideo(java.lang.String resource)
Video represented by the given resource.
Video in it's original size.
public static SimpleZippedAnimation getSimpleZippedAnimation(java.lang.String resource,
double scale)
resource - The name of the resource to return.scale - The size of the requested animation (with 1
being normal size, 2 twice the size, 0.5 half the
size etc). Rescaling will be performed unless using 1.
resource
or null if there is no animation
identified by that name.public static java.awt.Image getImage(java.lang.String resource)
resource - The name of the resource to return.
resource
or null if there is no image
identified by that name.
public static java.awt.Image getImage(java.lang.String resource,
double scale)
resource - The name of the resource to return.scale - The size of the requested image (with 1 being normal size,
2 twice the size, 0.5 half the size etc). Rescaling
will be performed unless using 1.
resource
or null if there is no image
identified by that name.
public static java.awt.Image getImage(java.lang.String resource,
java.awt.Dimension size)
resource - The name of the resource to return.size - The size of the requested image. Rescaling
will be performed if necessary.
resource
or null if there is no image
identified by that name.
public static java.awt.Image getGrayscaleImage(java.lang.String resource,
java.awt.Dimension size)
resource - The name of the resource to return.size - The size of the requested image. Rescaling
will be performed if necessary.
resource
or null if there is no image
identified by that name.
public static java.awt.Image getGrayscaleImage(java.lang.String resource,
double scale)
resource - The name of the resource to return.scale - The size of the requested image (with 1 being normal size,
2 twice the size, 0.5 half the size etc). Rescaling
will be performed unless using 1.
resource
or null if there is no image
identified by that name.public static javax.swing.ImageIcon getImageIcon(java.lang.String resource)
ImageIcon for the image of
the given name.
resource - The name of the resource to return.
ImageIcon created with the image
identified by resource or
null if there is no image identified
by that name.getImage(String)public static java.awt.Color getColor(java.lang.String resource)
Color with the given name.
resource - The name of the resource to return.
Color created with the image
identified by resource or
null if there is no color identified
by that name.getImage(String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||