Advanced Strategic Command
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
MapDisplayPG Class Reference

#include <mapdisplay.h>

Inheritance diagram for MapDisplayPG:
Inheritance graph
[legend]

Classes

struct  Cursor
 
class  CursorHiding
 
class  LockDisplay
 
struct  Movement
 
struct  MovementMask
 

Public Member Functions

void changeZoom (int delta)
 
void setNewZoom (int zoom)
 
int getZoom () const
 
MapCoordinate screenPos2mapPos (const SPoint &pos)
 
MapCoordinate widgetPos2mapPos (const SPoint &pos)
 
SPoint mapGlobalPos2internalPos (const MapCoordinate &pos)
 
SPoint mapViewPos2internalPos (const MapCoordinate &pos)
 
SPoint internal2widget (const SPoint &pos)
 
SPoint widget2screen (const SPoint &pos)
 
MapCoordinate upperLeftCorner ()
 
MapCoordinate lowerRightCorner ()
 
bool fieldCompletelyInViewX (const MapCoordinate &pos)
 
bool fieldCompletelyInViewY (const MapCoordinate &pos)
 
bool fieldCompletelyInView (const MapCoordinate &pos)
 
void keyboadCursorMovement (bool enable)
 
void scrollMap (int dir)
 
 MapDisplayPG (MainScreenWidget *parent, const PG_Rect r)
 
void displayUnitMovement (GameMap *actmap, Vehicle *veh, const MapCoordinate3D &from, const MapCoordinate3D &to, int duration)
 
bool fieldInView (const MapCoordinate &mc)
 
bool centerOnField (const MapCoordinate &mc)
 
void registerAdditionalUnit (Vehicle *veh)
 
void updateMap (bool force=false)
 repaints to the internal surface, but does not blit this surface the screen More...
 
void updateWidget ()
 update the internal surface and blits it to the screen More...
 
void addMapLayer (MapLayer *layer, const ASCString &name)
 
void activateMapLayer (const ASCString &name, bool active)
 
void toggleMapLayer (const ASCString &name)
 
bool layerActive (const ASCString &name)
 
void getActiveLayers (vector< ASCString > &list)
 
int setSignalPriority (int priority)
 
 ~MapDisplayPG ()
 

Public Attributes

sigc::signal< void, int > newZoom
 
sigc::signal< void, bool,
const ASCString & > 
layerChanged
 
sigc::signal< bool, const
MapCoordinate &, const SPoint
&, bool, int, int > 
mouseButtonOnField
 Signal that is fired when the mouse is pressed on a valid field, after the cursor evaluation has been run. More...
 
sigc::signal< bool, const
MapCoordinate &, const SPoint
&, bool, int > 
mouseDraggedToField
 Signal that is fired when the mouse is dragged onto a new field with mouse buttons pressed. More...
 
struct MapDisplayPG::Cursor cursor
 

Protected Member Functions

void eventBlit (SDL_Surface *srf, const PG_Rect &src, const PG_Rect &dst)
 
bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
 
bool eventMouseMotion (const SDL_MouseMotionEvent *button)
 
bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
 
void checkViewPosition (MapCoordinate &pos)
 
void fillSurface (int playerView)
 
void paintBackground ()
 
void blitInternalSurface (SDL_Surface *dest, const SPoint &pnt, const PG_Rect &dstClip)
 
void displayAddons (Surface &surf, int pass)
 
void initMovementStructure ()
 
Surface createMovementBufferSurface ()
 
void displayMovementStep (Movement &movement, int percentage)
 
bool eventKeyDown (const SDL_KeyboardEvent *key)
 
bool keyboardHandler (PG_MessageObject *o, const SDL_KeyboardEvent *keyEvent)
 
- Protected Member Functions inherited from MapRenderer
 MapRenderer ()
 
void paintUnitOntoField (const MapRenderer::FieldRenderInfo &fieldInfo, int binaryUnitHeight, const SPoint &pos, Vehicle *vehicle)
 
int getFieldPosX (int x, int y)
 
int getFieldPosY (int x, int y)
 
SPoint getFieldPos (int x, int y)
 
SPoint getFieldPos2 (const MapCoordinate &pos)
 
void paintSingleField (const MapRenderer::FieldRenderInfo &fieldInfo, int layer, const SPoint &pos)
 
void paintTerrain (Surface &surf, GameMap *actmap, int playerView, const ViewPort &viewPort, const MapCoordinate &offset)
 
void paintBackground (Surface &surf, const ViewPort &viewPort)
 
void paintBackgroundField (Surface &surf, SPoint pos)
 
int bitmappedHeight2pass (int height)
 
void addMapLayer (MapLayer *mapLayer)
 

Protected Attributes

struct MapDisplayPG::MovementMask movementMask [sidenum]
 
bool disableKeyboardCursorMovement
 
