_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <viewport.h>
Public Member Functions | |
SDL_Surface * | GetFogSurface () |
const PixelPos & | GetTopLeftPos () const |
const PixelPos & | GetBottomRightPos () const |
Static Public Member Functions | |
static bool | isGridEnabled () |
static void | EnableGrid (const bool value) |
Public Attributes | |
PixelPos | TopLeftPos |
PixelPos | BottomRightPos |
Screen pixel top-left corner. More... | |
Vec2i | MapPos |
Screen pixel bottom-right corner. More... | |
PixelDiff | Offset |
Map tile left-upper corner. More... | |
int | MapWidth |
Offset within MapX, MapY. More... | |
int | MapHeight |
Width in map tiles. More... | |
CUnit * | Unit |
Height in map tiles. More... | |
map_draw.cpp - The map drawing. | |
CViewport () | |
~CViewport () | |
bool | IsInsideMapArea (const PixelPos &screenPixelPos) const |
Check if pos pixels are within map area. More... | |
PixelPos | ScreenToMapPixelPos (const PixelPos &screenPixelPos) const |
Convert screen coordinates into map pixel coordinates. More... | |
PixelPos | MapToScreenPixelPos (const PixelPos &mapPixelPos) const |
Vec2i | ScreenToTilePos (const PixelPos &screenPixelPos) const |
convert screen coordinate into tilepos More... | |
PixelPos | TilePosToScreen_TopLeft (const Vec2i &tilePos) const |
convert tilepos coordonates into screen (take the top left of the tile) More... | |
PixelPos | TilePosToScreen_Center (const Vec2i &tilePos) const |
convert tilepos coordonates into screen (take the center of the tile) More... | |
void | Set (const Vec2i &tilePos, const PixelDiff &offset) |
Set the current map view to x,y(upper,left corner) More... | |
void | Center (const PixelPos &mapPixelPos) |
Center map on point in viewport. More... | |
void | SetClipping () const |
void | Draw () |
Draw the full Viewport. More... | |
void | DrawBorder () const |
bool | AnyMapAreaVisibleInViewport (const Vec2i &boxmin, const Vec2i &boxmax) const |
Check if any part of an area is visible in viewport. More... | |
bool | Contains (const PixelPos &screenPos) const |
void | Restrict (int &screenPosX, int &screenPosY) const |
PixelSize | GetPixelSize () const |
map_fog.cpp - The map fog of war handling. | |
void | Clean () |
A map viewport.
A part of the map displayed on screen.
CViewport::TopLeftPos CViewport::BottomRightPos
upper left corner of this viewport is located at pixel coordinates (TopLeftPosTopLeftPos) with respect to upper left corner of stratagus's window, similarly lower right corner of this viewport is (BottomRightPos) pixels away from the UL corner of stratagus's window.
CViewport::MapX CViewport::MapY CViewport::MapWidth CViewport::MapHeight
Tile coordinates of UL corner of this viewport with respect to UL corner of the whole map.
Viewport is bound to a unit. If the unit moves the viewport changes the position together with the unit.
CViewport::CViewport | ( | ) |
CViewport::~CViewport | ( | ) |
Check if any part of an area is visible in viewport.
Check if any part of an area is visible in a viewport.
boxmin | map tile position of area in map to be checked. |
boxmax | map tile position of area in map to be checked. |
Center map on point in viewport.
Center map viewport v on map tile (pos).
mapPixelPos | map pixel position. |
void CViewport::Clean | ( | ) |
bool CViewport::Contains | ( | const PixelPos & | screenPos | ) | const |
void CViewport::Draw | ( | ) |
Draw the full Viewport.
Draw a map viewport.
Draw Fog of War
void CViewport::DrawBorder | ( | ) | const |
Draw border around the viewport
|
inlinestatic |
|
inline |
|
inline |
PixelSize CViewport::GetPixelSize | ( | ) | const |
|
inline |
|
inlinestatic |
bool CViewport::IsInsideMapArea | ( | const PixelPos & | screenPixelPos | ) | const |
Check if pos pixels are within map area.
void CViewport::Restrict | ( | int & | screenPosX, |
int & | screenPosY | ||
) | const |
Convert screen coordinates into map pixel coordinates.
convert screen coordinate into tilepos
Set the current map view to x,y(upper,left corner)
Change viewpoint of map viewport v to tilePos.
tilePos | map tile position. |
offset | offset in tile. |
void CViewport::SetClipping | ( | ) | const |
convert tilepos coordonates into screen (take the center of the tile)
convert tilepos coordonates into screen (take the top left of the tile)
PixelPos CViewport::BottomRightPos |
Screen pixel top-left corner.
int CViewport::MapHeight |
Width in map tiles.
Vec2i CViewport::MapPos |
Screen pixel bottom-right corner.
int CViewport::MapWidth |
Offset within MapX, MapY.
PixelDiff CViewport::Offset |
Map tile left-upper corner.
PixelPos CViewport::TopLeftPos |
CUnit* CViewport::Unit |
Height in map tiles.