1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Give thicker frame to highlighted queue boxes

This commit is contained in:
Dydzio 2023-01-23 12:03:07 +01:00
parent aa18118df0
commit 4a23f93754
4 changed files with 19 additions and 15 deletions

View File

@ -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);
}

View File

@ -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) };
}

View File

@ -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)

View File

@ -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