|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.kernel.CameraManager
Keeps track of dirty maps and dirty cameras. Dirty maps are maps that have had a visible event. Any cameras that could see the event need to be refreshed. Dirty cameras are cameras that have become fully invalid by moving or entering a new map.
Note: this class has static methods for manipulating cameras, but this is NOT the correct way to move them around. You should call the camera move/position methods directly, and they will call the CameraManager methods to get refreshed.
Under the current scheduler design, camera refreshes currently have to be done on the event-processing thread as an event. This ensures that the maps aren't being updated during a camera refresh. (This is fixable, long-term.)
We only want a camera refresh to happen if both the following conditions are met:
The whole system is incredibly inefficient and needs a redesign.
Method Summary | |
static void |
addCamera(GameMap map,
Camera camera)
Registers a camera with a specified map. |
static void |
dirtyCamera(Camera camera)
Notifies the CameraManager that a camera wants to be refreshed, regardless of whether any changes have occurred in the map the camera is viewing. |
static void |
dirtyMap(GameMap map)
Notifies the CameraManager that a map has become visually dirty, so that on the next refresh it will be processed. |
static void |
flushCameras()
Flushes all changes to all maps that we've gathered since the last refresh. |
static java.util.Map |
getCameras(GameMap map)
|
static java.lang.String |
getProfilingInfo()
Returns profiling information about the cameras, for debugging. |
static void |
invalidateCameras(GameMap map,
int x,
int y)
Invalidates all the cameras that can see (x, y). |
static void |
printMaps()
Prints the maps and their camera sets. |
static void |
removeCamera(GameMap map,
Camera camera)
Unregisters a camera from a map. |
static void |
removeMap(GameMap map)
Notifies the CameraManager that a map should be removed from the lists, usually because it's being unloaded. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void addCamera(GameMap map, Camera camera)
camera
- the camera to addmap
- the map the camera wants to viewpublic static void removeCamera(GameMap map, Camera camera)
camera
- the Camera to unregistermap
- the map to remove the camera frompublic static void dirtyMap(GameMap map)
map
- the GameMap that's become dirtypublic static void removeMap(GameMap map)
public static void dirtyCamera(Camera camera)
camera
- the camera to refresh, at kernel refresh-timepublic static void invalidateCameras(GameMap map, int x, int y)
map
- the mapx
- map x locationy
- map y locationpublic static void flushCameras()
public static java.util.Map getCameras(GameMap map)
public static void printMaps()
public static java.lang.String getProfilingInfo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |