Browse Source

-Fixed Pyramid bug and incorrect behaviour of specific banks
-Commited some old scraps of better InfoWindow with scrollbar

DjWarmonger 16 năm trước cách đây
mục cha
commit
63ba552d87
3 tập tin đã thay đổi với 18 bổ sung12 xóa
  1. 3 3
      client/AdventureMapButton.cpp
  2. 9 9
      client/CMessage.cpp
  3. 6 0
      client/GUIClasses.cpp

+ 3 - 3
client/AdventureMapButton.cpp

@@ -582,10 +582,10 @@ CSlider::CSlider(int x, int y, int totalw, boost::function<void(int)> Moved, int
 	}
 
 	if(style == 0)
-	{
+	{
 		if (horizontal)
-			imgs = CDefHandler::giveDefEss("IGPCRDIV.DEF");
-		else
+			imgs = CDefHandler::giveDefEss("IGPCRDIV.DEF");
+		else
 			imgs = CDefHandler::giveDefEss("OVBUTN2.DEF");
 		left->imgs.resize(1); right->imgs.resize(1); slider->imgs.resize(1);
 		left->imgs[0].push_back(imgs->ourImages[0].bitmap); left->imgs[0].push_back(imgs->ourImages[1].bitmap);

+ 9 - 9
client/CMessage.cpp

@@ -368,10 +368,6 @@ SDL_Surface * CMessage::drawBoxTextBitmapSub( int player, std::string text, SDL_
 	return ret;
 }
 
-
-
-
-
 void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player, int charperline)
 {
 	SDL_Surface * _or = NULL;
@@ -415,22 +411,26 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player, int
 
 	// Clip window size
 	amax(txts.second, 50);
-	if (txts.second > conf.cc.resy - 150)
-		ret->slider = new CSlider(ret->pos.x + ret->pos.w, ret->pos.y, txts.second, boost::bind (&CInfoWindow::sliderMoved, ret, _1), txts.second, txts.second, 0, false, 0);
-	else
-		ret->slider = NULL;
 	amax(txts.first, 80);
 	amax(txts.first, comps.w);
 	amax(txts.first, bw);
 
 	amin(txts.first, conf.cc.resx - 150);
-	amin(txts.second, conf.cc.resy - 150);
 
 	ret->bitmap = drawBox1 (txts.first + 2*SIDE_MARGIN, txts.second + 2*SIDE_MARGIN, player);
 	ret->pos.h=ret->bitmap->h;
 	ret->pos.w=ret->bitmap->w;
 	ret->pos.x=screen->w/2-(ret->pos.w/2);
 	ret->pos.y=screen->h/2-(ret->pos.h/2);
+	if (txts.second > conf.cc.resy - 150)
+	{
+		amin(txts.second, conf.cc.resy - 150);
+		ret->slider = new CSlider(ret->pos.x + ret->pos.w - SIDE_MARGIN, ret->pos.y + SIDE_MARGIN,
+			ret->pos.h - 2*SIDE_MARGIN, boost::bind (&CInfoWindow::sliderMoved, ret, _1), brtext->size(), brtext->size(), brtext->size()-1, false, 0);
+		//ret->bitmap->w -= ret->slider->pos.w; //crop text so that slider has more place for itself
+	}
+	else
+		ret->slider = NULL;
 
 	int curh = SIDE_MARGIN;
 	blitTextOnSur (txtg, fontHeight, curh, ret->bitmap);

+ 6 - 0
client/GUIClasses.cpp

@@ -661,6 +661,8 @@ void CInfoWindow::show(SDL_Surface * to)
 	CSimpleWindow::show(to);
 	for(int i=0;i<buttons.size();i++)
 		buttons[i]->show(to);
+	if (slider)
+		slider->show(to);
 }
 
 CInfoWindow::~CInfoWindow()
@@ -686,6 +688,10 @@ void CInfoWindow::activate()
 }
 void CInfoWindow::sliderMoved(int to)
 {
+	/*slider->moveTo(to);
+		if(!slider) return; //ignore spurious call when slider is being created
+	*/
+	redraw();
 }
 void CInfoWindow::deactivate()
 {