CLauncher::CLauncher(QWidget *pParent) : QWidget::QWidget(pParent) { // Configuration of the window setWindowTitle(tr("BomberLua launcher")); // Horizontal layout { QHBoxLayout *layout = new QHBoxLayout; // List of bots m_pBotsList = new QListWidget; layout->addWidget(m_pBotsList); // Vertical layout { QVBoxLayout *column = new QVBoxLayout; // Button to add a bot QPushButton *add = new QPushButton(tr("Add a bot")); connect(add, SIGNAL(clicked()), this, SLOT(addBot())); column->addWidget(add); // Button to remove a bot QPushButton *remove = new QPushButton(tr("Remove this bot")); connect(remove, SIGNAL(clicked()), this, SLOT(removeBot())); column->addWidget(remove); // Allows to choose whether to run graphically or not m_pGraphic = new QCheckBox(tr("Graphics")); m_pGraphic->setCheckState(Qt::Checked); column->addWidget(m_pGraphic); // Button to start the game QPushButton *startButton = new QPushButton(tr("Start")); connect(startButton, SIGNAL(clicked()), this, SLOT(start())); column->addWidget(startButton); layout->addLayout(column); } setLayout(layout); } }
CLauncher::CLauncher(QWidget *pParent) : QWidget::QWidget(pParent) { // Paramétrage de la fenêtre setWindowTitle(tr("BomberLua launcher")); // Layout horizontal { QHBoxLayout *layout = new QHBoxLayout; // Liste des bots m_pBotsList = new QListWidget; layout->addWidget(m_pBotsList); // Layout vertical { QVBoxLayout *column = new QVBoxLayout; // Bouton pour ajouter un bot QPushButton *add = new QPushButton(tr("Ajouter un bot")); connect(add, SIGNAL(clicked()), this, SLOT(addBot())); column->addWidget(add); // Bouton pour enlever un bot QPushButton *remove = new QPushButton(tr("Retirer ce bot")); connect(remove, SIGNAL(clicked()), this, SLOT(removeBot())); column->addWidget(remove); // Permet de choisir si on est graphique ou pas m_pGraphic = new QCheckBox(tr("Graphique")); m_pGraphic->setCheckState(Qt::Checked); column->addWidget(m_pGraphic); // Bouton pour lancer le bazar QPushButton *startButton = new QPushButton(tr("Lancer")); connect(startButton, SIGNAL(clicked()), this, SLOT(start())); column->addWidget(startButton); layout->addLayout(column); } setLayout(layout); } }
void YASpriteManager::update(Game* game) { // Verify if some bot is dead list<Bot*>::iterator botIterator; botIterator = getBotsIterator(); Bot* toRemove = NULL; while (botIterator != getEndOfBotsIterator()) { EnemyBot *c = dynamic_cast<EnemyBot*>(*botIterator); if (c->isDead() && c->getActionTime() == 0 && c->getState() == BOT_DYING) { toRemove = c; } else toRemove = NULL; botIterator++; if (toRemove != NULL) removeBot(toRemove); } SpriteManager::update(game); }