- Protected Attributes inherited from MapRenderer
sigc::signal< void, Surface
&, int > 
additionalItemDisplayHook
 

Static Protected Attributes

static const int effectiveMovementSurfaceWidth = 4 * fielddisthalfx + fieldsizex
 
static const int effectiveMovementSurfaceHeight = 4*fieldsizey
 
- Static Protected Attributes inherited from MapRenderer
static const int surfaceBorder = 90
 

Friends

class CursorHiding
 
class LockDisplay
 

Detailed Description

Definition at line 130 of file mapdisplay.h.

Constructor & Destructor Documentation

MapDisplayPG::MapDisplayPG ( MainScreenWidget parent,
const PG_Rect  r 
)
MapDisplayPG::~MapDisplayPG ( )

Definition at line 682 of file mapdisplay.cpp.

Member Function Documentation

void MapDisplayPG::activateMapLayer ( const ASCString name,
bool  active 
)
void MapDisplayPG::addMapLayer ( MapLayer layer,
const ASCString name 
)
void MapDisplayPG::blitInternalSurface ( SDL_Surface *  dest,
const SPoint pnt,
const PG_Rect &  dstClip 
)
protected
bool MapDisplayPG::centerOnField ( const MapCoordinate mc)
void MapDisplayPG::changeZoom ( int  delta)
inline

Definition at line 190 of file mapdisplay.h.

References getZoom(), and setNewZoom().

Referenced by eventMouseButtonDown(), execaction_pg(), and executeUserAction().

void MapDisplayPG::checkViewPosition ( MapCoordinate pos)
protected
Surface MapDisplayPG::createMovementBufferSurface ( )
protected
void MapDisplayPG::displayAddons ( Surface surf,
int  pass 
)
protected
void MapDisplayPG::displayMovementStep ( Movement movement,
int  percentage 
)
protected
void MapDisplayPG::displayUnitMovement ( GameMap actmap,
Vehicle veh,
const MapCoordinate3D from,
const MapCoordinate3D to,
int  duration 
)
void MapDisplayPG::eventBlit ( SDL_Surface *  srf,
const PG_Rect &  src,
const PG_Rect &  dst 
)
protected
bool MapDisplayPG::eventKeyDown ( const SDL_KeyboardEvent *  key)
inlineprotected

Definition at line 256 of file mapdisplay.h.

References keyboardHandler().

bool MapDisplayPG::eventMouseButtonDown ( const SDL_MouseButtonEvent *  button)
protected
bool MapDisplayPG::eventMouseButtonUp ( const SDL_MouseButtonEvent *  button)
protected

Definition at line 1097 of file mapdisplay.cpp.

bool MapDisplayPG::eventMouseMotion ( const SDL_MouseMotionEvent *  button)
protected
bool MapDisplayPG::fieldCompletelyInView ( const MapCoordinate pos)
bool MapDisplayPG::fieldCompletelyInViewX ( const MapCoordinate pos)
bool MapDisplayPG::fieldCompletelyInViewY ( const MapCoordinate pos)
bool MapDisplayPG::fieldInView ( const MapCoordinate mc)
void MapDisplayPG::fillSurface ( int  playerView)
protected

Definition at line 738 of file mapdisplay.cpp.

References actmap, checkViewPosition(), paintBackground(), and MapRenderer::paintTerrain().

Referenced by updateMap().

void MapDisplayPG::getActiveLayers ( vector< ASCString > &  list)

Definition at line 1755 of file mapdisplay.cpp.

int MapDisplayPG::getZoom ( ) const
inline

Definition at line 192 of file mapdisplay.h.

Referenced by changeZoom(), and MapInfoPanel::MapInfoPanel().

void MapDisplayPG::initMovementStructure ( )
protected
SPoint MapDisplayPG::internal2widget ( const SPoint pos)
void MapDisplayPG::keyboadCursorMovement ( bool  enable)
inline

Definition at line 266 of file mapdisplay.h.

References disableKeyboardCursorMovement.

Referenced by NewGuiHost::eventKeyDown(), and NewGuiHost::eventKeyUp().

bool MapDisplayPG::keyboardHandler ( PG_MessageObject *  o,
const SDL_KeyboardEvent *  keyEvent 
)
protected

Definition at line 1658 of file mapdisplay.cpp.

References actmap, and disableKeyboardCursorMovement.

Referenced by eventKeyDown(), and MapDisplayPG().

bool MapDisplayPG::layerActive ( const ASCString name)

Definition at line 1745 of file mapdisplay.cpp.

Referenced by MapInfoPanel::MapInfoPanel().

MapCoordinate MapDisplayPG::lowerRightCorner ( )

Definition at line 952 of file mapdisplay.cpp.

References MapCoordinate::x, and MapCoordinate::y.

Referenced by OverviewMapPanel::painter(), and Weathercast::painter().

