比如说画个矩形, 定位到屏幕中心,然后锚个点就行了
drawRect(WIDTH >>1, HEIGHT >>1, 100, 100, HCENTER|VCENTER)
void drawRect(int16 x, int16 y, int16 w, int16 h, int anchor)
{
switch (anchor)
{
case HCENTER|VCENTER:
x -= w / 2;
y -= h / 2;
break;
}
drawLine(x, y, x, y + h - 1);
drawLine(x, y, x + w - 1, y);
drawLine(x + w -1, y, x + w -1, y + h);
drawLine(x , y + h - 1, x + w - 1, y + h -1);
}
[
本帖最后由 BlueGuy 于 2011-3-6 16:56 编辑 ]