瀏覽代碼

Added clickable and highlightable player flags in adv. options tab

Michał W. Urbańczyk 18 年之前
父節點
當前提交
53da2c389c
共有 3 個文件被更改,包括 14 次插入1 次删除
  1. 1 1
      CMessage.h
  2. 二進制
      CPreGame.cpp
  3. 13 0
      CPreGame.h

+ 1 - 1
CMessage.h

@@ -24,7 +24,7 @@ struct OverButton
 struct HighButton: public OverButton
 {
 	HighButton( SDL_Rect Pos, CDefHandler* Imgs, bool Sel=false, int id=-1)
-		{type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;};
+		{type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;highlightable=false;};
 	HighButton(){}
 	bool selectable, selected;
 	bool highlightable, highlighted;

二進制
CPreGame.cpp


+ 13 - 0
CPreGame.h

@@ -55,10 +55,21 @@ class Options : public PreGameTab
 		int serialID;
 		int which; //-1=castle;0=hero;1=bonus
 	};
+	struct PlayerFlag:public HighButton
+	{
+		int color;
+		PlayerFlag(SDL_Rect Pos, CDefHandler* Imgs, int Color)
+			:HighButton(Pos,Imgs,false,7),color(Color)
+			{selectable=false;highlightable=true;}
+		void hover(bool on=true);
+		void press(bool down=true);
+		void select(bool on=true){};
+	};
 	struct PlayerOptions
 	{
 		PlayerOptions(int serial, int player);
 		Ecolor color;
+		PlayerFlag flag;
 		//SDL_Surface * bg;
 		OptionSwitch Cleft, Cright, Hleft, Hright, Bleft, Bright;
 		int nr;
@@ -68,6 +79,7 @@ public:
 	SDL_Surface * bg,
 		* rHero, * rCastle, * nHero, * nCastle;
 	std::vector<SDL_Surface*> bgs;
+	std::vector<CDefHandler*> flags;
 	CDefHandler //* castles, * heroes, * bonus,
 		* left, * right,
 		* bonuses;
@@ -130,6 +142,7 @@ public:
 class CPreGame
 {
 public:	
+	HighButton * highlighted;
 	PreGameTab* currentTab;
 	StartInfo ret;
 	bool run;