$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <ui.h>
map_draw.cpp - The map drawing. | |
~CViewport () | |
bool | IsInsideMapArea (int x, int y) const |
Check if X and Y pixels are within map area. | |
int | Viewport2MapX (int x) const |
Convert screen X pixel to map tile. | |
int | Viewport2MapY (int y) const |
Convert screen Y pixel to map tile. | |
int | Map2ViewportX (int x) const |
Convert map tile to screen X pixel. | |
int | Map2ViewportY (int y) const |
Convert map tile to screen Y pixel. | |
void | MapPixel2Viewport (int &x, int &y) const |
Convert map pixel coordinates into viewport coordinates. | |
void | Set (int x, int y, int offsetx, int offsety) |
Set the current map view to x,y(upper,left corner). | |
void | Center (const Vec2i &pos, const PixelPos &offset) |
Center map on point in viewport. | |
void | UpdateUnits () |
void | Draw () const |
Draw the full Viewport. | |
void | DrawBorder () const |
bool | AnyMapAreaVisibleInViewport (int sx, int sy, int ex, int ey) const |
Check if any part of an area is visible in viewport. | |
void | DrawMapBackgroundInViewport () const |
Draw the map background. | |
Public Member Functions | |
CViewport () | |
Public Attributes | |
int | X |
int | Y |
Screen pixel left corner x coordinate. | |
int | EndX |
Screen pixel upper corner y coordinate. | |
int | EndY |
Screen pixel right x coordinate. | |
int | MapX |
Screen pixel bottom y coordinate. | |
int | MapY |
Map tile left corner x coordinate. | |
int | OffsetX |
Map tile upper corner y coordinate. | |
int | OffsetY |
X Offset within MapX. | |
int | MapWidth |
Y Offset within MapY. | |
int | MapHeight |
Width in map tiles. | |
CUnit * | Unit |
Height in map tiles. | |
CDrawProxy * | Proxy |
Bound to this unit. | |
Protected Member Functions | |
map_fog.cpp - The map fog of war handling. | |
void | DrawMapFogOfWar () const |
Draw the map fog of war. |
A part of the map displayed on sceen.
CViewport::X CViewport::Y CViewport::EndX CViewport::EndY
upper left corner of this viewport is located at pixel coordinates (X, Y) with respect to upper left corner of stratagus's window, similarly lower right corner of this viewport is (EndX, EndY) 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 | ( | ) | [inline] |
CViewport::~CViewport | ( | ) |
bool CViewport::IsInsideMapArea | ( | int | x, | |
int | y | |||
) | const |
Check if X and Y pixels are within map area.
int CViewport::Viewport2MapX | ( | int | x | ) | const |
Convert screen X pixel to map tile.
Convert viewport x coordinate to map tile x coordinate.
x | X coordinate into this viewport (in pixels, relative to origin of Stratagus's window - not the viewport itself!). |
int CViewport::Viewport2MapY | ( | int | y | ) | const |
Convert screen Y pixel to map tile.
Convert viewport y coordinate to map tile y coordinate.
y | Y coordinate into this viewport (in pixels, relative to origin of Stratagus's window - not the viewport itself!). |
int CViewport::Map2ViewportX | ( | int | x | ) | const |
Convert map tile to screen X pixel.
Convert a map tile X coordinate into a viewport x pixel coordinate.
x | The map tile's X coordinate. |
int CViewport::Map2ViewportY | ( | int | y | ) | const |
Convert map tile to screen Y pixel.
Convert a map tile Y coordinate into a viewport y pixel coordinate.
y | The map tile's Y coordinate. |
void CViewport::MapPixel2Viewport | ( | int & | x, | |
int & | y | |||
) | const |
Convert map pixel coordinates into viewport coordinates.
Convert map pixel coordinates into viewport coordinates.
void CViewport::Set | ( | int | x, | |
int | y, | |||
int | offsetx, | |||
int | offsety | |||
) |
Set the current map view to x,y(upper,left corner).
Change viewpoint of map viewport v to x,y.
x | X map tile position. | |
y | Y map tile position. | |
offsetx | X offset in tile. | |
offsety | Y offset in tile. |
Center map on point in viewport.
Center map viewport v on map tile (pos).
pos | map tile position. | |
offset | offset in tile. |
void CViewport::DrawMapBackgroundInViewport | ( | ) | const [protected] |
Draw the map background.
Draw the map backgrounds.
StephanR: variables explained below for screen:
*---------------------------------------* | | | *-----------------------* |<-TheUi.MapY,dy (in pixels) | | | | | | | | | | | | | | | | | | | | | |---+---+---+---+---+---| | | | | | | | | | | | |MapHeight (in tiles) | | | | | | | | | | | |---+---+---+---+---+---| | | | | | | | | | | | | | | | | | | | | | | | *-----------------------* |<-ey,UI.MapEndY (in pixels) | | | | *---------------------------------------* ^ ^ dx|-----------------------|ex,UI.MapEndX (in pixels) UI.MapX MapWidth (in tiles) (in pixels)
void CViewport::DrawMapFogOfWar | ( | ) | const [protected] |
Draw the map fog of war.
Draw the map fog of war.
void CViewport::UpdateUnits | ( | ) |
void CViewport::Draw | ( | ) | const |
Draw the full Viewport.
Draw a map viewport.
void CViewport::DrawBorder | ( | ) | const |
Draw border around the viewport
bool CViewport::AnyMapAreaVisibleInViewport | ( | int | sx, | |
int | sy, | |||
int | ex, | |||
int | ey | |||
) | const |
Check if any part of an area is visible in viewport.
Check if any part of an area is visible in a viewport.
sx | X map tile position of area in map to be checked. | |
sy | Y map tile position of area in map to be checked. | |
ex | X map tile position of area in map to be checked. | |
ey | Y map tile position of area in map to be checked. |
int CViewport::X |
int CViewport::Y |
Screen pixel left corner x coordinate.
int CViewport::EndX |
Screen pixel upper corner y coordinate.
int CViewport::EndY |
Screen pixel right x coordinate.
int CViewport::MapX |
Screen pixel bottom y coordinate.
int CViewport::MapY |
Map tile left corner x coordinate.
Map tile upper corner y coordinate.
X Offset within MapX.
Y Offset within MapY.
Width in map tiles.
Height in map tiles.
Bound to this unit.