Selaa lähdekoodia

Give thicker frame to highlighted queue boxes

Dydzio 2 vuotta sitten
vanhempi
sitoutus
4a23f93754

+ 1 - 1
client/battle/BattleInterfaceClasses.cpp

@@ -918,7 +918,7 @@ void StackQueue::StackBox::toggleHighlight(bool value)
 void StackQueue::StackBox::show(SDL_Surface *to)
 {
 	if(highlighted)
-		CSDL_Ext::drawBorder(to, background->pos.x, background->pos.y, background->pos.w, background->pos.h,  { 0, 255, 255, 255 });
+		CSDL_Ext::drawBorder(to, background->pos.x, background->pos.y, background->pos.w, background->pos.h,  { 0, 255, 255, 255 }, 2);
 
 	CIntObject::show(to);
 }

+ 1 - 1
client/battle/BattleStacksController.cpp

@@ -898,7 +898,7 @@ std::vector<const CStack *> BattleStacksController::selectHoveredStacks()
 		return {};
 
 	auto hoveredQueueUnitId = owner.windowObject->getQueueHoveredUnitId();
-	if(hoveredQueueUnitId.has_value())
+	if(hoveredQueueUnitId.is_initialized())
 	{
 		return { owner.curInt->cb->battleGetStackByUnitId(hoveredQueueUnitId.value(), true) };
 	}

+ 15 - 11
client/gui/SDL_Extensions.cpp

@@ -472,23 +472,27 @@ void CSDL_Ext::drawLine(SDL_Surface * sur, int x1, int y1, int x2, int y2, const
 	}
 }
 
-void CSDL_Ext::drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const SDL_Color &color)
+void CSDL_Ext::drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const SDL_Color &color, int depth)
 {
-	for(int i = 0; i < w; i++)
+	depth = std::max(1, depth);
+	for(int depthIterator = 0; depthIterator < depth; depthIterator++)
 	{
-		CSDL_Ext::putPixelWithoutRefreshIfInSurf(sur,x+i,y,color.r,color.g,color.b);
-		CSDL_Ext::putPixelWithoutRefreshIfInSurf(sur,x+i,y+h-1,color.r,color.g,color.b);
-	}
-	for(int i = 0; i < h; i++)
-	{
-		CSDL_Ext::putPixelWithoutRefreshIfInSurf(sur,x,y+i,color.r,color.g,color.b);
-		CSDL_Ext::putPixelWithoutRefreshIfInSurf(sur,x+w-1,y+i,color.r,color.g,color.b);
+		for(int i = 0; i < w; i++)
+		{
+			CSDL_Ext::putPixelWithoutRefreshIfInSurf(sur,x+i,y+depthIterator,color.r,color.g,color.b);
+			CSDL_Ext::putPixelWithoutRefreshIfInSurf(sur,x+i,y+h-1-depthIterator,color.r,color.g,color.b);
+		}
+		for(int i = 0; i < h; i++)
+		{
+			CSDL_Ext::putPixelWithoutRefreshIfInSurf(sur,x+depthIterator,y+i,color.r,color.g,color.b);
+			CSDL_Ext::putPixelWithoutRefreshIfInSurf(sur,x+w-1-depthIterator,y+i,color.r,color.g,color.b);
+		}
 	}
 }
 
-void CSDL_Ext::drawBorder( SDL_Surface * sur, const Rect &r, const SDL_Color &color )
+void CSDL_Ext::drawBorder( SDL_Surface * sur, const Rect &r, const SDL_Color &color, int depth)
 {
-	drawBorder(sur, r.x, r.y, r.w, r.h, color);
+	drawBorder(sur, r.x, r.y, r.w, r.h, color, depth);
 }
 
 void CSDL_Ext::drawDashedBorder(SDL_Surface * sur, const Rect &r, const SDL_Color &color)

+ 2 - 2
client/gui/SDL_Extensions.h

@@ -150,8 +150,8 @@ typedef void (*TColorPutterAlpha)(Uint8 *&ptr, const Uint8 & R, const Uint8 & G,
 
 	void update(SDL_Surface * what = screen); //updates whole surface (default - main screen)
 	void drawLine(SDL_Surface * sur, int x1, int y1, int x2, int y2, const SDL_Color & color1, const SDL_Color & color2);
-	void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const SDL_Color &color);
-	void drawBorder(SDL_Surface * sur, const Rect &r, const SDL_Color &color);
+	void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const SDL_Color &color, int depth = 1);
+	void drawBorder(SDL_Surface * sur, const Rect &r, const SDL_Color &color, int depth = 1);
 	void drawDashedBorder(SDL_Surface * sur, const Rect &r, const SDL_Color &color);
 	void setPlayerColor(SDL_Surface * sur, PlayerColor player); //sets correct color of flags; -1 for neutral
 	std::string processStr(std::string str, std::vector<std::string> & tor); //replaces %s in string