myrect.cpp
来自「在代码中演示使用C++开发的BREW端方便的程序 非常值得初学者学习.」· C++ 代码 · 共 52 行
CPP
52 行
// Rect.cpp: implementation of the CRect class.
//
//////////////////////////////////////////////////////////////////////
#include "myRect.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRect::CRect()
{
}
CRect::~CRect()
{
}
boolean CRect::draw(IGraphics *pg)
{
boolean rval;
AEERect r;
r.x = m_ulc.getx();
r.y = m_ulc.gety();
r.dx = m_lrc.getx() - r.x;
r.dy = m_lrc.gety() - r.y;
rval = (IGRAPHICS_DrawRect(pg, &r) == SUCCESS);
return rval;
}
CRect::CRect(int16 x, int16 y, int16 dx, int16 dy, RGBVAL col): CShape(CColor(col)),
m_ulc(x,y), m_lrc(x+dx, y+dy)
{
}
CRect::CRect(CPoint ulc, CPoint lrc, RGBVAL col): CShape(CColor(col)), m_ulc(ulc), m_lrc(lrc)
{
}
void* CRect::operator new(size_t sz)
{
return MALLOC(sz);
}
void CRect::operator delete(void *p)
{
FREE(p);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?