📄 d-circle.h
字号:
#ifndef __CIRCLE_H__
#define __CIRCLE_H__
class CCircle : public CShape
{
private:
CPoint m_Center;
int m_nRadius;
public:
CCircle(const int x, const int y, const int r)
: m_Center(x, y), m_nRadius(r) {}
CCircle(const CPoint& p, const int r) : m_Center(p), m_nRadius(r) {}
CCircle(const CCircle& c)
: m_Center(c.m_Center), m_nRadius(c.m_nRadius) {}
~CCircle() {}
void Show(const int color) const
{
CGraphEnv::SetColor(color);
CGraphEnv::Circle(m_Center.x, m_Center.y, m_nRadius);
}
void Move(const int offsetX, const int offsetY)
{
m_Center += CPoint(offsetX, offsetY);
Show(CGraphEnv::COLOR_LIGHTMAGENTA);
CGraphEnv::Outtextxy(m_Center.x, m_Center.y, "moved");
}
void Inflate(const float s)
{
m_Center *= s;
m_nRadius = int(m_nRadius * s);
Show(CGraphEnv::COLOR_YELLOW);
CGraphEnv::Outtextxy(m_Center.x, m_Center.y, "inflated");
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -