Pārlūkot izejas kodu

* removed post-TSI rubbish from nodrze
* HighButton is now main button class to inheriting
* more of advanced options screen
* minor stuff

Michał W. Urbańczyk 18 gadi atpakaļ
vecāks
revīzija
99c3b11d96
5 mainītis faili ar 38 papildinājumiem un 17 dzēšanām
  1. 4 4
      CMT.cpp
  2. 13 5
      CMessage.h
  3. BIN
      CPreGame.cpp
  4. 21 5
      CPreGame.h
  5. 0 3
      nodrze.h

+ 4 - 4
CMT.cpp

@@ -463,7 +463,7 @@ int _tmain(int argc, _TCHAR* argv[])
 					}//keyup end
 					else if(sEvent.type==SDL_MOUSEMOTION)
 					{
-						if(sEvent.motion.x<5)
+						if(sEvent.motion.x<15)
 						{
 							scrollingLeft = true;
 						}
@@ -471,7 +471,7 @@ int _tmain(int argc, _TCHAR* argv[])
 						{
 							scrollingLeft = false;
 						}
-						if(sEvent.motion.x>screen->w-5)
+						if(sEvent.motion.x>screen->w-15)
 						{
 							scrollingRight = true;
 						}
@@ -479,7 +479,7 @@ int _tmain(int argc, _TCHAR* argv[])
 						{
 							scrollingRight = false;
 						}
-						if(sEvent.motion.y<5)
+						if(sEvent.motion.y<15)
 						{
 							scrollingUp = true;
 						}
@@ -487,7 +487,7 @@ int _tmain(int argc, _TCHAR* argv[])
 						{
 							scrollingUp = false;
 						}
-						if(sEvent.motion.y>screen->h-5)
+						if(sEvent.motion.y>screen->h-15)
 						{
 							scrollingDown = true;
 						}

+ 13 - 5
CMessage.h

@@ -20,15 +20,23 @@ struct OverButton
 	virtual void show() ;
 	virtual void press(bool down=true);
 };
-template <class T=ttt> struct Button: public 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;};
+	HighButton(){}
+	bool selectable, selected;
+	bool highlightable, highlighted;
+	virtual	void hover(bool on=true)=0;
+	virtual void select(bool on=true)=0;
+};
+template <class T=ttt> struct Button: public HighButton
 {
-	T fun;
 	CGroup<T> * ourGroup;
 	Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup<T>* gr=NULL, int id=-1)
-		:fun(Fun),ourGroup(gr){type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;};
+		:HighButton(Pos,Imgs,Sel,id),ourGroup(gr),fun(Fun){};
 	Button(){ourGroup=NULL;};
-	bool selectable, selected;
-	bool highlightable, highlighted;
+	T fun;
 	virtual	void hover(bool on=true);
 	virtual void select(bool on=true);
 };	

BIN
CPreGame.cpp


+ 21 - 5
CPreGame.h

@@ -32,23 +32,39 @@ class RanSel
 };
 class Options
 {
+	bool inited, showed;
+	struct OptionSwitch:public HighButton
+	{
+		void hover(bool on=true){};
+		void select(bool on=true){};
+		OptionSwitch( SDL_Rect Pos, CDefHandler* Imgs)
+			:HighButton(Pos,Imgs,false,7)
+			{selectable=false;highlightable=false;}
+		void press(bool down=true);
+		bool left;
+		int playerID;
+		int serialID;
+		int which; //-1=castle;0=hero;1=bonus
+	};
 	struct PlayerOptions
 	{
+		PlayerOptions(int serial, int player);
 		Ecolor color;
 		//SDL_Surface * bg;
-		Button<> left, right;
+		OptionSwitch left, right;
 		int nr;
 	};
 public:
 	Slider<> * turnLength;
-	SDL_Surface * bg;
+	SDL_Surface * bg,
+		* rHero, * rCastle, * nHero, * nCastle;
 	std::vector<SDL_Surface*> bgs;
 	CDefHandler //* castles, * heroes, * bonus,
 		* left, * right;
-	std::vector<PlayerOptions> poptions;
+	std::vector<PlayerOptions*> poptions;
 	void show();
 	void init();
-	//Options();
+	Options(){inited=showed=false;};
 	~Options();
 };
 class MapSel
@@ -107,7 +123,7 @@ public:
 	std::vector<Slider<> *> interested;
 	CMusicHandler * mush;
 	CSemiLodHandler * slh ;
-	std::vector<Button<> *> btns;
+	std::vector<HighButton *> btns;
 	CPreGameTextHandler * preth ;
 	SDL_Rect * currentMessage;	
 	SDL_Surface * behindCurMes;

+ 0 - 3
nodrze.h

@@ -16,9 +16,6 @@
 #define CLOG(a) (std::cout<<a)
 #endif
 const bool CZERWONY=true, CZARNY=false;
-class TTAICore;
-extern TTAICore * C;
-
 template <typename T>  class wezel
 {
 public: