Beispiel #1
0
std::vector<ruch> Plansza::znajdzRoznice( Plansza* plansza )
{
	std::vector<ruch> roznice;

	for ( int i = 0; i < 16; i++ )
		if ( this->dane[i] != plansza->dane[i] )
			roznice.push_back( ruch( i, dane[i], plansza->dane[i] ) );

	Q_ASSERT ( roznice.size() <= 1 );

	return roznice;
}
Beispiel #2
0
Plansza::Plansza(QWidget* parent):
    QLabel(parent),
    mapa(QRect(0, 0, 3000, 3000)),
    widok(QPoint(0, 0)),
    czolg(QPointF(100, 100), QPixmap(":/tank_korpus.png"), QPixmap(":/tank_wieza.png"), -10, 23, 0, 10, M_PI_2),
    rotacja_wiezy(0),
    strzal(false),
    o(0, 0, 0, 0) {
    connect(&this->timer, SIGNAL(timeout()), this, SLOT(ruch()));
    this->resize(800, 600);
    this->ilosc_odcinkow = 1;
    this->odcinki = new QLine[this->ilosc_odcinkow];
    this->odcinki[0] = QLine(500, 100, 550, 700);
    this->predkosc[0] = this->predkosc[1] = 0;
    this->timer.start(20);
}