mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Added new Widgets an functions for simplification
This commit is contained in:
parent
d33101187b
commit
05fad115b5
@ -580,3 +580,31 @@ void CCreaturePic::setAmount(int newAmount)
|
||||
else
|
||||
amount->setText("");
|
||||
}
|
||||
|
||||
TransparentFilledRectangle::TransparentFilledRectangle(Rect position, ColorRGBA color) :
|
||||
color(color), colorLine(ColorRGBA()), drawLine(false)
|
||||
{
|
||||
pos = position + pos.topLeft();
|
||||
}
|
||||
|
||||
TransparentFilledRectangle::TransparentFilledRectangle(Rect position, ColorRGBA color, ColorRGBA colorLine) :
|
||||
color(color), colorLine(colorLine), drawLine(true)
|
||||
{
|
||||
pos = position + pos.topLeft();
|
||||
}
|
||||
|
||||
void TransparentFilledRectangle::showAll(Canvas & to)
|
||||
{
|
||||
to.drawColorBlended(pos, color);
|
||||
if(drawLine)
|
||||
to.drawBorder(pos, colorLine);
|
||||
}
|
||||
|
||||
SimpleLine::SimpleLine(Point pos1, Point pos2, ColorRGBA color) :
|
||||
pos1(pos1), pos2(pos2), color(color)
|
||||
{}
|
||||
|
||||
void SimpleLine::showAll(Canvas & to)
|
||||
{
|
||||
to.drawLine(pos1 + pos.topLeft(), pos2 + pos.topLeft(), color, color);
|
||||
}
|
@ -226,3 +226,24 @@ public:
|
||||
|
||||
MoraleLuckBox(bool Morale, const Rect &r, bool Small=false);
|
||||
};
|
||||
|
||||
class TransparentFilledRectangle : public CIntObject
|
||||
{
|
||||
ColorRGBA color;
|
||||
ColorRGBA colorLine;
|
||||
bool drawLine;
|
||||
public:
|
||||
TransparentFilledRectangle(Rect position, ColorRGBA color);
|
||||
TransparentFilledRectangle(Rect position, ColorRGBA color, ColorRGBA colorLine);
|
||||
void showAll(Canvas & to) override;
|
||||
};
|
||||
|
||||
class SimpleLine : public CIntObject
|
||||
{
|
||||
Point pos1;
|
||||
Point pos2;
|
||||
ColorRGBA color;
|
||||
public:
|
||||
SimpleLine(Point pos1, Point pos2, ColorRGBA color);
|
||||
void showAll(Canvas & to) override;
|
||||
};
|
@ -20,6 +20,7 @@
|
||||
#include "../widgets/CComponent.h"
|
||||
#include "../widgets/Images.h"
|
||||
#include "../widgets/TextControls.h"
|
||||
#include "../widgets/MiscWidgets.h"
|
||||
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
|
@ -17,6 +17,8 @@ class CFilledTexture;
|
||||
class CAnimImage;
|
||||
class CComponentBox;
|
||||
class CTextBox;
|
||||
class TransparentFilledRectangle;
|
||||
class SimpleLine;
|
||||
|
||||
class CHeroOverview : public CWindowObject
|
||||
{
|
||||
|
@ -98,6 +98,11 @@ public:
|
||||
return Point(w,h);
|
||||
}
|
||||
|
||||
Rect resize(const int size) const
|
||||
{
|
||||
return Rect(x-size,y-size,w+size,h+size);
|
||||
}
|
||||
|
||||
void moveTo(const Point & dest)
|
||||
{
|
||||
x = dest.x;
|
||||
|
Loading…
Reference in New Issue
Block a user