Game Control Plus  1.2.2
 All Classes Namespaces Functions Variables Pages
org.gamecontrolplus.gui.MImageManager Class Reference

Static Public Member Functions

static PImage loadImage (PApplet app, String filename)
 
static PImage[] loadImage (PApplet app, String[] filename)
 
static PImage[][] makeTiles2D (PApplet app, PImage img, int nCols, int nRows)
 
static PImage[] makeTiles1D (PApplet app, PImage img, int nCols, int nRows)
 

Static Private Attributes

static HashMap< String, PImage > textures = new HashMap<String, PImage>()
 

Detailed Description

This class is used to load bitmap files and create images.

Although there maybe multiple requests for a particular bitmap file only one PImage is created for each file.

Author
Peter Lager

Member Function Documentation

static PImage org.gamecontrolplus.gui.MImageManager.loadImage ( PApplet  app,
String  filename 
)
static

Load a single bitmap file return a reference to the PImage created.

Parameters
app
filename
Returns
null if the file does not exist else the PImage object
static PImage [] org.gamecontrolplus.gui.MImageManager.loadImage ( PApplet  app,
String[]  filename 
)
static

Load images from multiple files

Parameters
app
filenamean array of filenames
Returns
an array of images
static PImage [] org.gamecontrolplus.gui.MImageManager.makeTiles1D ( PApplet  app,
PImage  img,
int  nCols,
int  nRows 
)
static

Make multiple images from a given image. This method creates a 1D array of PImage objects. The order is left-right and top-down.

Parameters
app
imgthe tiled image
nColsnumber of tiles across
nRowsnumber of tiles down
Returns
a 1D array of images (tiles)
static PImage [][] org.gamecontrolplus.gui.MImageManager.makeTiles2D ( PApplet  app,
PImage  img,
int  nCols,
int  nRows 
)
static

Make multiple images from a given image. This method creates a 2D array (size [nCols, nRows] ) of PImage objects.

Parameters
app
imgthe tiled image
nColsnumber of tiles across
nRowsnumber of tiles down
Returns
a 2D array of images (tiles)