AI for Games 1.1.1
Loading...
Searching...
No Matches
game2dai.entityshapes.ps.ImageBank Class Reference

Static Public Member Functions

static PImage[] getImage (PApplet app, String filename)
 
static PImage[] getImage (PApplet app, String filename, int nbrCols, int nbrRows)
 

Static Private Member Functions

static PImage[] makeImageArray (PApplet app, PImage img, int nCols, int nRows)
 

Static Private Attributes

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

Detailed Description

Utility class to load and tile images.

Author
Peter Lager

Member Function Documentation

◆ getImage() [1/2]

static PImage[] game2dai.entityshapes.ps.ImageBank.getImage ( PApplet  app,
String  filename 
)
static

Load a bitmap file and return a reference to an array (size will be 1) with the image as the sole frame.

Parameters
appthe PApplet object (sketch)
filenamethe name of the bitmap file
Returns
an array containing a single PImages that represent the sole frame to flip through

◆ getImage() [2/2]

static PImage[] game2dai.entityshapes.ps.ImageBank.getImage ( PApplet  app,
String  filename,
int  nbrCols,
int  nbrRows 
)
static

Load a bitmap file and create an array of PImages to represent a sequence of frames to flip through when drawing.
The frame numbers increase left to right and top down.

Parameters
appthe PApplet object (sketch)
filenamethe name of the bitmap file
nbrColsnumber of horizontal tiles in the image
nbrRowsnumber of vertical tiles in the image
Returns
an array of PImages that represent the frames to flip through else null if file does not exist

◆ makeImageArray()

static PImage[] game2dai.entityshapes.ps.ImageBank.makeImageArray ( PApplet  app,
PImage  img,
int  nCols,
int  nRows 
)
staticprivate

Split the image up into a number of frames

Parameters
app
img
nCols
nRows
Returns
the frames as an array of PImage(s)

The documentation for this class was generated from the following file: