//PUBLIC SLOTS void WorkProcessTypePicker::setSelectedType(AVType type){ setSelectedType(type, false); }
//PRIVATE SLOTS void WorkProcessTypePicker::btnAVTypeClicked(int id){ setSelectedType((AVType) id, true); }
GameScene::GameScene(GameView *parent) : QGraphicsScene(parent), m_level(1), m_highestLevel(1), m_gameState(GameRunning), m_dt(0), firstStep(true), m_selectedType(ParticlePositive), m_isSlowMotionEnabled(false), currentTime(0), lastFrameTime(0), frameNumber(0), dtSum(0) { qRegisterMetaType<GameScene::GameMode>("GameMode"); qRegisterMetaType<GameScene::GameState>("GameState"); #ifdef OS_IS_ANDROID qDebug() << "Force syncing settings"; settings.sync(); #endif if(isDemo()) { qDebug() << "This is the demo version"; } else { qDebug() << "This is the full version"; } setSelectedType(ParticlePositive); // load images selectionImage = QImage(":/images/selection-overlay.png"); positiveImage = QImage(":/images/particle-positive.png"); negativeImage = QImage(":/images/particle-negative.png"); neutralImage = QImage(":/images/particle-neutral.png"); playerImage = QImage(":/images/particle-player.png"); playerOverchargedImage = QImage(":/images/particle-player-overcharged.png"); glowingImage = QImage(":/images/particle-glowing.png"); enemyImage = QImage(":/images/particle-enemy.png"); slowMotionImage = QImage(":/images/particle-slow-motion.png"); repellentImage = QImage(":/images/particle-repellent.png"); transferImage = QImage(":/images/particle-transfer.png"); setSceneRect(0, 0, 854, 480); // TODO: just for init, should be chosen by the platform setItemIndexMethod(QGraphicsScene::NoIndex); // Background image QPixmap backgroundPixmap(":/images/background.png"); backgroundImage = this->addPixmap(backgroundPixmap); // Main menu QDeclarativeEngine *engine = new QDeclarativeEngine; //#ifdef OS_IS_ANDROID // QDeclarativeComponent mainMenuComponent(engine, QUrl(adjustPath("assets:/qml/MainMenu.qml"))); //#else QDeclarativeComponent mainMenuComponent(engine, QUrl("qrc:/qml/MainMenu.qml")); //#endif engine->rootContext()->setContextProperty("contextGameScene", this); mainMenu = qobject_cast<QGraphicsObject *>(mainMenuComponent.create()); qDebug() << "Component errors:\n" << mainMenuComponent.errors(); qDebug() << "End component errors"; // Connect the QML back to this class addItem(mainMenu); mainMenu->setZValue(1000); m_specialParticles = new QList<int>; #ifdef OS_IS_HARMATTAN mainMenu->setProperty("exit.visible", false); #endif #ifdef OS_IS_SYMBIAN qreal screenWidth = QApplication::desktop()->screenGeometry().width(); qreal screenHeight = QApplication::desktop()->screenGeometry().height(); if(screenWidth > screenHeight) { // Symbian hack mainMenu->setProperty("width", screenWidth); mainMenu->setProperty("height", screenHeight); } else { mainMenu->setProperty("width", screenHeight); mainMenu->setProperty("height", screenWidth); } #endif // set up timer levelTimer = new QTimer(this); levelTimer->setInterval(1000); connect(levelTimer, SIGNAL(timeout()), SLOT(updateLevelTime())); // Set up animations timeFactorAnimation = new QPropertyAnimation(this, "timeFactor"); qDebug() << "Highest level is" << m_level; setGameState(GameStarted); // just init all in the resize() function resized(); // Start level and start timers // startLevel(level()); connect(&advanceTimer, SIGNAL(timeout()), SLOT(advance())); advanceTimer.start(10); time.start(); qDebug() << "Timers started!"; // dashboard button #if (defined(OS_IS_DESKTOP_LINUX) || defined(Q_OS_WIN32) || defined(Q_OS_MAC) || defined(Q_WS_MAEMO_5)) qDebug() << "Show dashboard button"; mainMenu->setProperty("dashboardButtonVisible", true); #else qDebug() << "Don't show dashboard button"; mainMenu->setProperty("dashboardButtonVisible", false); #endif // load settings setGameMode((GameMode)settings.value("gameMode", ModeClassic).toInt()); }