class AnimSprite
|
*
This program is free software; you can redistribute it and/or modify *
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 2 of the License, or *
(at your option) any later version. More... |
|
|
Public Types
- enum TDir {state, right, left, up, down, N, S, E, O, NO, SO, SE, NE}
Public Methods
- AnimSprite (const QString &imgPath, BackGnd* aBackGnd,
unsigned int nbFrames, unsigned int nbDirs)
- void nextFrame ()
- void moveIt ()
- void moveIt (QPoint &destPoint)
- bool atDestination (void)
- void repaint (void)
- bool isLastFrame (void)
- void setPosition (const QPoint &)
- QPoint * getPosition (void)
- void setDestination (Country *)
- Country * getDestination (void)
- void setDestinationPoint (const QPoint &)
- QPoint * getDestinationPoint (void)
- bool isAttacker (void)
- void setAttacker ()
- bool isDefendant (void)
- void setDefendant ()
- bool isNone (void)
- void setNone ()
- int operator == (AnimSprite Arg1)
- void turnTowardDestination (void)
- void changeSequence (const QString &imgPath, unsigned int newNbFrames, unsigned int nbDirs)
- void setLookLeft (void )
- void setLookRight (void)
- bool looksToLeft (void)
- bool looksToRight (void)
- void setupTravelInfantry (Country* src, Country* dest, QPoint* dpi)
- void setupTravelCavalry (Country* src, Country* dest, QPoint* dpcav)
- void setupTravelCannon (Country* src, Country* dest, QPoint* dpcan)
- virtual void setApproachDestByRight ( const bool& _newVal)
- virtual const bool& getApproachDestByRight ()
- virtual void setApproachDestByLeft ( const bool& _newVal)
- virtual const bool& getApproachDestByLeft ()
- virtual void setApproachDestByTop ( const bool& _newVal)
- virtual const bool& getApproachDestByTop ()
- virtual void setApproachDestByBottom ( const bool& _newVal)
- virtual const bool& getApproachDestByBottom ()
- const int getMaxX () const
- const int getMaxY () const
- State getState (void)
- bool isMyState (State state) const
- void setState (State newState)
Protected Methods
Private Methods
Private Members
*
This program is free software; you can redistribute it and/or modify *
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 2 of the License, or *
(at your option) any later version. *
*
*************************************************************************
enum TDir {state, right, left, up, down, N, S, E, O, NO, SO, SE, NE}
| TDir |
AnimSprite (const QString &imgPath, BackGnd* aBackGnd,
unsigned int nbFrames, unsigned int nbDirs)
| AnimSprite |
This constructor allows to create a new AnimSprite whose images are
taken from the given file name with the given number of frames and
number of look directions
void nextFrame ()
| nextFrame |
Change the active frame to the next one in the list. Use the first one
if the current frame was the last one
Moves the sprite by one step towards its destinationPoint.
void moveIt (QPoint &destPoint)
| moveIt |
Moves the sprite by one step towards the point destPoint
bool atDestination (void)
| atDestination |
Return true if the coordinates of the sprite are equal to those of its
destination point ; false elsewhere
void repaint (void)
| repaint |
Hides and shows the sprite. causes it to be repainted
bool isLastFrame (void)
| isLastFrame |
Return true if the current frame is the last one. False elsewhere.
void setPosition (const QPoint &)
| setPosition |
Accessors to some variables
QPoint * getPosition (void)
| getPosition |
void setDestination (Country *)
| setDestination |
Country * getDestination (void)
| getDestination |
void setDestinationPoint (const QPoint &)
| setDestinationPoint |
QPoint * getDestinationPoint (void)
| getDestinationPoint |
bool isAttacker (void)
| isAttacker |
void setAttacker ()
| setAttacker |
bool isDefendant (void)
| isDefendant |
void setDefendant ()
| setDefendant |
bool isNone (void)
| isNone |
Bit to bit comparison
void turnTowardDestination (void)
| turnTowardDestination |
executes setLook towards left or right according to the relative
abscissa of the current position point and the destination point
void changeSequence (const QString &imgPath, unsigned int newNbFrames, unsigned int nbDirs)
| changeSequence |
Change the images sequence of the sprite.
void setLookLeft (void )
| setLookLeft |
void setLookRight (void)
| setLookRight |
bool looksToLeft (void)
| looksToLeft |
bool looksToRight (void)
| looksToRight |
void setupTravelInfantry (Country* src, Country* dest, QPoint* dpi)
| setupTravelInfantry |
This function chooses the approach mode of an infantry sprite towards its
destination:
if the distance between the origin and the destination is higher than half
the size of the map and if the origin and destination countries comunicate,
then the sprite should choose an approach by left or right, through the
edge of the map.
void setupTravelCavalry (Country* src, Country* dest, QPoint* dpcav)
| setupTravelCavalry |
This function chooses the approach mode of a cavalry sprite towards its
destination:
if the distance between the origin and the destination is higher than half
the size of the map and if the origin and destination countries comunicate,
then the sprite should choose an approach by left or right, through the
edge of the map.
void setupTravelCannon (Country* src, Country* dest, QPoint* dpcan)
| setupTravelCannon |
This function chooses the approach mode of a cannon sprite towards its
destination:
if the distance between the origin and the destination is higher than half
the size of the map and if the origin and destination countries comunicate,
then the sprite should choose an approach by left or right, through the
edge of the map.
void setApproachDestByRight ( const bool& _newVal)
| setApproachDestByRight |
[virtual]
const bool& getApproachDestByRight ()
| getApproachDestByRight |
[virtual]
void setApproachDestByLeft ( const bool& _newVal)
| setApproachDestByLeft |
[virtual]
const bool& getApproachDestByLeft ()
| getApproachDestByLeft |
[virtual]
void setApproachDestByTop ( const bool& _newVal)
| setApproachDestByTop |
[virtual]
const bool& getApproachDestByTop ()
| getApproachDestByTop |
[virtual]
void setApproachDestByBottom ( const bool& _newVal)
| setApproachDestByBottom |
[virtual]
const bool& getApproachDestByBottom ()
| getApproachDestByBottom |
[virtual]
const int getMaxX ()
| getMaxX |
[const]
const int getMaxY ()
| getMaxY |
[const]
State getState (void)
| getState |
bool isMyState (State state)
| isMyState |
[const]
void setState (State newState)
| setState |
[private]
QImage bitmapInfo
| bitmapInfo |
[private]
unsigned int nbVersions
| nbVersions |
[private]
[private]
[private]
QPoint destinationPoint
| destinationPoint |
[private]
unsigned int frames
| frames |
[private]
unsigned int actFrame
| actFrame |
[private]
the number of images in the sprite and the current image number
[private]
[private]
[private]
Position informations needed to load graphics from the pool
int spriteHeight
| spriteHeight |
[private]
Position informations needed to load graphics from the pool
int spriteWidth
| spriteWidth |
[private]
Position informations needed to load graphics from the pool
bool approachDestByLeft
| approachDestByLeft |
[private]
bool approachDestByRight
| approachDestByRight |
[private]
bool approachDestByTop
| approachDestByTop |
[private]
bool approachDestByBottom
| approachDestByBottom |
[private]
void sequenceConstruction (void)
| sequenceConstruction |
[private]
updates the sequence of images used by the underlying QCanvasSprite with
the ones taken from the image found at imgPath. It is function of the
direction of the look and the geometry of the sprite
void setLook (TDir)
| setLook |
[private]
changes the direction of my look and calls sequenceConstruction()
void setupTravel (Country* src, Country* dest, QPoint *srcPoint, QPoint *destPoint)
| setupTravel |
[protected]
This function chooses the approach mode of a sprite towards its destination:
if the distance between the origin and the destination is higher than half
the size of the map and if the origin and destination countries comunicate,
then the sprite should choose an approach by left or right, through the
edge of the map.
This protected method will be called by three public functions specialized
using as source point, respectivly, the infantryman point, the cavalryman
point and the cannon point.
Generated by: gael on noirdes.limsi.u-psud.fr on Fri Jan 3 17:03:38 2003, using kdoc 2.0a53. |