示例#1
0
void CBricks::fillLine(QLineF line)
{
    if (qAbs(line.p1().x() - line.p2().x()) > qAbs(line.p1().y() - line.p2().y())) {
        int a = qRound(qMin(line.p1().x(), line.p2().x()));
        int b = qRound(qMax(line.p1().x(), line.p2().x()));
        int y = qRound(line.p1().y());
        for (int i = a; i <= b; ++i) {
            setBrick(i, y, 1);
        }
    } else {
        int a = qRound(qMin(line.p1().y(), line.p2().y()));
        int b = qRound(qMax(line.p1().y(), line.p2().y()));
        int x = qRound(line.p1().x());
        for (int i = a; i <= b; ++i) {
            setBrick(x, i, 1);
        }
    }
}
示例#2
0
文件: printer.c 项目: drreform/nxt
// Go through the vector, set bricks, and move conveyor after each row
void writeLetter(char* letter, int size)
{
	for(int i=0; i<size; i++)
	{
		// move the conveyor
		if (i!=0 && i%5==0){
			sendMessageWithParm(CONVEYOR, CONVEYOR_MOVE, 1);
			PlaySound(soundBeepBeep);
			wait1Msec(500);
		}

		if (letter[i]=='1'){
			sendMessageWithParm(WEBSERVER, STT_PRINTING, i);
			setBrick(i%5,0);
			// Calibrate after each brick placement
			moveToOrigin();
		}
	}

}
示例#3
0
void CBricks::setBrick(int col, int row, int value)
{
    setBrick(col + m_size * row, value);
}