Magic_Game/Easy2D/Node/Shape/Rectangle.cpp

58 lines
792 B
C++
Raw Normal View History

2017-09-10 23:56:52 +08:00
#include "..\..\easy2d.h"
#include "..\..\EasyX\easyx.h"
2017-09-27 17:56:28 +08:00
Rect::Rect()
2017-09-10 23:56:52 +08:00
{
}
Rect::Rect(int x, int y, int width, int height) :
2017-09-27 17:56:28 +08:00
m_Size(width, height)
2017-09-10 23:56:52 +08:00
{
2017-09-27 17:56:28 +08:00
setPos(x, y);
2017-09-10 23:56:52 +08:00
}
Rect::~Rect()
{
}
void Rect::solidShape()
{
2017-09-27 17:56:28 +08:00
solidrectangle(getX(), getY(), getX() + m_Size.cx, getY() + m_Size.cy);
2017-09-10 23:56:52 +08:00
}
void Rect::fillShape()
{
2017-09-27 17:56:28 +08:00
fillrectangle(getX(), getY(), getX() + m_Size.cx, getY() + m_Size.cy);
2017-09-10 23:56:52 +08:00
}
void Rect::roundShape()
{
2017-09-27 17:56:28 +08:00
rectangle(getX(), getY(), getX() + m_Size.cx, getY() + m_Size.cy);
2017-09-10 23:56:52 +08:00
}
int Rect::getWidth() const
{
2017-09-27 17:56:28 +08:00
return m_Size.cx;
2017-09-10 23:56:52 +08:00
}
int Rect::getHeight() const
{
2017-09-27 17:56:28 +08:00
return m_Size.cy;
2017-09-10 23:56:52 +08:00
}
void Rect::setWidth(int width)
{
2017-09-27 17:56:28 +08:00
m_Size.cx = width;
2017-09-10 23:56:52 +08:00
}
void Rect::setHeight(int height)
{
2017-09-27 17:56:28 +08:00
m_Size.cy = height;
2017-09-10 23:56:52 +08:00
}
void Rect::setSize(int width, int height)
{
2017-09-27 17:56:28 +08:00
m_Size.cx = width;
m_Size.cy = height;
2017-09-10 23:56:52 +08:00
}