#include "SDL_TTF.h" #include "CSemiDefHandler.h" enum EWindowType {infoOnly, infoOK, yesOrNO}; class CPreGame; typedef void(CPreGame::*ttt)(); template class CGroup; template class CPoinGroup ; template struct Button { int type; SDL_Rect pos; T fun; CSemiDefHandler* imgs; Button( SDL_Rect Pos, T Fun,CSemiDefHandler* Imgs, bool Sel=false, CGroup* gr=NULL, int id=-1) :state(0),selectable(Sel),selected(false),imgs(Imgs),pos(Pos),fun(Fun),ourGroup(gr), type(0), ID(id){}; Button(){}; bool selectable, selected; bool highlightable, highlighted; int state; int ID; virtual void hover(bool on=true); virtual void press(bool down=true); virtual void select(bool on=true); CGroup * ourGroup; }; //template template struct IntSelBut: public Button { public: CPoinGroup * ourGroup; int key; IntSelBut(){}; IntSelBut( SDL_Rect Pos, T Fun,CSemiDefHandler* Imgs, bool Sel=false, CPoinGroup* gr=NULL, int My=-1) : Button(Pos,Fun,Imgs,Sel,gr),key(My){ourGroup=gr;}; void select(bool on=true) {(*this).Button::select(on);ourGroup->setYour(this);} }; template class CPoinGroup :public CGroup { public: int * gdzie; //where (po polsku, bo by było słowo kluczowe :/) void setYour(IntSelBut * your){*gdzie=your->key;}; }; template class CGroup { public: Button * selected; int type; // 1=sinsel CGroup():selected(NULL),type(0){}; }; class CMessage { public: std::vector * breakText(std::string text); CSemiDefHandler * piecesOfBox; SDL_Surface * background; SDL_Surface * genMessage(std::string title, std::string text, EWindowType type=infoOnly, std::vector *addPics=NULL, void * cb=NULL); SDL_Surface * drawBox1(int w, int h); CMessage(); }; //