mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
6b0f209626
* names of lods changed - rename your lod files to h3sprite.lod and h3bitmap.lod and place them in \Data subfolder (as in H3). * added several clickable buttons to adv. map interface * underground/surface switch button is functional * reading more text from ZELP.txt, added CPreGameTextHandler to CGameInfo * a lot of minor improvements/fixes(/bugs)
93 lines
2.0 KiB
C++
93 lines
2.0 KiB
C++
#ifndef CGAMEINTERFACE_H
|
|
#define CGAMEINTERFACE_H
|
|
|
|
#include "SDL.h"
|
|
#include "CDefHandler.h"
|
|
#include "SDL_Extensions.h"
|
|
#include <boost/logic/tribool.hpp>
|
|
BOOST_TRIBOOL_THIRD_STATE(outOfRange)
|
|
using namespace boost::logic;
|
|
class CAdvMapInt;
|
|
|
|
class CIntObject //interface object
|
|
{
|
|
public:
|
|
SDL_Rect pos;
|
|
int ID;
|
|
};
|
|
class CButtonBase : public virtual CIntObject
|
|
{
|
|
public:
|
|
int type; //advmapbutton=2
|
|
bool abs;
|
|
bool active;
|
|
CIntObject * ourObj;
|
|
int state;
|
|
std::vector<SDL_Surface*> imgs;
|
|
virtual void show() ;
|
|
virtual void activate()=0;
|
|
virtual void deactivate()=0;
|
|
CButtonBase();
|
|
};
|
|
class ClickableL : public virtual CIntObject //for left-clicks
|
|
{
|
|
public:
|
|
bool pressedL;
|
|
virtual void clickLeft (tribool down)=0;
|
|
virtual void activate()=0;
|
|
virtual void deactivate()=0;
|
|
};
|
|
class ClickableR : public virtual CIntObject //for right-clicks
|
|
{
|
|
public:
|
|
bool pressedR;
|
|
virtual void clickRight (tribool down)=0;
|
|
virtual void activate()=0;
|
|
virtual void deactivate()=0;
|
|
};
|
|
class Hoverable : public virtual CIntObject
|
|
{
|
|
public:
|
|
bool hovered;
|
|
virtual void hover (bool on)=0;
|
|
virtual void activate()=0;
|
|
virtual void deactivate()=0;
|
|
};
|
|
class KeyInterested : public virtual CIntObject
|
|
{
|
|
public:
|
|
virtual void keyPressed (SDL_KeyboardEvent & key)=0;
|
|
virtual void activate()=0;
|
|
virtual void deactivate()=0;
|
|
};
|
|
class CGameInterface
|
|
{
|
|
public:
|
|
bool human;
|
|
int playerID, serialID;
|
|
|
|
virtual void yourTurn()=0{};
|
|
};
|
|
class CGlobalAI : public CGameInterface // callback for AI
|
|
{
|
|
public:
|
|
virtual void yourTurn(){};
|
|
};
|
|
class CPlayerInterface : public CGameInterface
|
|
{
|
|
public:
|
|
CAdvMapInt * adventureInt;
|
|
//TODO: town interace, battle interface, other interfaces
|
|
|
|
std::vector<ClickableL*> lclickable;
|
|
std::vector<ClickableR*> rclickable;
|
|
std::vector<Hoverable*> hoverable;
|
|
std::vector<KeyInterested*> keyinterested;
|
|
|
|
void yourTurn();
|
|
void handleEvent(SDL_Event * sEvent);
|
|
void init();
|
|
|
|
CPlayerInterface(int Player, int serial);
|
|
};
|
|
#endif //CGAMEINTERFACE_H
|