SPoint MapDisplayPG::mapGlobalPos2internalPos ( const MapCoordinate pos)
SPoint MapDisplayPG::mapViewPos2internalPos ( const MapCoordinate pos)

Definition at line 903 of file mapdisplay.cpp.

References MapRenderer::getFieldPos(), MapCoordinate::x, and MapCoordinate::y.

Referenced by displayAddons().

void MapDisplayPG::paintBackground ( )
protected

Definition at line 750 of file mapdisplay.cpp.

References MapRenderer::paintBackground().

Referenced by fillSurface().

void MapDisplayPG::registerAdditionalUnit ( Vehicle veh)

Definition at line 1715 of file mapdisplay.cpp.

Referenced by PG_MapDisplay::displayMap().

MapCoordinate MapDisplayPG::screenPos2mapPos ( const SPoint pos)

Definition at line 921 of file mapdisplay.cpp.

References widgetPos2mapPos().

Referenced by eventMouseButtonDown(), and eventMouseMotion().

void MapDisplayPG::scrollMap ( int  dir)
void MapDisplayPG::setNewZoom ( int  zoom)
int MapDisplayPG::setSignalPriority ( int  priority)

Definition at line 989 of file mapdisplay.cpp.

Referenced by SelectFromMap::SelectFromMap(), and SelectFromMap::~SelectFromMap().

void MapDisplayPG::toggleMapLayer ( const ASCString name)

Definition at line 1736 of file mapdisplay.cpp.

References layerChanged.

Referenced by execaction(), executeUserAction(), and MainScreenWidget::toggleMapLayer().

void MapDisplayPG::updateMap ( bool  force = false)

repaints to the internal surface, but does not blit this surface the screen

Definition at line 785 of file mapdisplay.cpp.

References actmap, fillSurface(), and GameMap::getPlayerView().

Referenced by eventBlit(), and updateWidget().

void MapDisplayPG::updateWidget ( )

update the internal surface and blits it to the screen

Definition at line 794 of file mapdisplay.cpp.

References updateMap().

Referenced by MapDisplayPG().

MapCoordinate MapDisplayPG::upperLeftCorner ( )
SPoint MapDisplayPG::widget2screen ( const SPoint pos)
MapCoordinate MapDisplayPG::widgetPos2mapPos ( const SPoint pos)

Friends And Related Function Documentation

friend class CursorHiding
friend

Definition at line 344 of file mapdisplay.h.

friend class LockDisplay
friend

Definition at line 355 of file mapdisplay.h.

Member Data Documentation

struct MapDisplayPG::Cursor MapDisplayPG::cursor
bool MapDisplayPG::disableKeyboardCursorMovement
protected

Definition at line 263 of file mapdisplay.h.

Referenced by keyboadCursorMovement(), and keyboardHandler().

const int MapDisplayPG::effectiveMovementSurfaceHeight = 4*fieldsizey
staticprotected

Definition at line 219 of file mapdisplay.h.

Referenced by createMovementBufferSurface().

const int MapDisplayPG::effectiveMovementSurfaceWidth = 4 * fielddisthalfx + fieldsizex
staticprotected

Definition at line 218 of file mapdisplay.h.

Referenced by createMovementBufferSurface().

sigc::signal<void, bool, const ASCString&> MapDisplayPG::layerChanged
sigc::signal<bool,const MapCoordinate&, const SPoint&, bool, int, int> MapDisplayPG::mouseButtonOnField

Signal that is fired when the mouse is pressed on a valid field, after the cursor evaluation has been run.

Parameters
MapCoordinatethe Coordinate of the field that was clicked
SPointthe mouse position
booltrue if the cursor had been repositioned
intthe button that was pressed
intthe priority of the signal

Definition at line 314 of file mapdisplay.h.

Referenced by eventMouseButtonDown(), Maped_MainScreenWidget::Maped_MainScreenWidget(), NewGuiHost::NewGuiHost(), and SelectFromMap::SelectFromMap().

sigc::signal<bool,const MapCoordinate&, const SPoint&, bool, int> MapDisplayPG::mouseDraggedToField

Signal that is fired when the mouse is dragged onto a new field with mouse buttons pressed.

Parameters
MapCoordinatethe Coordinate of the field that was clicked
SPointthe mouse position
booltrue if the cursor had been repositioned
intthe priority of the signal

Definition at line 322 of file mapdisplay.h.

Referenced by eventMouseMotion(), and Maped_MainScreenWidget::Maped_MainScreenWidget().

struct MapDisplayPG::MovementMask MapDisplayPG::movementMask[sidenum]
protected
sigc::signal<void, int> MapDisplayPG::newZoom

Definition at line 192 of file mapdisplay.h.

Referenced by MapInfoPanel::MapInfoPanel(), and setNewZoom().


The documentation for this class was generated from the following files: