Browse Source

Force full redraw for sliders. This fixes backgroung glitches with SDL2.
(!) there should be better fix

AlexVinS 11 years ago
parent
commit
f3067878dd
2 changed files with 13 additions and 1 deletions
  1. 11 0
      client/gui/CIntObjectClasses.cpp
  2. 2 1
      client/gui/CIntObjectClasses.h

+ 11 - 0
client/gui/CIntObjectClasses.cpp

@@ -854,6 +854,17 @@ void CSlider::showAll(SDL_Surface * to)
 	CIntObject::showAll(to);
 }
 
+void CSlider::show(SDL_Surface * to)
+{
+	#ifdef VCMI_SDL1	
+	CIntObject::show(to);	
+	#else
+	CSDL_Ext::fillRect(to, &pos, 0);
+	CIntObject::showAll(to);	
+	#endif // VCMI_SDL1
+}
+
+
 void CSlider::wheelScrolled(bool down, bool in)
 {
 	moveTo(value + 3 * (down ? +scrollStep : -scrollStep));

+ 2 - 1
client/gui/CIntObjectClasses.h

@@ -217,7 +217,8 @@ public:
 	void wheelScrolled(bool down, bool in);
 	void clickLeft(tribool down, bool previousState);
 	void mouseMoved (const SDL_MouseMotionEvent & sEvent);
-	void showAll(SDL_Surface * to);
+	void showAll(SDL_Surface * to);	
+	void show(SDL_Surface * to) override;
 
 	CSlider(int x, int y, int totalw, std::function<void(int)> Moved, int Capacity, int Amount, 
 		int Value=0, bool Horizontal=true, int style = 0); //style 0 - brown, 1 - blue