#include <Map.h>
Public Methods | |
Map () | |
Constructor. | |
~Map () | |
Destructor. | |
bool | load (const char *fn) |
Load a map file. | |
void | draw (const Point &pt, int scrWidth, int scrHeight) |
Draws the map around the specified point. | |
void | draw (int scrWidth, int scrHeight, int cameraFlags) |
Draws the map around the specified Entity target that was set in the setCameraTarget method. | |
int | getNumCameras () const |
Returns the number of cameras for this Map. | |
void | setCameraTarget (const Entity *target, int camera) |
Sets the map's camera to look at the given target. | |
const Tile * | getTileAt (const Point &pt) const |
Returns the tile at the supplied point, which must be in the map (passes the !isLocationOutside test). | |
bool | isLocationOutside (const TileLocation &loc) const |
Returns true if the given TileLocation is not on the map -- meaning it is not a valid tile coordinate. | |
bool | isLocationOutside (const Point &pt) const |
Returns true if the given Point is not on the map -- meaning it is not a valid tile coordinate. | |
bool | isLocationOutside (const Point3D &pt) const |
Returns true if the given Point is not on the map -- meaning it is not a valid tile coordinate. | |
bool | isLocationOutside (const Rect &r) const |
Returns true if any point of the given Rect is off the map. | |
int | getRectHeight (const Rect &r) const |
Returns the highest height on the map in the given Rect. | |
int | getPointHeight (const Point &p) const |
Returns the height of the tile specified by the given point. | |
int | getPointHeight (const Point3D &p) const |
Returns the height of the tile specified by the given point. | |
void | addToRenderList (Drawable &obj) |
Adds the given object to the rendering list. | |
void | clearRenderList () |
Clears all Entities that were added to the render list. | |
int | getMapLength () const |
Returns the length of the map. | |
int | getMapWidth () const |
Returns the width of the map. | |
Point | getStartingPoint () |
Randomly selects one of the starting points specified in the map. | |
void | addPowerups () |
Adds the powerups in this map to the game. | |
Static Public Methods | |
Point | getScreenTileOffset (const Point &pt, float startX, float startY) |
Given the point in map coordinates, returns the screen coordinate offset from the given startX and startY. | |
Static Public Attributes | |
const int | CAMERA0 = 1 |
Flag for the first camera. | |
const int | CAMERA1 = 2 |
Flag for the second camera. |
A Map in Super IsoBomb consists of a rectangular grid of tiles each 1.0f wide and 1.0f tall. Specifing world coordinates in this way makes interpreting values easier, eliminates multiplations, and provides a very easy conversion from world coordinates into integer tile coordinates.
A Map can also render itself and all of the objects onto a screen. It supports two camera targets for split screen.
|
Constructor.
|
|
Destructor.
|
|
Adds the powerups in this map to the game.
|
|
Adds the given object to the rendering list. The given object must be inside of the map coordinates. The parameter "obj" is not modified, but must be mutable since the Drawable::draw method is allowed to be mutable.
|
|
Clears all Entities that were added to the render list. An Entity must be removed from the list before it can change map location. |
|
Draws the map around the specified Entity target that was set in the setCameraTarget method. If a target is not set, the map is centered on the point 0, 0. The cameraFlags parameter is constructed by bitwise ORing the flags for the cameras you want to show (CAMERA0, CAMERA1). If more than one camera is displayed, the given area is split up into different viewports.
|
|
Draws the map around the specified point. Must be called between a Begin/End scene pair. All entities added to the render list are rendered with Entity::draw if their tile is on the screen. This version of draw ignores the camera target that was set with setCameraTarget.
|
|
Returns the length of the map.
|
|
Returns the width of the map.
|
|
Returns the number of cameras for this Map. Currently returns 2. |
|
Returns the height of the tile specified by the given point. The given point must be on the map (therefore it should pass the isLocationOutside test before this call. |
|
Returns the height of the tile specified by the given point. The given point must be on the map (therefore it should pass the isLocationOutside test before this call. |
|
Returns the highest height on the map in the given Rect. The Rect's width and height must both be < 1.0 for this method to work properly. |
|
Given the point in map coordinates, returns the screen coordinate offset from the given startX and startY. This implements isometric projection (2:1 ratio). |
|
Randomly selects one of the starting points specified in the map. Removes the selected point from the list to ensure that the same point isn't picked for both players.
|
|
Returns the tile at the supplied point, which must be in the map (passes the !isLocationOutside test).
|
|
Returns true if any point of the given Rect is off the map.
|
|
Returns true if the given Point is not on the map -- meaning it is not a valid tile coordinate.
|
|
Returns true if the given Point is not on the map -- meaning it is not a valid tile coordinate.
|
|
Returns true if the given TileLocation is not on the map -- meaning it is not a valid tile coordinate.
|
|
Load a map file.
|
|
Sets the map's camera to look at the given target. Every time the renderer is called with the draw method, Map examines this Entity's position as information to center the view about. You can pass NULL to the parameter target to unset the current camera target. A camera must have a target set in order to be rendered. Map has several cameras (2 at this time). The camera parameter denotes which camera to set the target for. The first camera is camera 0, the second 1, and so on. |
|
Flag for the first camera.
|
|
Flag for the second camera.
|