/*!\func * show popup menu on node * \param no * \return */ void SequenceBody::ppMenu() { LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">"); ppTopMenu.clear(); qint16 items = MENUITEM_ADDSIMPLERELATION | MENUITEM_REMOVENODE | MENUITEM_EDIT | MENUITEM_DOWN; setMenuItems(ppTopMenu, items); ppTopMenu.exec(QCursor().pos()); }
Mainscene::Mainscene() : Scene(){ house = new SimpleEntity(); house->setPng("assets/huis.png"); addEntity(house); blackfader = new Shape(); blackfader->position = Vector2(1000,1000); blackfader->layer = 3; addShape(blackfader); blackfader->square(2000,2000); blackfader->color = BLACK; blackfader->color.a = 0; blackfader->isHud = true; house->layer = 5; house->scale = Vector2(0.4f ,0.4f); house->position = Vector2(780, 1130); priceText = new Text(); priceText->setFont("assets/Inder-Regular.ttf", 30); priceText->setText("50 coins"); priceText->isHud = true; priceText->color = BLACK; priceText->scale = Vector2(0.9, 0.9); addText(priceText); SDL_ShowCursor(0); waveText = new Text(); waveText->isHud = true; waveText->setFont("assets/Inder-Regular.ttf", 30); waveText->setText("Wave: 1"); addText(waveText); waveText->position = Vector2(20, 20); wave = 0; enemiesToSpawn = 10; spawnTimer = 8; waveTimerText = new Text(); waveTimerText->setFont("assets/agoestoesan.ttf", 100); waveTimerText->setText("8"); waveTimerText->color = RED; waveTimerText->color.a = 0; addText(waveTimerText); waveTimerText->isHud = true; waveTimerText->position = Vector2(550, 720/2); setMenuItems(); usedInit = false; canPlace = true; background = new SimpleEntity(); addEntity(background); cursor = new HudObject(); lockBunny = false; toolbarMustPop = false; cursor->setPng("assets/pointer.png"); lockedItem = NULL; captureMouseDistance = false; dreamHealth = 100.0f; hudRangeIndicator = new Shape(); hudRangeIndicator->isHud = true; hudRangeIndicator->color = Color(252, 61, 61, 100); damageText = new Text(); damageText->setFont("assets/Inder-Regular.ttf", 30); damageText->setText("Damage: 5"); damageText->isHud = true; addText(damageText); damageText->position = Vector2(300,750); background->setPng("assets/map_0-1.png"); background->position = Vector2(1024/2, 1296/2); pathpoints.push_back(Vector2(804,- 50)); pathpoints.push_back(Vector2(804,330)); pathpoints.push_back(Vector2(474,330)); pathpoints.push_back(Vector2(474,72)); pathpoints.push_back(Vector2(210,72)); pathpoints.push_back(Vector2(210,1063)); pathpoints.push_back(Vector2(491,1063)); pathpoints.push_back(Vector2(491,531)); pathpoints.push_back(Vector2(790,531)); pathpoints.push_back(Vector2(790,1286)); for(unsigned int i = 0; i < 3; i++){ Worker* worker = new Worker(); worker->homePos = Vector2(490 + (130*i), 420); worker->position = worker->homePos; addEntity(worker); worker->layer = 3; readyWorkers.push_back(worker); } lastDistance = Vector2(); mouseDistance = Vector2(); notEnoughText = new Text(); addText(notEnoughText); notEnoughText->setText("Not enough coins!!"); notEnoughText->position = Vector2(350, 720/2); notEnoughText->setFont("assets/Inder-Regular.ttf", 40); notEnoughText->color = Color(255,0,0, 0); notEnoughText->isHud = true; coins = 100; coinsText = new Text(); enemiesThisWave = 10; coinsText->isHud = true; coinsText->setFont("assets/Inder-Regular.ttf", 30); coinsText->setText("Coins: "); coinsText->position = Vector2(1280-230, 20); coinsText->scale = Vector2(0.5f, 0.5f); availableWorkersText = new Text(); availableWorkersText->isHud = true; availableWorkersText->position = Vector2(1280-230, 40); availableWorkersText->setFont("assets/Inder-Regular.ttf", 30); availableWorkersText->scale = Vector2(0.5f, 0.5f); waveTimer = 8; availableWorkersText->setText("Available Workers: 0"); addText(availableWorkersText); addText(coinsText); rangeText = new Text(); rangeText->setFont("assets/Inder-Regular.ttf", 30); rangeText->setText("Shooting range: 100"); rangeText->isHud = true; addText(rangeText); rangeText->position = Vector2(300,750); scrollvel = Vector2(); scrollacc = Vector2(); counter = 0; bgmusic = new Sound("assets/sound/bg-music.wav"); bgmusic->setVolume(15); chooseframe = new HudObject(); chooseframe->setPng("assets/chooseframe.png"); addHudObject(chooseframe); chooseframe->position = Vector2(1280-256/2, 720/2); toolbar = new HudObject(); toolbar->setPng("assets/toolbar.png"); toolbar->position = Vector2(520, 720+(64)); toolbar->scale = Vector2(2,2); addHudObject(toolbar); lockDog = false; notenoughAlpha = 0; cursor->scale = Vector2(0.1f, 0.1f); cursor->layer = 4; addHudObject(cursor); statusBarAnger = new HudObject(); statusBarAnger->setPng("assets/status_bar_anger.png"); addHudObject(statusBarAnger); statusBarAnger->position = Vector2(440,18); statusBarAnger->scale = Vector2(0.92f, 1); statusBarHappiness = new HudObject(); statusBarHappiness->setPng("assets/status_bar_happiness.png"); addHudObject(statusBarHappiness); statusBarHappiness->position = Vector2(620,18); statusBarHappiness->scale = Vector2(0.92f, 1); statusBarFrame = new HudObject(); statusBarFrame->setPng("assets/status_bar_frame.png"); addHudObject(statusBarFrame); statusBarFrame->position = Vector2(530, 18); statusBarAnger->uvOffset = Vector2(-0.5f, 0); upgradeBtn = new HudObject(); upgradeBtn->position.y = 3000; addHudObject(upgradeBtn); upgradeBtn->scale = Vector2(0.7f, 0.7f); upgradeBtn->setPng("assets/upgrade_button.png"); upgradetxt = new Text(); upgradetxt->setFont("assets/Inder-Regular.ttf", 30); upgradetxt->isHud = true; upgradetxt->setText("Upgrade"); addText(upgradetxt); upgradePriceText = new Text(); upgradePriceText->isHud = true; upgradePriceText->setFont("assets/Inder-Regular.ttf", 30); upgradePriceText->setText("Upgrade Price: 10"); addText(upgradePriceText); pricetag = new HudObject(); pricetag->setPng("assets/pricetag.png"); addHudObject(pricetag); pricetag->position = Vector2(-1000, -1000); pricetag->scale = Vector2(0.8, 0.8); tmpH = 100; tmpW = 100; waveEnd = true; }