2008-04-07 17:51:46 +00:00
# ifndef CPLAYERINTERFACE_H
# define CPLAYERINTERFACE_H
2007-11-18 22:58:28 +00:00
# include "global.h"
# include "CGameInterface.h"
# include "SDL_framerate.h"
2008-04-07 17:51:46 +00:00
# include <map>
2008-05-18 17:33:39 +00:00
# include <boost/function.hpp>
2008-04-07 17:51:46 +00:00
2007-11-18 22:58:28 +00:00
class CDefEssential ;
2008-05-18 17:33:39 +00:00
class AdventureMapButton ;
2007-11-18 22:58:28 +00:00
class CDefHandler ;
struct HeroMoveDetails ;
class CDefEssential ;
class CGHeroInstance ;
2007-11-23 22:33:55 +00:00
class CAdvMapInt ;
2008-01-09 17:21:31 +00:00
class CCastleInterface ;
2008-03-10 20:19:41 +00:00
class CStack ;
2008-04-07 17:51:46 +00:00
class SComponent ;
class CCreature ;
struct SDL_Surface ;
2008-04-20 15:56:03 +00:00
struct CPath ;
2008-04-07 17:51:46 +00:00
class CCreatureAnimation ;
class CSelectableComponent ;
class CCreatureSet ;
class CGObjectInstance ;
2008-05-18 17:33:39 +00:00
class CSlider ;
2008-04-07 17:51:46 +00:00
2007-12-01 12:50:33 +00:00
class IShowable
{
public :
virtual void show ( SDL_Surface * to = NULL ) = 0 ;
} ;
2008-01-27 20:37:10 +00:00
class IStatusBar
{
public :
virtual ~ IStatusBar ( ) { } ; //d-tor
virtual void print ( std : : string text ) = 0 ; //prints text and refreshes statusbar
virtual void clear ( ) = 0 ; //clears statusbar and refreshes
virtual void show ( ) = 0 ; //shows statusbar (with current text)
virtual std : : string getCurrent ( ) = 0 ;
} ;
2007-12-01 12:50:33 +00:00
class IActivable
{
public :
virtual void activate ( ) = 0 ;
virtual void deactivate ( ) = 0 ;
2008-03-09 23:06:35 +00:00
virtual ~ IActivable ( ) { } ;
2007-12-01 12:50:33 +00:00
} ;
2007-11-18 22:58:28 +00:00
class CIntObject //interface object
{
public :
SDL_Rect pos ;
int ID ;
} ;
2007-12-01 12:50:33 +00:00
class CSimpleWindow : public virtual CIntObject , public IShowable
2007-11-18 22:58:28 +00:00
{
public :
SDL_Surface * bitmap ;
CIntObject * owner ;
2007-12-01 12:50:33 +00:00
virtual void show ( SDL_Surface * to = NULL ) ;
2007-11-18 22:58:28 +00:00
CSimpleWindow ( ) : bitmap ( NULL ) , owner ( NULL ) { } ;
virtual ~ CSimpleWindow ( ) ;
} ;
2007-12-01 12:50:33 +00:00
class CButtonBase : public virtual CIntObject , public IShowable , public IActivable //basic buttton class
2007-11-18 22:58:28 +00:00
{
public :
2008-01-09 17:21:31 +00:00
int bitmapOffset ;
2007-11-18 22:58:28 +00:00
int type ; //advmapbutton=2
bool abs ;
bool active ;
2008-01-27 14:07:51 +00:00
bool notFreeButton ;
2007-11-23 22:33:55 +00:00
CIntObject * ourObj ; // "owner"
2007-11-18 22:58:28 +00:00
int state ;
std : : vector < std : : vector < SDL_Surface * > > imgs ;
int curimg ;
2007-12-01 12:50:33 +00:00
virtual void show ( SDL_Surface * to = NULL ) ;
2007-11-18 22:58:28 +00:00
virtual void activate ( ) = 0 ;
virtual void deactivate ( ) = 0 ;
CButtonBase ( ) ;
2008-01-21 18:22:51 +00:00
virtual ~ CButtonBase ( ) ;
2007-11-18 22:58:28 +00:00
} ;
class ClickableL : public virtual CIntObject //for left-clicks
{
public :
bool pressedL ;
ClickableL ( ) ;
2008-03-16 00:09:43 +00:00
virtual ~ ClickableL ( ) { } ;
2008-04-07 17:51:46 +00:00
virtual void clickLeft ( boost : : logic : : tribool down ) = 0 ;
2007-11-18 22:58:28 +00:00
virtual void activate ( ) = 0 ;
virtual void deactivate ( ) = 0 ;
} ;
class ClickableR : public virtual CIntObject //for right-clicks
{
public :
bool pressedR ;
ClickableR ( ) ;
2008-03-16 00:09:43 +00:00
virtual ~ ClickableR ( ) { } ;
2008-04-07 17:51:46 +00:00
virtual void clickRight ( boost : : logic : : tribool down ) = 0 ;
2007-11-18 22:58:28 +00:00
virtual void activate ( ) = 0 ;
virtual void deactivate ( ) = 0 ;
} ;
class Hoverable : public virtual CIntObject
{
public :
Hoverable ( ) { hovered = false ; }
2008-03-16 00:09:43 +00:00
virtual ~ Hoverable ( ) { } ;
2007-11-18 22:58:28 +00:00
bool hovered ;
virtual void hover ( bool on ) = 0 ;
virtual void activate ( ) = 0 ;
virtual void deactivate ( ) = 0 ;
} ;
class KeyInterested : public virtual CIntObject
{
public :
2008-03-16 00:09:43 +00:00
virtual ~ KeyInterested ( ) { } ;
2007-11-18 22:58:28 +00:00
virtual void keyPressed ( SDL_KeyboardEvent & key ) = 0 ;
virtual void activate ( ) = 0 ;
virtual void deactivate ( ) = 0 ;
} ;
class MotionInterested : public virtual CIntObject
{
public :
2008-04-04 17:30:53 +00:00
bool strongInterest ; //if true - report all mouse movements, if not - only when hovered
MotionInterested ( ) { strongInterest = false ; } ;
2008-03-16 00:09:43 +00:00
virtual ~ MotionInterested ( ) { } ;
2007-11-18 22:58:28 +00:00
virtual void mouseMoved ( SDL_MouseMotionEvent & sEvent ) = 0 ;
virtual void activate ( ) = 0 ;
virtual void deactivate ( ) = 0 ;
} ;
2007-12-19 00:06:51 +00:00
class TimeInterested : public virtual CIntObject
{
public :
2008-03-16 00:09:43 +00:00
virtual ~ TimeInterested ( ) { } ;
2007-12-19 00:06:51 +00:00
int toNextTick ;
virtual void tick ( ) = 0 ;
virtual void activate ( ) ;
virtual void deactivate ( ) ;
} ;
2007-11-23 22:33:55 +00:00
template < typename T > class CSCButton : public CButtonBase , public ClickableL //prosty guzik, ktory tylko zmienia obrazek
{
public :
int3 posr ; //position in the bitmap
int state ;
T * delg ;
2008-04-07 17:51:46 +00:00
void ( T : : * func ) ( boost : : logic : : tribool ) ;
CSCButton ( CDefHandler * img , CIntObject * obj , void ( T : : * poin ) ( boost : : logic : : tribool ) , T * Delg = NULL ) ;
void clickLeft ( boost : : logic : : tribool down ) ;
2007-11-23 22:33:55 +00:00
void activate ( ) ;
void deactivate ( ) ;
2007-12-01 12:50:33 +00:00
void show ( SDL_Surface * to = NULL ) ;
2007-11-23 22:33:55 +00:00
} ;
class CInfoWindow : public CSimpleWindow //text + comp. + ok button
2007-12-27 23:43:36 +00:00
{ //okno usuwa swoje komponenty w chwili zamkniecia
2007-11-23 22:33:55 +00:00
public :
CSCButton < CInfoWindow > okb ;
std : : vector < SComponent * > components ;
2008-04-07 17:51:46 +00:00
virtual void okClicked ( boost : : logic : : tribool down ) ;
2007-12-19 00:06:51 +00:00
virtual void close ( ) ;
2007-11-23 22:33:55 +00:00
CInfoWindow ( ) ;
2007-12-27 00:11:46 +00:00
virtual ~ CInfoWindow ( ) ;
2007-11-23 22:33:55 +00:00
} ;
2007-12-19 00:06:51 +00:00
class CSelWindow : public CInfoWindow //component selection window
2007-12-27 23:43:36 +00:00
{ //uwaga - to okno nie usuwa swoich komponentow przy usuwaniu, moga sie one jeszcze przydac skryptowi - tak wiec skrypt korzystajacyz tego okna musi je usunac
2007-12-25 16:25:53 +00:00
public :
2007-12-27 23:43:36 +00:00
void selectionChange ( CSelectableComponent * to ) ;
2008-04-07 17:51:46 +00:00
void okClicked ( boost : : logic : : tribool down ) ;
2007-12-19 00:06:51 +00:00
void close ( ) ;
2007-12-27 00:11:46 +00:00
CSelWindow ( ) { } ;
2007-12-19 00:06:51 +00:00
} ;
2008-02-18 21:14:28 +00:00
class CRClickPopup : public IShowable , public ClickableR
{
2008-02-22 22:26:31 +00:00
public :
2008-03-06 18:54:35 +00:00
virtual void activate ( ) ;
virtual void deactivate ( ) ;
2008-02-18 21:14:28 +00:00
virtual void close ( ) = 0 ;
2008-04-07 17:51:46 +00:00
void clickRight ( boost : : logic : : tribool down ) ;
2008-02-22 22:26:31 +00:00
virtual ~ CRClickPopup ( ) { } ;
} ;
class CInfoPopup : public CRClickPopup
{
public :
bool free ;
SDL_Surface * bitmap ;
CInfoPopup ( SDL_Surface * Bitmap , int x , int y , bool Free = false ) ;
void close ( ) ;
void show ( SDL_Surface * to = NULL ) ;
2008-03-06 18:54:35 +00:00
CInfoPopup ( ) { free = false ; bitmap = NULL ; }
2008-02-22 22:26:31 +00:00
~ CInfoPopup ( ) { } ;
2008-02-18 21:14:28 +00:00
} ;
2007-11-23 22:33:55 +00:00
class SComponent : public ClickableR
{
public :
enum Etype
{
2007-12-25 16:25:53 +00:00
primskill , secskill , resource , creature , artifact , experience
2007-11-23 22:33:55 +00:00
} type ;
int subtype ;
int val ;
std : : string description ; //r-click
std : : string subtitle ;
SComponent ( Etype Type , int Subtype , int Val ) ;
//SComponent(const & SComponent r);
2008-04-07 17:51:46 +00:00
void clickRight ( boost : : logic : : tribool down ) ;
2007-12-19 00:06:51 +00:00
virtual SDL_Surface * getImg ( ) ;
virtual void activate ( ) ;
virtual void deactivate ( ) ;
} ;
class CSelectableComponent : public SComponent , public ClickableL
{
public :
bool selected ;
2007-12-27 00:11:46 +00:00
bool customB ;
2007-12-19 00:06:51 +00:00
SDL_Surface * border , * myBitmap ;
2007-12-23 16:25:14 +00:00
CSelWindow * owner ;
2008-04-07 17:51:46 +00:00
void clickLeft ( boost : : logic : : tribool down ) ;
2007-12-25 16:25:53 +00:00
CSelectableComponent ( Etype Type , int Sub , int Val , CSelWindow * Owner = NULL , SDL_Surface * Border = NULL ) ;
2007-12-27 00:11:46 +00:00
~ CSelectableComponent ( ) ;
2007-11-23 22:33:55 +00:00
void activate ( ) ;
void deactivate ( ) ;
2007-12-19 00:06:51 +00:00
void select ( bool on ) ;
SDL_Surface * getImg ( ) ;
2007-11-23 22:33:55 +00:00
} ;
2008-01-26 19:36:31 +00:00
class CGarrisonInt ;
class CGarrisonSlot : public ClickableL , public ClickableR , public Hoverable
{
public :
CGarrisonInt * owner ;
const CCreature * creature ;
int count ;
2008-01-29 13:00:45 +00:00
int upg ; //0 - up garrison, 1 - down garrison
2008-04-11 17:41:02 +00:00
bool active ;
2008-01-26 19:36:31 +00:00
virtual void hover ( bool on ) ;
2008-05-31 20:37:54 +00:00
const CArmedInstance * getObj ( ) ;
2008-04-07 17:51:46 +00:00
void clickRight ( boost : : logic : : tribool down ) ;
void clickLeft ( boost : : logic : : tribool down ) ;
2008-01-26 19:36:31 +00:00
void activate ( ) ;
void deactivate ( ) ;
void show ( ) ;
2008-01-28 14:01:09 +00:00
CGarrisonSlot ( CGarrisonInt * Owner , int x , int y , int IID , int Upg = 0 , const CCreature * Creature = NULL , int Count = 0 ) ;
2008-04-11 17:41:02 +00:00
~ CGarrisonSlot ( ) ;
2008-01-26 19:36:31 +00:00
} ;
class CGarrisonInt : public CIntObject
{
public :
int interx , intery ;
CGarrisonSlot * highlighted ;
SDL_Surface * sur ;
2008-04-19 16:15:04 +00:00
int offx , offy , p2 ;
bool ignoreEvent , update , active , splitting , pb ;
2008-01-26 19:36:31 +00:00
const CCreatureSet * set1 ;
const CCreatureSet * set2 ;
std : : vector < CGarrisonSlot * > * sup , * sdown ;
2008-05-31 20:37:54 +00:00
const CArmedInstance * oup , * odown ;
2008-01-26 19:36:31 +00:00
void activate ( ) ;
void deactivate ( ) ;
void show ( ) ;
void activeteSlots ( ) ;
void deactiveteSlots ( ) ;
void deleteSlots ( ) ;
void createSlots ( ) ;
void recreateSlots ( ) ;
2008-04-19 16:15:04 +00:00
void splitClick ( ) ;
void splitStacks ( int am2 ) ;
2008-05-31 20:37:54 +00:00
CGarrisonInt ( int x , int y , int inx , int iny , SDL_Surface * pomsur , int OX , int OY , const CArmedInstance * s1 , const CArmedInstance * s2 = NULL ) ;
2008-01-26 19:36:31 +00:00
~ CGarrisonInt ( ) ;
} ;
2007-11-23 22:33:55 +00:00
2007-11-18 22:58:28 +00:00
class CPlayerInterface : public CGameInterface
{
public :
bool makingTurn ;
2008-01-09 17:21:31 +00:00
SDL_Event * current ;
2008-01-20 12:34:39 +00:00
IActivable * curint ;
2007-11-18 22:58:28 +00:00
CAdvMapInt * adventureInt ;
2008-01-09 17:21:31 +00:00
CCastleInterface * castleInt ;
2007-11-18 22:58:28 +00:00
FPSmanager * mainFPSmng ;
2008-01-27 20:37:10 +00:00
IStatusBar * statusbar ;
2007-11-18 22:58:28 +00:00
//TODO: town interace, battle interface, other interfaces
CCallback * cb ;
std : : vector < ClickableL * > lclickable ;
std : : vector < ClickableR * > rclickable ;
std : : vector < Hoverable * > hoverable ;
std : : vector < KeyInterested * > keyinterested ;
std : : vector < MotionInterested * > motioninterested ;
2007-12-19 00:06:51 +00:00
std : : vector < TimeInterested * > timeinterested ;
2007-12-01 12:50:33 +00:00
std : : vector < IShowable * > objsToBlit ;
2007-11-18 22:58:28 +00:00
2008-02-18 21:14:28 +00:00
SDL_Surface * hInfo , * tInfo ;
2007-11-18 22:58:28 +00:00
std : : vector < std : : pair < int , int > > slotsPos ;
CDefEssential * luck22 , * luck30 , * luck42 , * luck82 ,
2008-02-18 21:14:28 +00:00
* morale22 , * morale30 , * morale42 , * morale82 ,
* halls , * forts , * bigTownPic ;
2007-12-19 00:06:51 +00:00
std : : map < int , SDL_Surface * > heroWins ;
2008-02-18 21:14:28 +00:00
std : : map < int , SDL_Surface * > townWins ;
2007-11-18 22:58:28 +00:00
//overloaded funcs from Interface
void yourTurn ( ) ;
void heroMoved ( const HeroMoveDetails & details ) ;
2007-12-06 18:55:58 +00:00
void tileRevealed ( int3 pos ) ;
void tileHidden ( int3 pos ) ;
2007-12-19 00:06:51 +00:00
void heroKilled ( const CGHeroInstance * hero ) ;
void heroCreated ( const CGHeroInstance * hero ) ;
2007-11-18 22:58:28 +00:00
void heroPrimarySkillChanged ( const CGHeroInstance * hero , int which , int val ) ;
2007-11-25 13:16:45 +00:00
void receivedResource ( int type , int val ) ;
2007-12-27 00:11:46 +00:00
void showSelDialog ( std : : string text , std : : vector < CSelectableComponent * > & components , int askID ) ;
2008-01-28 14:01:09 +00:00
void heroVisitsTown ( const CGHeroInstance * hero , const CGTownInstance * town ) ;
void garrisonChanged ( const CGObjectInstance * obj ) ;
2008-03-23 01:01:17 +00:00
void buildChanged ( const CGTownInstance * town , int buildingID , int what ) ; //what: 1 - built, 2 - demolished
2007-12-22 14:40:27 +00:00
2008-02-24 23:06:27 +00:00
//battles
2008-04-07 17:51:46 +00:00
void battleStart ( CCreatureSet * army1 , CCreatureSet * army2 , int3 tile , CGHeroInstance * hero1 , CGHeroInstance * hero2 , boost : : logic : : tribool side ) ; //called by engine when battle starts; side=0 - left, side=1 - right
2008-02-24 23:06:27 +00:00
void battlefieldPrepared ( int battlefieldType , std : : vector < CObstacle * > obstacles ) ; //called when battlefield is prepared, prior the battle beginning
void battleNewRound ( int round ) ; //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
2008-03-29 10:59:18 +00:00
void actionStarted ( BattleAction action ) ; //occurs BEFORE every action taken by any stack or by the hero
void actionFinished ( BattleAction action ) ; //occurs AFTER every action taken by any stack or by the hero
2008-04-15 16:52:31 +00:00
BattleAction activeStack ( int stackID ) ; //called when it's turn of that stack
void battleEnd ( CCreatureSet * army1 , CCreatureSet * army2 , CArmedInstance * hero1 , CArmedInstance * hero2 , std : : vector < int > capturedArtifacts , int expForWinner , bool winner ) ;
2008-04-14 18:24:46 +00:00
void battleStackMoved ( int ID , int dest , bool startMoving , bool endMoving ) ;
2008-04-07 17:51:46 +00:00
void battleStackAttacking ( int ID , int dest ) ;
2008-06-10 11:34:20 +00:00
void battleStackIsAttacked ( int ID , int dmg , int killed , int IDby ) ;
void battleStackKilled ( int ID , int dmg , int killed , int IDby ) ;
2008-02-24 23:06:27 +00:00
//-------------//
2007-12-22 14:40:27 +00:00
void showComp ( SComponent comp ) ;
2008-01-10 19:01:25 +00:00
void openTownWindow ( const CGTownInstance * town ) ; //shows townscreen
void openHeroWindow ( const CGHeroInstance * hero ) ; //shows hero window with given hero
2007-12-19 00:06:51 +00:00
SDL_Surface * infoWin ( const CGObjectInstance * specific ) ; //specific=0 => draws info about selected town/hero //TODO - gdy sie dorobi sensowna hierarchie klas ins. to wywalic tego brzydkiego void*
2007-11-18 22:58:28 +00:00
void handleEvent ( SDL_Event * sEvent ) ;
2007-12-22 14:40:27 +00:00
void handleKeyDown ( SDL_Event * sEvent ) ;
void handleKeyUp ( SDL_Event * sEvent ) ;
void handleMouseMotion ( SDL_Event * sEvent ) ;
2007-12-06 18:32:06 +00:00
void init ( ICallback * CB ) ;
2007-11-18 22:58:28 +00:00
int3 repairScreenPos ( int3 pos ) ;
2007-11-23 22:33:55 +00:00
void showInfoDialog ( std : : string text , std : : vector < SComponent * > & components ) ;
2007-12-01 12:50:33 +00:00
void removeObjToBlit ( IShowable * obj ) ;
2007-12-19 00:06:51 +00:00
SDL_Surface * drawHeroInfoWin ( const CGHeroInstance * curh ) ;
2007-12-22 14:40:27 +00:00
SDL_Surface * drawPrimarySkill ( const CGHeroInstance * curh , SDL_Surface * ret , int from = 0 , int to = PRIMARY_SKILLS ) ;
2007-12-19 00:06:51 +00:00
SDL_Surface * drawTownInfoWin ( const CGTownInstance * curh ) ;
2007-11-18 22:58:28 +00:00
CPlayerInterface ( int Player , int serial ) ;
2008-01-27 20:37:10 +00:00
} ;
class CStatusBar
: public CIntObject , public IStatusBar
{
public :
SDL_Surface * bg ; //background
int middlex , middley ; //middle of statusbar
std : : string current ; //text currently printed
CStatusBar ( int x , int y , std : : string name = " ADROLLVR.bmp " , int maxw = - 1 ) ; //c-tor
~ CStatusBar ( ) ; //d-tor
void print ( std : : string text ) ; //prints text and refreshes statusbar
void clear ( ) ; //clears statusbar and refreshes
void show ( ) ; //shows statusbar (with current text)
std : : string getCurrent ( ) ;
2008-01-31 21:35:30 +00:00
} ;
class CList
: public ClickableL , public ClickableR , public Hoverable , public KeyInterested , public virtual CIntObject , public MotionInterested
{
public :
SDL_Surface * bg ;
CDefHandler * arrup , * arrdo ;
SDL_Surface * empty , * selection ;
SDL_Rect arrupp , arrdop ; //positions of arrows
int posw , posh ; //position width/height
int selected , //id of selected position, <0 if none
from ;
const int SIZE ;
2008-04-07 17:51:46 +00:00
boost : : logic : : tribool pressed ; //true=up; false=down; indeterminate=none
2008-01-31 21:35:30 +00:00
CList ( int Size = 5 ) ;
2008-04-07 17:51:46 +00:00
void clickLeft ( boost : : logic : : tribool down ) ;
2008-01-31 21:35:30 +00:00
void activate ( ) ;
void deactivate ( ) ;
virtual void mouseMoved ( SDL_MouseMotionEvent & sEvent ) = 0 ;
virtual void genList ( ) = 0 ;
virtual void select ( int which ) = 0 ;
virtual void draw ( ) = 0 ;
} ;
class CHeroList
: public CList
{
public :
CDefHandler * mobile , * mana ;
std : : vector < std : : pair < const CGHeroInstance * , CPath * > > items ;
int posmobx , posporx , posmanx , posmoby , pospory , posmany ;
CHeroList ( int Size = 5 ) ;
void genList ( ) ;
void select ( int which ) ;
void mouseMoved ( SDL_MouseMotionEvent & sEvent ) ;
2008-04-07 17:51:46 +00:00
void clickLeft ( boost : : logic : : tribool down ) ;
void clickRight ( boost : : logic : : tribool down ) ;
2008-01-31 21:35:30 +00:00
void hover ( bool on ) ;
void keyPressed ( SDL_KeyboardEvent & key ) ;
void updateHList ( ) ;
void updateMove ( const CGHeroInstance * which ) ; //draws move points bar
void redrawAllOne ( int which ) ;
void draw ( ) ;
void init ( ) ;
} ;
2008-05-18 17:33:39 +00:00
2008-01-31 21:35:30 +00:00
class CTownList
: public CList
{
public :
2008-05-18 17:33:39 +00:00
boost : : function < void ( ) > fun ;
2008-01-31 21:35:30 +00:00
std : : vector < const CGTownInstance * > items ;
int posporx , pospory ;
CTownList ( int Size , SDL_Rect * Pos , int arupx , int arupy , int ardox , int ardoy ) ;
~ CTownList ( ) ;
void genList ( ) ;
void select ( int which ) ;
void mouseMoved ( SDL_MouseMotionEvent & sEvent ) ;
2008-04-07 17:51:46 +00:00
void clickLeft ( boost : : logic : : tribool down ) ;
void clickRight ( boost : : logic : : tribool down ) ;
2008-01-31 21:35:30 +00:00
void hover ( bool on ) ;
void keyPressed ( SDL_KeyboardEvent & key ) ;
void draw ( ) ;
2008-04-04 17:30:53 +00:00
} ;
2008-04-11 17:41:02 +00:00
2008-06-04 13:00:56 +00:00
class CCreaturePic //draws 100x130 picture with creature on background, use nextFrame=true to get animation
2008-04-11 17:41:02 +00:00
{
public :
2008-06-04 13:00:56 +00:00
CCreature * c ;
CCreatureAnimation * anim ;
CCreaturePic ( CCreature * cre ) ;
~ CCreaturePic ( ) ;
int blitPic ( SDL_Surface * to , int x , int y , bool nextFrame ) ;
SDL_Surface * getPic ( bool nextFrame ) ;
2008-04-11 17:41:02 +00:00
} ;
2008-04-04 17:30:53 +00:00
class CRecrutationWindow : public IShowable , public ClickableL
{
public :
struct creinfo
{
SDL_Rect pos ;
2008-06-04 13:00:56 +00:00
CCreaturePic * pic ;
2008-04-04 17:30:53 +00:00
int ID , amount ; //creature ID and available amount
std : : vector < std : : pair < int , int > > res ; //res_id - cost_per_unit
} ;
2008-05-12 05:46:04 +00:00
std : : vector < int > amounts ; //how many creatures we can afford
2008-04-04 17:30:53 +00:00
std : : vector < creinfo > creatures ;
2008-06-04 13:00:56 +00:00
boost : : function < void ( int , int ) > recruit ; //void (int ID, int amount) <-- call to recruit creatures
2008-05-18 17:33:39 +00:00
CSlider * slider ;
AdventureMapButton * max , * buy , * cancel ;
2008-04-04 17:30:53 +00:00
SDL_Surface * bitmap ;
int which ; //which creature is active
void close ( ) ;
void Max ( ) ;
void Buy ( ) ;
void Cancel ( ) ;
void sliderMoved ( int to ) ;
2008-04-07 17:51:46 +00:00
void clickLeft ( boost : : logic : : tribool down ) ;
2008-04-04 17:30:53 +00:00
void activate ( ) ;
void deactivate ( ) ;
void show ( SDL_Surface * to = NULL ) ;
2008-06-04 13:00:56 +00:00
CRecrutationWindow ( const std : : vector < std : : pair < int , int > > & Creatures , const boost : : function < void ( int , int ) > & Recruit ) ; //creatures - pairs<creature_ID,amount>
2008-04-04 17:30:53 +00:00
~ CRecrutationWindow ( ) ;
2008-04-07 17:51:46 +00:00
} ;
2008-04-19 16:15:04 +00:00
class CSplitWindow : public IShowable , public KeyInterested
{
public :
CGarrisonInt * gar ;
2008-05-18 17:33:39 +00:00
CSlider * slider ;
2008-06-04 13:00:56 +00:00
CCreaturePic * anim ;
2008-05-18 17:33:39 +00:00
AdventureMapButton * ok , * cancel ;
2008-04-19 16:15:04 +00:00
SDL_Surface * bitmap ;
int a1 , a2 , c ;
bool which ;
CSplitWindow ( int cid , int max , CGarrisonInt * Owner ) ;
~ CSplitWindow ( ) ;
void activate ( ) ;
void split ( ) ;
void close ( ) ;
void deactivate ( ) ;
void show ( SDL_Surface * to = NULL ) ;
void keyPressed ( SDL_KeyboardEvent & key ) ;
void sliderMoved ( int to ) ;
} ;
2008-05-18 17:33:39 +00:00
class CCreInfoWindow : public IShowable , public KeyInterested , public ClickableR
{
public :
int type ; //0 - rclick popup; 1 - normal window
SDL_Surface * bitmap ;
2008-06-04 13:00:56 +00:00
bool anf ;
2008-05-18 17:33:39 +00:00
2008-05-31 20:37:54 +00:00
boost : : function < void ( ) > dsm ;
2008-06-04 13:00:56 +00:00
CCreaturePic * anim ;
2008-05-18 17:33:39 +00:00
CCreature * c ;
AdventureMapButton * dismiss , * upgrade , * ok ;
CCreInfoWindow ( int Cid , int Type , StackState * State , boost : : function < void ( ) > Upg , boost : : function < void ( ) > Dsm ) ;
~ CCreInfoWindow ( ) ;
void activate ( ) ;
void close ( ) ;
void clickRight ( boost : : logic : : tribool down ) ;
2008-05-31 20:37:54 +00:00
void dismissF ( ) ;
2008-05-18 17:33:39 +00:00
void keyPressed ( SDL_KeyboardEvent & key ) ;
void deactivate ( ) ;
void show ( SDL_Surface * to = NULL ) ;
} ;
2008-04-07 17:51:46 +00:00
# endif //CPLAYERINTERFACE_H