mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Wyświetlanie (parcjalne) wyboru scenariusza, można wybierać trudność.
Sporo róznych poprawek i rzeczy, których nie pamiętam, doszukasz na Tracu ;)
This commit is contained in:
53
CMessage.h
53
CMessage.h
@@ -1,11 +1,54 @@
|
||||
#include "SDL_TTF.h"
|
||||
#include "CSemiDefHandler.h"
|
||||
enum EWindowType {infoOnly, infoOK, yesOrNO};
|
||||
class CPreGame;
|
||||
typedef void(CPreGame::*ttt)();
|
||||
template <class T=ttt> class CGroup;
|
||||
template <class T=ttt> class CPoinGroup ;
|
||||
template <class T=ttt> struct Button
|
||||
{
|
||||
int type;
|
||||
SDL_Rect pos;
|
||||
T fun;
|
||||
CSemiDefHandler* imgs;
|
||||
Button( SDL_Rect Pos, T Fun,CSemiDefHandler* Imgs, bool Sel=false, CGroup<T>* 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<T> * ourGroup;
|
||||
};
|
||||
//template<class T=void(CPreGame::*)(int)>
|
||||
template<class T=ttt> struct IntSelBut: public Button<T>
|
||||
{
|
||||
public:
|
||||
CPoinGroup<T> * ourGroup;
|
||||
int key;
|
||||
IntSelBut(){};
|
||||
IntSelBut( SDL_Rect Pos, T Fun,CSemiDefHandler* Imgs, bool Sel=false, CPoinGroup<T>* 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 T=ttt> class CPoinGroup :public CGroup<T>
|
||||
{
|
||||
public:
|
||||
int * gdzie; //where (po polsku, bo by by�o s�owo kluczowe :/)
|
||||
void setYour(IntSelBut<T> * your){*gdzie=your->key;};
|
||||
};
|
||||
template <class T=ttt> class CGroup
|
||||
{
|
||||
public:
|
||||
Button<T> * selected;
|
||||
int type; // 1=sinsel
|
||||
CGroup():selected(NULL),type(0){};
|
||||
};
|
||||
class CMessage
|
||||
{
|
||||
SDL_Color tytulowy ;
|
||||
SDL_Color tlo;
|
||||
SDL_Color zwykly ;
|
||||
public:
|
||||
std::vector<std::string> * breakText(std::string text);
|
||||
CSemiDefHandler * piecesOfBox;
|
||||
@@ -14,4 +57,6 @@ public:
|
||||
std::vector<CSemiDefHandler*> *addPics=NULL, void * cb=NULL);
|
||||
SDL_Surface * drawBox1(int w, int h);
|
||||
CMessage();
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user