diff --git a/AlienDefender-readme.txt b/AlienDefender-readme.txt index 11e8bd7..cdf5a31 100644 --- a/AlienDefender-readme.txt +++ b/AlienDefender-readme.txt @@ -2,7 +2,9 @@ hello this is the source code of wavetrace(base part of game) to compilling this code you must have QT4 library and gcc compiller to make this project you cad do: - $ qmake -project + $ qmake + $ make clean + $ make distclean $ qmake $ make -or open the .pro file in Qt-Creator and run aplication. +or open the aliendefender.pro file in Qt-Creator and run aplication. diff --git a/Makefile b/Makefile index a7d4447..5ea983a 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,21 @@ ############################################################################# # Makefile for building: aliendefender -# Generated by qmake (2.01a) (Qt 4.5.2) on: ?? ????. 3 22:49:40 2009 +# Generated by qmake (2.01a) (Qt 4.5.2) on: ?? ????. 3 23:47:46 2009 # Project: aliendefender.pro # Template: app -# Command: /usr/bin/qmake -unix -o Makefile aliendefender.pro +# Command: /usr/bin/qmake -Wall -spec ../../share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro ############################################################################# ####### Compiler, tools and options CC = gcc CXX = g++ -DEFINES = -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -CFLAGS = -pipe -march=native -O2 -pipe -fomit-frame-pointer -Wall -W -D_REENTRANT $(DEFINES) -CXXFLAGS = -pipe -march=native -O2 -pipe -fomit-frame-pointer -Wall -W -D_REENTRANT $(DEFINES) +DEFINES = -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES) INCPATH = -I../../share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I/usr/include -I. -I. LINK = g++ -LFLAGS = -Wl,-O1 +LFLAGS = LIBS = $(SUBLIBS) -L/usr/lib/qt4 -L/usr/X11R6/lib -lQtOpenGL -L/usr/lib/qt4 -L/usr/X11R6/lib -pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread -lQtGui -pthread -lpng -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lXrandr -lXinerama -lfontconfig -lXext -lX11 -lQtNetwork -pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lGLU -lGL -lpthread AR = ar cqs RANLIB = @@ -65,7 +65,7 @@ DIST = ../../share/qt4/mkspecs/common/g++.conf \ ../../share/qt4/mkspecs/features/qt_config.prf \ ../../share/qt4/mkspecs/features/exclusive_builds.prf \ ../../share/qt4/mkspecs/features/default_pre.prf \ - ../../share/qt4/mkspecs/features/release.prf \ + ../../share/qt4/mkspecs/features/debug.prf \ ../../share/qt4/mkspecs/features/default_post.prf \ ../../share/qt4/mkspecs/features/warn_on.prf \ ../../share/qt4/mkspecs/features/qt.prf \ @@ -117,7 +117,7 @@ Makefile: aliendefender.pro ../../share/qt4/mkspecs/linux-g++/qmake.conf ../../ ../../share/qt4/mkspecs/features/qt_config.prf \ ../../share/qt4/mkspecs/features/exclusive_builds.prf \ ../../share/qt4/mkspecs/features/default_pre.prf \ - ../../share/qt4/mkspecs/features/release.prf \ + ../../share/qt4/mkspecs/features/debug.prf \ ../../share/qt4/mkspecs/features/default_post.prf \ ../../share/qt4/mkspecs/features/warn_on.prf \ ../../share/qt4/mkspecs/features/qt.prf \ @@ -133,7 +133,7 @@ Makefile: aliendefender.pro ../../share/qt4/mkspecs/linux-g++/qmake.conf ../../ /usr/lib/qt4/libQtGui.prl \ /usr/lib/qt4/libQtCore.prl \ /usr/lib/qt4/libQtNetwork.prl - $(QMAKE) -unix -o Makefile aliendefender.pro + $(QMAKE) -Wall -spec ../../share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro ../../share/qt4/mkspecs/common/g++.conf: ../../share/qt4/mkspecs/common/unix.conf: ../../share/qt4/mkspecs/common/linux.conf: @@ -142,7 +142,7 @@ Makefile: aliendefender.pro ../../share/qt4/mkspecs/linux-g++/qmake.conf ../../ ../../share/qt4/mkspecs/features/qt_config.prf: ../../share/qt4/mkspecs/features/exclusive_builds.prf: ../../share/qt4/mkspecs/features/default_pre.prf: -../../share/qt4/mkspecs/features/release.prf: +../../share/qt4/mkspecs/features/debug.prf: ../../share/qt4/mkspecs/features/default_post.prf: ../../share/qt4/mkspecs/features/warn_on.prf: ../../share/qt4/mkspecs/features/qt.prf: @@ -159,7 +159,7 @@ Makefile: aliendefender.pro ../../share/qt4/mkspecs/linux-g++/qmake.conf ../../ /usr/lib/qt4/libQtCore.prl: /usr/lib/qt4/libQtNetwork.prl: qmake: FORCE - @$(QMAKE) -unix -o Makefile aliendefender.pro + @$(QMAKE) -Wall -spec ../../share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro dist: @$(CHK_DIR_EXISTS) .tmp/aliendefender1.0.0 || $(MKDIR) .tmp/aliendefender1.0.0 diff --git a/adpainter.cpp b/adpainter.cpp index 17e5a51..f093415 100644 --- a/adpainter.cpp +++ b/adpainter.cpp @@ -14,8 +14,7 @@ adpainter::adpainter(int width, int height, int adpcellsize) str.setNum(i); while (i != 0) { str.setNum(i); - tmpAlPixmap.load("./images/Aliens/Al_00_" + str + ".png"); - qDebug() << tmpAlPixmap.isNull(); + tmpAlPixmap.load("./images/Aliens/Al_0_" + str + ".png"); if (!tmpAlPixmap.isNull()) { AlienPix.push_back(tmpAlPixmap); tmpAlPixmap = 0; @@ -60,11 +59,7 @@ void adpainter::drawgrid() void adpainter::drawAliens(QVector path, FPVector * position) { float tmpdx,tmpdy,arctg,tmpdx1,tmpdy1; - //unsigned char dd[4]; - //int gg; arctg = 0; - //qDebug() << path.size(); - //QTransform rotated; painter.begin(buff); pen->setColor(QColor::fromRgb(qRgb(80,200,100))); brush->setColor(QColor::fromRgb(qRgb(230,10,10))); @@ -82,48 +77,30 @@ void adpainter::drawAliens(QVector path, FPVector * position) tmpdy1 = position->pnt.y() - path.at(StepAlien+1).y()*cellsize; } arctg = atanf(tmpdx1/tmpdy1); - //memcpy(&gg,&arctg,4); position->angle = 180*(-arctg)/3.1415; if (tmpdy1 < 0) position->angle = 180 + position->angle; if (AlienPix.size() > 0) { - //painter.rotate((arctg/3.1415)*180); - //rotated.rotateRadians(arctg/* + 3.1415/2*/); - qDebug() << "angle:" << position->angle; - //rotated.reset(); + //qDebug() << "angle:" << position->angle; if (qAbs(tmpdx) < 1 && qAbs(tmpdy) < 1) StepAlien++; else { if (qAbs(tmpdx) <= qAbs(tmpdy)) { - if (tmpdy < 0) { - position->pnt.ry()++; - //position->angle = - position->angle; - } - else { - position->pnt.ry()--; - } + if (tmpdy < 0) position->pnt.ry()++; + else position->pnt.ry()--; } if (qAbs(tmpdx) >= qAbs(tmpdy)) { - if (tmpdx < 0) { - position->pnt.rx()++; - //position->angle = - position->angle; - } + if (tmpdx < 0) position->pnt.rx()++; else position->pnt.rx()--; } } - //painter.save(); painter.translate(position->pnt.x()+cellsize/2, position->pnt.y()+cellsize/2); - //if (arctg == 0) painter.rotate(90); - //memcpy(dd,&gg,4); - //dd[0]=0xFF; - //qDebug() << "angle:" << position->angle; - //qDebug() << dd[0] << dd[1] << dd[2] << dd[3]; painter.rotate(position->angle); - //position->pnt.setX(path.at(0).x()); - //position->pnt.setY(path.at(0).y()); painter.drawPixmap(-cellsize, -cellsize, cellsize*2, cellsize*2, AlienPix.at(AnimAlien)); AnimAlien++; - //painter.restore(); if (AnimAlien >= AlienPix.size()) AnimAlien = 0; - if (StepAlien >= path.size()) StepAlien = 0; + if (StepAlien >= path.size()) { + StepAlien = 0; + position->pnt = path.at(0); + } //qDebug() << StepAlien; } painter.end(); diff --git a/adpainter.o b/adpainter.o index f7ce176..7d91785 100644 Binary files a/adpainter.o and b/adpainter.o differ diff --git a/aliendefender b/aliendefender index eb18e63..a35a100 100755 Binary files a/aliendefender and b/aliendefender differ diff --git a/aliendefender.pro.user b/aliendefender.pro.user index 4a24c26..b82bcee 100644 --- a/aliendefender.pro.user +++ b/aliendefender.pro.user @@ -10,7 +10,7 @@ RunConfiguration0-RunConfiguration.name - wavetrace + aliendefender RunConfiguration0-UseDyldImageSuffix @@ -26,15 +26,47 @@ RunConfiguration0-UserSetName - false + true RunConfiguration0-type Qt4ProjectManager.Qt4RunConfiguration + + RunConfiguration1-CommandLineArguments + + + + RunConfiguration1-ProFile + aliendefender.pro + + + RunConfiguration1-RunConfiguration.name + aliendefender + + + RunConfiguration1-UseDyldImageSuffix + false + + + RunConfiguration1-UseTerminal + false + + + RunConfiguration1-UserEnvironmentChanges + + + + RunConfiguration1-UserSetName + false + + + RunConfiguration1-type + Qt4ProjectManager.Qt4RunConfiguration + activeRunConfiguration - 0 + 1 activebuildconfiguration @@ -46,7 +78,7 @@ Debug 0 - /home/andrey/sm11/Alien Defender/wavetrace + /home/andrey/aliendefender @@ -110,7 +142,7 @@ XSESSION=icewm - /home/andrey/sm11/Alien Defender/wavetrace/wavetrace.pro + /home/andrey/aliendefender/aliendefender.pro -spec /usr/share/qt4/mkspecs/linux-g++ -r @@ -119,7 +151,7 @@ /usr/bin/qmake false - /home/andrey/sm11/Alien Defender/wavetrace + /home/andrey/aliendefender 2 -Wall @@ -184,7 +216,7 @@ /usr/bin/make true - /home/andrey/sm11/Alien Defender/wavetrace + /home/andrey/aliendefender -j3 diff --git a/aliens.cpp b/aliens.cpp index f8036be..1a14a98 100644 --- a/aliens.cpp +++ b/aliens.cpp @@ -10,7 +10,7 @@ Aliens::Aliens(int TmpDestx, int TmpDesty, int afw, int afh, int alcellsize) fw = afw; fh = afh; //AliensCnt = -1; - //CurWave = 0; + CurWave = -1; Cells = new int*[fw]; TmpCells = new int*[fw]; for (int i = 0; i < fw; i++) { @@ -18,29 +18,58 @@ Aliens::Aliens(int TmpDestx, int TmpDesty, int afw, int afh, int alcellsize) TmpCells[i] = new int[fh]; } clearCells(); + Alien al; + al.PicType = 0; + al.PathIndex = 0; + al.PicFrame = 0; + al.Speed = 1; + srcAliens.push_back(al); + CurWave = 0; } -int Aliens::loadAlienImages(int PicType) +bool Aliens::loadPixmaps(Alien * al) +{ + if (AliensPixmaps.size() != 0) { + for (int i = 0; i < AliensPixmaps.size(); i++) { + if (AliensPixmaps[i].type == al->PicType) { + qDebug() << "Pictures exist!"; + return true; + } + } + } + AlienImages * pixmaps; + pixmaps = new AlienImages; + if (loadPixmap(al->PicType,pixmaps) > 0) AliensPixmaps.push_back(* pixmaps); + else return false; + qDebug() << "Pictures loaded!"; + return true; +} + + +int Aliens::loadPixmap(int PicType, AlienImages * pixmaps) { int i = 1; QString str1,str2; QPixmap tmpAlPixmap; str1.setNum(i); str2.setNum(PicType); + qDebug() << PicType; while (i != 0) { str1.setNum(i); tmpAlPixmap.load("./images/Aliens/Al_" + str2 + "_" + str1 + ".png"); - qDebug() << tmpAlPixmap.isNull(); + //qDebug() << tmpAlPixmap.isNull(); if (!tmpAlPixmap.isNull()) { //AlienPix.push_back(tmpAlPixmap); + pixmaps->pix.push_back(tmpAlPixmap); + pixmaps->type = PicType; tmpAlPixmap = 0; i++; } else i = 0; } - //qDebug() << "pictures:" << AlienPix.size(); - return i; + qDebug() << "pictures:" << pixmaps->pix.size(); + return pixmaps->pix.size(); } @@ -53,24 +82,24 @@ void Aliens::clearCells() bool Aliens::AddAlien() { //bool ok; - Alien al; + //Alien al; //AliensCnt++; //if (CurWave < 0) CurWave = 0; //if (AliensCnt > curAliens.size()) ReDim Preserve Aliens(AliensCnt) As Alien //Aliens(AliensCnt) = SrcAliens(CurWave) - curAliens.push_back(al); //srcAliens[CurWave]); + curAliens.push_back(srcAliens.at(CurWave)); //curAliens[AliensCnt].Level = CurWave + 1; - curAliens[0].Position.pnt.setX(0); - curAliens[0].Position.pnt.setY(fh/2); //(int)(fh/2+(1-0.58)*6); + curAliens[curAliens.size()-1].Position.pnt.setX(0); + curAliens[curAliens.size()-1].Position.pnt.setY(fh/2); //(int)(fh/2+(1-0.58)*6); //DestPoint.setX(fw - 1); //DestPoint.setY(fh / 2); //curAliens[AliensCnt].Position.pnt.y(); - curAliens[0].DestPnt = DestPoint; + curAliens[curAliens.size()-1].DestPnt = DestPoint; // curAliens[AliensCnt].MaxFrame = 0; //srcAliens[CurWave].MaxFrame; // curAliens[AliensCnt].PicFrame = 0; for (int i = 0; i < fw; i++) { for (int j = 0; j < fh; j++) TmpCells[i][j] = Cells[i][j]; } - return CreatePath(&curAliens[0]); + return (CreatePath(&curAliens[curAliens.size()-1]) && loadPixmaps(&curAliens[curAliens.size()-1])); } @@ -89,6 +118,7 @@ bool Aliens::CreatePath(Alien * al) { tmpPnt.clear(); tp = al->path[0]; + //qDebug() << al->path.at(0); tmpPnt.push_back(tp); for (int i = 0; i < al->path.size() - 1; i++) { @@ -98,7 +128,7 @@ bool Aliens::CreatePath(Alien * al) } tp = al->path[al->path.size() - 1]; tmpPnt.push_back(tp); - qDebug() << tmpPnt.size(); + //qDebug() << tmpPnt.size(); al->path = tmpPnt; al->Position.pnt.setX(al->path.at(0).x()*cellsize); al->Position.pnt.setY(al->path.at(0).y()*cellsize); @@ -128,17 +158,38 @@ void Aliens::updateAlienPos(Alien * al) }*/ +bool Aliens::recreatePath() +{ + QPointF ap; + bool trace; + for (int i = 0; i < fw; i++) { + for (int j = 0; j < fh; j++) TmpCells[i][j] = Cells[i][j]; + } + for (int i = 0; i < curAliens.size(); i++) { + ap = curAliens[i].Position.pnt; + curAliens[i].Position.pnt.setX(0); + curAliens[i].Position.pnt.setY(fh/2); + curAliens[i].path.clear(); + trace = CreatePath(&curAliens[i]); + if (!trace) return false; + curAliens[i].Position.pnt = ap; + } + return true; +} + + bool Aliens::WaveTrace(Alien * al) { bool stop = false; int step = 2; - QPoint cp, tp; + QPoint cp, tp; QRect fr(0, 0, fw, fh); QVector tmpp, curp; - cp = al->Position.pnt; - curp.push_back(cp); + cp.setX(al->Position.pnt.x()); + cp.setY(al->Position.pnt.y()); + curp.push_back(cp); TmpCells[cp.x()][cp.y()] = 1; while (!stop) { - qDebug() << "trace"; + //qDebug() << "trace"; tmpp = curp; curp.clear(); qDebug() << tmpp.size(); @@ -317,6 +368,5 @@ void Aliens::InvWaveTrace(QPoint cp, int cnt, Alien * al) void Aliens::clearAliens() { - //AliensCnt = - 1; curAliens.clear(); } diff --git a/aliens.h b/aliens.h index 117a1dc..6b8ce96 100644 --- a/aliens.h +++ b/aliens.h @@ -13,23 +13,26 @@ class Aliens QVector curAliens; //vector< vector > TmpCells; int ** Cells; + int CurWave; //bool PathIntersect(Alien* Al, Rectangle rect); bool AddAlien(); void clearAliens(); void clearCells(); + bool recreatePath(); private: int cellsize; int ** TmpCells; int fw, fh; QPoint DestPoint; - QVector< QVector > AliensPixmaps; + QVector AliensPixmaps; //AlienImages AliensPixmaps[1]; - bool CreatePath(Alien* al); bool WaveTrace(Alien* al); - void InvWaveTrace(QPoint cp, int cnt, Alien* al); + bool CreatePath(Alien* al); + void InvWaveTrace(QPoint cp, int cnt, Alien* al); void updateAlienPos(Alien * al); - int loadAlienImages(int PicType); + int loadPixmap(int PicType, AlienImages * pixmaps); + bool loadPixmaps(Alien * al); }; #endif // ALIENS_H diff --git a/aliens.o b/aliens.o index f792657..e6122c7 100644 Binary files a/aliens.o and b/aliens.o differ diff --git a/basestruct.h b/basestruct.h index 541bd6b..80bc1c6 100644 --- a/basestruct.h +++ b/basestruct.h @@ -16,7 +16,7 @@ struct FPVector { - QPoint pnt; + QPointF pnt; float angle; }; @@ -32,10 +32,11 @@ struct FPVector };*/ -/*struct AlienImages +struct AlienImages { - vector pix; -};*/ + QVector pix; + int type; +}; struct Alien diff --git a/images/Aliens/Al_00_0.png b/images/Aliens/Al_0_0.png similarity index 100% rename from images/Aliens/Al_00_0.png rename to images/Aliens/Al_0_0.png diff --git a/images/Aliens/Al_00_1.png b/images/Aliens/Al_0_1.png similarity index 100% rename from images/Aliens/Al_00_1.png rename to images/Aliens/Al_0_1.png diff --git a/images/Aliens/Al_00_10.png b/images/Aliens/Al_0_10.png similarity index 100% rename from images/Aliens/Al_00_10.png rename to images/Aliens/Al_0_10.png diff --git a/images/Aliens/Al_00_11.png b/images/Aliens/Al_0_11.png similarity index 100% rename from images/Aliens/Al_00_11.png rename to images/Aliens/Al_0_11.png diff --git a/images/Aliens/Al_00_12.png b/images/Aliens/Al_0_12.png similarity index 100% rename from images/Aliens/Al_00_12.png rename to images/Aliens/Al_0_12.png diff --git a/images/Aliens/Al_00_13.png b/images/Aliens/Al_0_13.png similarity index 100% rename from images/Aliens/Al_00_13.png rename to images/Aliens/Al_0_13.png diff --git a/images/Aliens/Al_00_14.png b/images/Aliens/Al_0_14.png similarity index 100% rename from images/Aliens/Al_00_14.png rename to images/Aliens/Al_0_14.png diff --git a/images/Aliens/Al_00_15.png b/images/Aliens/Al_0_15.png similarity index 100% rename from images/Aliens/Al_00_15.png rename to images/Aliens/Al_0_15.png diff --git a/images/Aliens/Al_00_16.png b/images/Aliens/Al_0_16.png similarity index 100% rename from images/Aliens/Al_00_16.png rename to images/Aliens/Al_0_16.png diff --git a/images/Aliens/Al_00_17.png b/images/Aliens/Al_0_17.png similarity index 100% rename from images/Aliens/Al_00_17.png rename to images/Aliens/Al_0_17.png diff --git a/images/Aliens/Al_00_18.png b/images/Aliens/Al_0_18.png similarity index 100% rename from images/Aliens/Al_00_18.png rename to images/Aliens/Al_0_18.png diff --git a/images/Aliens/Al_00_19.png b/images/Aliens/Al_0_19.png similarity index 100% rename from images/Aliens/Al_00_19.png rename to images/Aliens/Al_0_19.png diff --git a/images/Aliens/Al_00_2.png b/images/Aliens/Al_0_2.png similarity index 100% rename from images/Aliens/Al_00_2.png rename to images/Aliens/Al_0_2.png diff --git a/images/Aliens/Al_00_3.png b/images/Aliens/Al_0_3.png similarity index 100% rename from images/Aliens/Al_00_3.png rename to images/Aliens/Al_0_3.png diff --git a/images/Aliens/Al_00_4.png b/images/Aliens/Al_0_4.png similarity index 100% rename from images/Aliens/Al_00_4.png rename to images/Aliens/Al_0_4.png diff --git a/images/Aliens/Al_00_5.png b/images/Aliens/Al_0_5.png similarity index 100% rename from images/Aliens/Al_00_5.png rename to images/Aliens/Al_0_5.png diff --git a/images/Aliens/Al_00_6.png b/images/Aliens/Al_0_6.png similarity index 100% rename from images/Aliens/Al_00_6.png rename to images/Aliens/Al_0_6.png diff --git a/images/Aliens/Al_00_7.png b/images/Aliens/Al_0_7.png similarity index 100% rename from images/Aliens/Al_00_7.png rename to images/Aliens/Al_0_7.png diff --git a/images/Aliens/Al_00_8.png b/images/Aliens/Al_0_8.png similarity index 100% rename from images/Aliens/Al_00_8.png rename to images/Aliens/Al_0_8.png diff --git a/images/Aliens/Al_00_9.png b/images/Aliens/Al_0_9.png similarity index 100% rename from images/Aliens/Al_00_9.png rename to images/Aliens/Al_0_9.png diff --git a/main.o b/main.o index 4b9eb43..2e88955 100644 Binary files a/main.o and b/main.o differ diff --git a/mainwindow.cpp b/mainwindow.cpp index d923635..c8520e5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -8,7 +8,7 @@ MainWindow::MainWindow(QWidget *parent) qDebug() << "Load START!"; ui->setupUi(this); sndr = new UdpSender("127.0.0.1",10101); - sndr->connectSend("hellow"); + //sndr->connectSend("hellow"); cellsize = 16; destx = this->width() / cellsize; desty = this->height() / cellsize / 2; @@ -18,7 +18,7 @@ MainWindow::MainWindow(QWidget *parent) adp->drawgrid(); connect(timer, SIGNAL(timeout()), this, SLOT(ADrender())); aliens = new Aliens(destx, desty, this->width() / cellsize ,this->height() / cellsize, cellsize); - aliens->AddAlien(); + if (!aliens->AddAlien()) qDebug() << "Error Loading"; this->setGeometry(100,100,this->width(),this->height()); //qDebug() << "QT version" << qVersion(); //AnimAlien = 0; @@ -29,6 +29,7 @@ MainWindow::MainWindow(QWidget *parent) void MainWindow::ADrender() { + //aliens->AddAlien(); adp->drawAliens(aliens->curAliens[0].path, &aliens->curAliens[0].Position); this->repaint(); } @@ -72,10 +73,10 @@ void MainWindow::SetCell(int x, int y) //qDebug() << "click: " << cp.x() << ";" << cp.y(); aliens->Cells[cp.x()][cp.y()] = - 1; adp->drawcell(cp); - aliens->clearAliens(); - adp->StepAlien=0; - adp->AnimAlien=0; - if (!aliens->AddAlien()) ClearCell(x,y); + //aliens->recreatePath(); + //adp->StepAlien=0; + //adp->AnimAlien=0; + if (!aliens->recreatePath()) ClearCell(x,y); } } @@ -90,8 +91,10 @@ void MainWindow::ClearCell(int x, int y) //qDebug() << "click: " << cp.x() << ";" << cp.y(); aliens->Cells[cp.x()][cp.y()] = 0; adp->clearcell(cp); - aliens->clearAliens(); - aliens->AddAlien(); + qDebug() << aliens->recreatePath(); + //aliens->clearAliens(); + //aliens->AddAlien(); + } } diff --git a/mainwindow.o b/mainwindow.o index 92a4a80..8eeaac5 100644 Binary files a/mainwindow.o and b/mainwindow.o differ diff --git a/mainwindow.ui b/mainwindow.ui index 2ce3903..1961cbe 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -31,7 +31,18 @@ MainWindow - + + + + + 40 + 20 + 361 + 181 + + + + diff --git a/moc_mainwindow.cpp b/moc_mainwindow.cpp index c472b24..9e955b9 100644 --- a/moc_mainwindow.cpp +++ b/moc_mainwindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'mainwindow.h' ** -** Created: Thu Sep 3 22:52:32 2009 +** Created: Fri Sep 4 20:48:45 2009 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2) ** ** WARNING! All changes made in this file will be lost! diff --git a/moc_mainwindow.o b/moc_mainwindow.o index ffffa15..ba641e7 100644 Binary files a/moc_mainwindow.o and b/moc_mainwindow.o differ diff --git a/moc_udpsender.cpp b/moc_udpsender.cpp index e7cb967..27a3107 100644 --- a/moc_udpsender.cpp +++ b/moc_udpsender.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'udpsender.h' ** -** Created: Thu Sep 3 22:52:35 2009 +** Created: Thu Sep 3 23:47:54 2009 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2) ** ** WARNING! All changes made in this file will be lost! diff --git a/moc_udpsender.o b/moc_udpsender.o index f41c305..a61af03 100644 Binary files a/moc_udpsender.o and b/moc_udpsender.o differ diff --git a/towers.o b/towers.o index 87498a0..317f352 100644 Binary files a/towers.o and b/towers.o differ diff --git a/udpsender.o b/udpsender.o index 76312ef..e8ec7ee 100644 Binary files a/udpsender.o and b/udpsender.o differ diff --git a/ui_mainwindow.h b/ui_mainwindow.h index 6f898a7..edf7656 100644 --- a/ui_mainwindow.h +++ b/ui_mainwindow.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading ui file 'mainwindow.ui' ** -** Created: Thu Sep 3 22:52:10 2009 +** Created: Fri Sep 4 20:29:58 2009 ** by: Qt User Interface Compiler version 4.5.2 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! @@ -24,6 +24,7 @@ class Ui_MainWindow { public: QWidget *widget; + QWidget *paintWidget; void setupUi(QMainWindow *MainWindow) { @@ -39,6 +40,9 @@ public: MainWindow->setBaseSize(QSize(800, 400)); widget = new QWidget(MainWindow); widget->setObjectName(QString::fromUtf8("widget")); + paintWidget = new QWidget(widget); + paintWidget->setObjectName(QString::fromUtf8("paintWidget")); + paintWidget->setGeometry(QRect(40, 20, 361, 181)); MainWindow->setCentralWidget(widget); retranslateUi(MainWindow);