T - public class FastXYSorter<T extends java.lang.Comparable<T>>
extends java.lang.Object
| Constructor and Description |
|---|
FastXYSorter(int gridWidth,
int gridHeight,
int expectedElementsPerCell)
Constructor
|
FastXYSorter(int screenWidth,
int screenHeight,
int cellWidth,
int cellHeight,
int expectedElementsPerCell)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int screenX,
int screenY,
int cellWidth,
int cellHeight,
T obj) |
void |
add(int gridX,
int gridY,
T obj)
Add an object to be sorted
|
void |
begin()
Must be called after all calls to
add(int, int, Comparable) are done |
int |
getHeight() |
int |
getOriginX() |
int |
getOriginY() |
int |
getWidth() |
T |
poll()
Returns the next object to render
|
void |
setOrigin(int originX,
int originY)
Useful for setting an origin that is subtracted from values added to the sorter (e.g.
|
public FastXYSorter(int screenWidth,
int screenHeight,
int cellWidth,
int cellHeight,
int expectedElementsPerCell)
screenWidth - The screen width in pixelsscreenHeight - The screen height in pixelscellWidth - The cell width in pixels to divide the screen width bycellHeight - The cell height in pixels to divide the screen height byexpectedElementsPerCell - The expected amount of entities per cellpublic FastXYSorter(int gridWidth,
int gridHeight,
int expectedElementsPerCell)
gridWidth - The width of the gridgridHeight - The height of the gridexpectedElementsPerCell - The expected amount of entities per cellpublic void setOrigin(int originX,
int originY)
originX - The X value to subtractoriginY - The Y value to subtractpublic void add(int screenX,
int screenY,
int cellWidth,
int cellHeight,
T obj)
screenX - The pixel X coordinate of the objectscreenY - The pixel Y coordinate of the objectcellWidth - The width of the cells in pixelscellHeight - The height of the cells in pixelsobj - The object to be addedpublic void add(int gridX,
int gridY,
T obj)
gridX - The grid X coordinate of the objectgridY - The grid Y coordinate of the objectobj - The object to be addedpublic void begin()
add(int, int, Comparable) are donepublic T poll()
public int getWidth()
public int getHeight()
public int getOriginX()
public int getOriginY()