void WorldController::updateWorld(float dt){
	if(!isPause){
		for(int i=0; i < world->getSpirits().size(); i++){	
			if(world->getSpirits().at(i)->getState() == DEFENCE)
				world->getSpirits().at(i)->setDefence(isDefenceSpirit);
			world->getSpirits().at(i)->go(world->getBricks(), world->getPlayer(), world->getSpirits().at(0)->getPosition());
		}
	
		if(world->deadPlayer()) {
			onPause();
			respawn();
		}

		world->deadSpirit();
	
		if(world->isVictory()) {
			onPause();
			UserDefault::getInstance()->setIntegerForKey(LevelMenuScene::parseLevel(world->getCurrentLevel()).c_str(), record);
			UserDefault::getInstance()->setIntegerForKey(LevelMenuScene::parseLevel(world->getCurrentLevel() + 1).c_str(), 1);
			UserDefault::getInstance()->flush();
			Director::getInstance()->pushScene(WorldScene::create(LevelMenuScene::parseLevel(world->getCurrentLevel() + 1), world->getCurrentLevel() + 1, soundController_)->getScene());
			newWorld();
		}

		if(world->isGameOver()) {
			onPause();
			newWorld();
		}
		 
	}

}
示例#2
0
文件: main.c 项目: yksz/samples
int main(void)
{
    onPlay();
    onPause();
    onPlay();
    onPlay();
    onStop();
    onPause();
    return 0;
}
示例#3
0
autobots_toutiao::autobots_toutiao(QWidget *parent)
	: control_status(true), QMainWindow(parent),
	m_account_order(0),m_device_order(0),
	m_client_id("394e2173327e4ead8302dc27f4ae8879")
{
	ui.setupUi(this);

	initialize();

	connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

	connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

	connect(ui.pushButton_add_comment_id, SIGNAL(clicked()), this, SLOT(onAddCommentID()));

	connect(ui.action_from_txt, SIGNAL(triggered()), this, SLOT(onActFromTxt()));

	connect(ui.action_import_commentid, SIGNAL(triggered()), this, SLOT(onActImportComment()));

	connect(ui.action_clear_comments, SIGNAL(triggered()), this, SLOT(onActClearComments()));

	connect(ui.action_clear_accounts, SIGNAL(triggered()), this, SLOT(onActClearAccounts()));

	//connect(&network, SIGNAL(postIdReady(QString)), this, SLOT(onPostIdReday(QString)));

	//connect(&network, SIGNAL(clientID(QString)), this, SLOT(onClientIdReday(QString)));

	//connect(&network, SIGNAL(csrftokenReady(QString)), this, SLOT(onCsrfTokenReday(QString)));

	//connect(&network, SIGNAL(loginsucceed(QString)), this, SLOT(onLoginsucceed(QString)));

	// connect(&network, SIGNAL(fatiesucceed(QString, double)), this, SLOT(onFatieSucceed(QString, double)));

	//connect(&network, SIGNAL(newCommentID(double)), this, SLOT(onNewCommentID(QString)));
}
示例#4
0
autobots_toutiao::autobots_toutiao(QWidget *parent)
    : control_status(true),QMainWindow(parent),network(NULL),
    m_client_id("394e2173327e4ead8302dc27f4ae8879")
{
    ui.setupUi(this);

    initialize();

    connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

    connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

    connect(ui.pushButton_add_comment_id, SIGNAL(clicked()), this, SLOT(onAddCommentID()));

    connect(ui.action_from_txt, SIGNAL(triggered()), this, SLOT(onActFromTxt()));

    connect(ui.action_import_commentid, SIGNAL(triggered()), this, SLOT(onActImportComment()));

    connect(ui.action_clear_comments, SIGNAL(triggered()), this, SLOT(onActClearComments()));

    connect(ui.action_clear_accounts, SIGNAL(triggered()), this, SLOT(onActClearAccounts()));

    connect(ui.pushButton_compute_num, SIGNAL(clicked()), this, SLOT(onComputeNumber()));

    connect(ui.pushButton_count, SIGNAL(clicked()), this, SLOT(onCountAll()));
}
示例#5
0
autobots_toutiao::autobots_toutiao(QWidget *parent)
    : QMainWindow(parent),
    m_account_order(0),m_comment_order(0),m_code_online(true)
    ,m_auto_change_ip(true)
{
    ui.setupUi(this);

    initialize();

    connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

    connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

    connect(ui.pushButton_develiver, SIGNAL(clicked()), this, SLOT(onDeveliver()));

    connect(ui.pushButton_add_comment_id, SIGNAL(clicked()), this, SLOT(onAddCommentID()));

    connect(ui.action_from_txt, SIGNAL(triggered()), this, SLOT(onActFromTxt()));

    connect(ui.action_import_commentid, SIGNAL(triggered()), this, SLOT(onActImportComment()));

    connect(ui.action_clear_comments, SIGNAL(triggered()), this, SLOT(onActClearComments()));

    connect(ui.action_clear_accounts, SIGNAL(triggered()), this, SLOT(onActClearAccounts()));

	connect(ui.comboBox_adsl, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onChanged(const QString&)));

	intialVPN();
}
void GuiComponent::pause()
{
	onPause();

	for(unsigned int i = 0; i < mChildren.size(); i++)
		mChildren.at(i)->pause();
}
示例#7
0
文件: GameLogic.cpp 项目: latzio/hawk
void GameLogic::onControlStopped(HawkControl control)
{
    if (m_state == LeaderBoard && m_leaderBoardReady && control == ActionA) {
        reset();
        m_playButton.isPressed = false;
        m_playButton.textY--;
    } else if (m_state == GamePlay) {
        if (m_gamePaused) {
            if (control == Menu2) {
                onResume();
            }
        } else {
            switch (control) {
            case MoveLeft:
                m_player->setHorizontalMovement(DynamicHawkBody::Stop);
                break;
            case MoveRight:
                m_player->setHorizontalMovement(DynamicHawkBody::Stop);
                break;
            case ActionA:
                break;
            case ActionB:
            case ActionX:
            case ActionY:
                break;
            case Menu2:
                onPause();
                break;
            }
        }
    }
}
示例#8
0
文件: GameLogic.cpp 项目: latzio/hawk
void GameLogic::onControlStarted(HawkControl control)
{
    if (m_state == LeaderBoard && m_leaderBoardReady && control == ActionA) {
        m_playButton.isPressed = true;
        m_playButton.textY++;
        m_click1.play();
    } else if (m_state == GamePlay) {
        if (!m_gamePaused) {
            switch (control) {
            case MoveLeft:
                m_player->setHorizontalMovement(DynamicHawkBody::NegativeCruise);
                break;
            case MoveRight:
                m_player->setHorizontalMovement(DynamicHawkBody::PositiveCruise);
                break;
            case ActionA:
                m_player->setVerticalMovement(DynamicHawkBody::PositiveBurst);
                break;
            case ActionB:
            case ActionX:
            case ActionY:
                break;
            case Menu2:
                onPause();
                break;
            }
        }
    }
}
示例#9
0
fileList::fileList(QWidget *parent) : QWidget(parent)
{
	ui.setupUi(this);

	pReader = new WavReader;
	pIqReader = new WavReader;
	pIqWriter = new WavWriter;

	connect(pIqReader, SIGNAL(isStart(bool)), this, SLOT(onStart(bool)));

	ui.twList->horizontalHeader()->setStretchLastSection(true);
	ui.twList->setSelectionMode(QAbstractItemView::SingleSelection);
	connect(ui.twList, SIGNAL(cellDoubleClicked (int, int)), this, SLOT(onTwDoubleClick(int, int)));
	lastRow = 1;
	loopMode = 0;
	isPlayed = false;
	isRecorded = false;
	isPause = false;

	connect(ui.pbAddFile, SIGNAL(clicked()), this, SLOT(onAddFile()));
	connect(ui.pbDelFile, SIGNAL(clicked()), this, SLOT(onDelFile()));
	connect(ui.pbRec, SIGNAL(clicked()), this, SLOT(onRec()));
	connect(ui.pbPlay, SIGNAL(clicked()), this, SLOT(onPlay()));
	connect(ui.pbPause, SIGNAL(clicked()), this, SLOT(onPause()));
	connect(ui.pbStop, SIGNAL(clicked()), this, SLOT(onStop()));
	connect(ui.pbBack, SIGNAL(clicked()), this, SLOT(onBack()));
	connect(ui.pbLoop, SIGNAL(clicked(bool)), this, SLOT(onLoop(bool)));

	ui.pbPause->setEnabled(false);
}
示例#10
0
void
TomahawkTrayIcon::onStop()
{
    m_loveTrackAction->setEnabled( false );
    m_stopContinueAfterTrackAction->setEnabled( false );

    setResult( Tomahawk::result_ptr() );
    onPause();
}
示例#11
0
void PlayLayer::procLostStone(float delta) {
	
    bool loaded_flag = false;

	if (!loaded_flag) {
        this->unschedule(schedule_selector(PlayLayer::procLostStone));
		game_result = GAME_FAILED;
		onPause();
	}
}
示例#12
0
void ApplicationContext::pause()
{
  if (_app_state == ApplicationLifeState::RUNNING
      || _app_state == ApplicationLifeState::RUNNABLE)
  {
    _event_listener.deactivate();
    onPause();
    _app_state = ApplicationLifeState::PAUSED;
  }
}
示例#13
0
 void DirectRenderer::pause() {
     ALOGD("pause caller pid: %d, our pid: %d",
             IPCThreadState::self()->getCallingPid(), getpid());
     if (getpid() == IPCThreadState::self()->getCallingPid()) {
         onPause();
     } else {
         sp<AMessage> msg = new AMessage(kWhatPause, id());
         sp<AMessage> response;
         msg->postAndAwaitResponse(&response);
     }
 }
bool AndroidOpenGLESGameScreen::handleOnBackPressed()
{
    if(m_gameState == RUNNING)
    {
        onPause();

        return true;
    }
    
    return false;
}
示例#15
0
Presenter::Presenter(IView *view)
{
    this->view = view;
    this->game = new GameController();

    QObject* qview = dynamic_cast<QObject*>(view);
    connect(qview, SIGNAL(onNewGame()), this->game, SLOT(onNewGame()));
    connect(qview, SIGNAL(onPause()), this->game, SLOT(onPause()));
    connect(qview, SIGNAL(onRotate()), this->game, SLOT(onRotate()));
    connect(qview, SIGNAL(onToLeft()), this->game, SLOT(onMoveLeft()));
    connect(qview, SIGNAL(onToRight()), this->game, SLOT(onMoveRight()));
    connect(qview, SIGNAL(onSpeedup()), this->game, SLOT(onSpeedup()));
    connect(qview, SIGNAL(onEndGame()), this->game, SLOT(onEnd()));

    connect(game, SIGNAL(onStateChanged()), this, SLOT(StateChange()));
    connect(game, SIGNAL(onGameEnd()), this, SLOT(EndGame()));
    // instead of speedup
    connect(qview, SIGNAL(onMakeMove()), this->game, SLOT(onMove()));

}
示例#16
0
void AlarmWidget::setConnections()
{
    connect (btnStart, SIGNAL(clicked()), this, SLOT(onStart()));
    connect(btnPause, SIGNAL(clicked()), this, SLOT(onPause()));
    connect(btnQuit,  SIGNAL(clicked()), this, SLOT(close()));
    connect(m_timer_ctd, SIGNAL(timeout()), this, SLOT(onTimerEvent()));

    connect(radioMin, SIGNAL(toggled(bool)), this, SLOT(changeTimeUnit()));
    connect(radioSec, SIGNAL(toggled(bool)), this, SLOT(changeTimeUnit()));

    connect(radioSoundOFF, SIGNAL(toggled(bool)), this, SLOT(changeSoundOutput()));
    connect(radioSoundOn, SIGNAL(toggled(bool)), this, SLOT(changeSoundOutput()));
}
示例#17
0
void GameScreen::coreShipModuleHit()
{
    m_backgroundElements->getCoreShipModule().takeDamage();

    if (m_backgroundElements->getCoreShipModule().isGameOver())
    {
        onPause();
        m_gameState = Game_State::GAME_OVER;
        m_iScreenState = SCREEN_STATE_GAME_OVER;
        m_backgroundElements->reset();
        m_timeButton->setSpeedScalar(0);
        m_adjustFundsText->setText("");
    }
}
示例#18
0
void DirectRenderer::onMessageReceived(const sp<AMessage> &msg) {
    switch (msg->what()) {
        case kWhatDecoderNotify:
        {
            onDecoderNotify(msg);
            break;
        }

        case kWhatRenderVideo:
        {
            onRenderVideo();
            break;
        }

        case kWhatQueueAccessUnit:
            onQueueAccessUnit(msg);
            break;

        case kWhatSetFormat:
            onSetFormat(msg);
            break;

#ifdef MTK_AOSP_ENHANCEMENT
        case kWhatPause:
        {
            uint32_t replyID;
            CHECK(msg->senderAwaitsResponse(&replyID));

            onPause();

            sp<AMessage> response = new AMessage;
            response->postReply(replyID);
            break;
        }
        case kWhatPlay:
        {
            uint32_t replyID;
            CHECK(msg->senderAwaitsResponse(&replyID));

            onResume();
            sp<AMessage> response = new AMessage;
            response->postReply(replyID);
            break;
        }
#endif
        default:
            TRESPASS();
    }
}
示例#19
0
auto_smzdm::auto_smzdm(QWidget *parent)
    : control_status(true), QMainWindow(parent)
{
    ui.setupUi(this);

    connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

    connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

    connect(ui.pushButton_add_comment_id, SIGNAL(clicked()), this, SLOT(onAddCommentID()));

    //connect(ui.pushButton_clickone, SIGNAL(clicked()), this, SLOT(onOneClick()));

    connect(ui.action_import_commentid, SIGNAL(triggered()), this, SLOT(onActImportComment()));

    connect(ui.action_clear_comments, SIGNAL(triggered()), this, SLOT(onActClearComments()));
}
示例#20
0
auto_smzdm::auto_smzdm(QWidget *parent)
    : control_status(true), QMainWindow(parent)
{
    ui.setupUi(this);

    //networkManager = new QNetworkAccessManager(this);

    connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

    connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

    connect(ui.pushButton_clickone, SIGNAL(clicked()), this, SLOT(onOneClick()));

    //connect(&network, SIGNAL(csrfToken(QString)), this, SLOT(onCsrfToken(QString)));

    //connect(&network, SIGNAL(votecount(double)), this, SLOT(onVoteSucceed(double)));
}
示例#21
0
MainWindow::MainWindow(QWidget *widget, Qt::WFlags fl)
  : QMainWindow(widget, fl)
  , Ui::MainWindow()
{
    setupUi(this);

    Ui_MainWindow::mainToolBar->setIconSize(QSize(35, 35));

    connect(actionVolumeUp, SIGNAL(triggered()), this, SLOT(onVolumeUp()));
    connect(actionVolumeDown, SIGNAL(triggered()), this, SLOT(onVolumeDown()));
    connect(actionMute, SIGNAL(triggered()), this, SLOT(onMute()));
    connect(actionSkip, SIGNAL(triggered()), this, SLOT(onSkip()));
    connect(actionStop, SIGNAL(triggered()), this, SLOT(onStop()));
    connect(actionPlay, SIGNAL(triggered()), this, SLOT(onUnpause()));
    connect(actionPause, SIGNAL(triggered()), this, SLOT(onPause()));

    actionPlay->setVisible(false);

    connect(actionLogoutAndQuit, SIGNAL(triggered()), qApp, SLOT(logoutAndQuit()));
    connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(logout()));
    connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAboutSpotfm()));

    m_settingsDlg = new SettingsDialog(this);
    connect(actionSettings, SIGNAL(triggered()), m_settingsDlg, SLOT(show()));

    Radio *radio = SpotFm::app()->radio();
    connect(radio, SIGNAL(trackStarted(Track)), this, SLOT(onTrackStarted(Track)));
    connect(radio, SIGNAL(skipsLeft(int)), this, SLOT(enableSkipButton(int)));
    connect(radio, SIGNAL(trackProgress(int)), this, SLOT(onTrackProgress(int)));
    connect(radio, SIGNAL(error(int, QString)), this, SLOT(onRadioError(int, QString)));

    connect(volumeSlider, SIGNAL(valueChanged(int)), radio, SLOT(setVolume(int)));

    connect(stationWidget, SIGNAL(clicked()), this, SLOT(onNewStation()));
    stationWidget->setFocus();

    QSettings *s = SpotFm::app()->settings();
    volumeSlider->setValue(s->value("volume", 80).toInt());
    radio->setVolume(volumeSlider->value());
    m_lastVolume = volumeSlider->value();

    defaultWindow();
    setupTrayIcon();
    loadExtensions();
}
void GLESApplication::handleCommand(android_app *app, int32_t cmd)
{
    switch (cmd) {
        case APP_CMD_SAVE_STATE:

            break;
        case APP_CMD_INIT_WINDOW:
            // The window is being shown, get it ready.
            if (app->window != NULL) {
                initWindow(app);
            }
            break;
        
            
        case APP_CMD_TERM_WINDOW:
            terminateWindow(app);
            tearDownEGLContext();
            break;

        case APP_CMD_DESTROY:
    
            break;

        case APP_CMD_PAUSE:
            onPause(app);
            break;
        
        case APP_CMD_RESUME:
            onResume(app);
            break;
        
        case APP_CMD_GAINED_FOCUS:
            gainedFocus(app);
            break;
        case APP_CMD_LOST_FOCUS:
            lostFocus(app);
            LOGI("LOST FOCUS state");
            break;
        case APP_CMD_START:
            onStart(app);
            break;
    }
}
示例#23
0
void PlayLayer::onTruckTimer(float delta) {
    
    DoodleTruck *doodleTruck = DoodleTruck::sharedDoodleTruck();
	if (doodleTruck->getMode())
		game_time--;
	else 
		game_time++;

	if (doodleTruck->getMode()) {
		if (!game_time) {
            this->unschedule(schedule_selector(PlayLayer::onTruckTimer));
			game_result = GAME_TIMEUP;
            onPause();
		}
	}
	
	int min = game_time / 60;
	int sec = game_time - min * 60;
	//[menuitem_time setString:[NSString stringWithFormat:@";%02d:%02d", min, sec]];
}
示例#24
0
void AIDebugger::onDisconnect() {
	qDebug() << "disconnect from server: " << _socket.state();
	{
		_pause = false;
		emit onPause(_pause);
	}
	{
		_selectedId = -1;
		_aggro.clear();
		_attributes.clear();
		_node = AIStateNode();
		emit onSelected();
	}
	if (!_names.empty()) {
		_names.clear();
		emit onNamesReceived();
	}
	if (!_entities.empty()) {
		_entities.clear();
		emit onEntitiesUpdated();
	}
	emit disconnect();
}
示例#25
0
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
    : QSystemTrayIcon( parent )
    , m_currentAnimationFrame( 0 )
    , m_showWindowAction( 0 )
    , m_stopContinueAfterTrackAction( 0 )
    , m_loveTrackAction( 0 )
{
#ifdef Q_OS_MAC
    QIcon icon( RESPATH "icons/tomahawk-grayscale-icon-128x128.png" );
#else
    QIcon icon( RESPATH "icons/tomahawk-icon-128x128.png" );
#endif

    setIcon( icon );

    refreshToolTip();

    m_contextMenu = new QMenu();
    m_contextMenu->setFont( TomahawkUtils::systemFont() );
    setContextMenu( m_contextMenu );

    m_loveTrackAction = new QAction( this );
    m_stopContinueAfterTrackAction = new QAction( this );

    ActionCollection *ac = ActionCollection::instance();
    m_contextMenu->addAction( ac->getAction( "playPause" ) );
    m_contextMenu->addAction( ac->getAction( "stop" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( m_loveTrackAction );
    m_contextMenu->addAction( m_stopContinueAfterTrackAction );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
    m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );

#ifdef Q_OS_MAC
    // On mac you can close the windows while leaving the app open. We then need a way to show the main window again
    m_contextMenu->addSeparator();
    m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
    m_showWindowAction->setData( true );
    connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );

    connect( m_contextMenu, SIGNAL( aboutToShow() ), this, SLOT( menuAboutToShow() ) );
#endif

    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "quit" ) );

    connect( m_loveTrackAction, SIGNAL( triggered() ), SLOT( loveTrackTriggered() ) );
    connect( m_stopContinueAfterTrackAction, SIGNAL( triggered() ), SLOT( stopContinueAfterTrackActionTriggered() ) );

    connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
    connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
    connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onResume() ) );
    connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onStop() ) );
    connect( AudioEngine::instance(), SIGNAL( paused() ),  SLOT( onPause() ) );
    connect( AudioEngine::instance(), SIGNAL( stopAfterTrackChanged() ), SLOT( onStopContinueAfterTrackChanged() ) );

    connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
    connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );

    onStop();
    show();
}
示例#26
0
JNIEXPORT void JNICALL Java_jk_j_1JNILib_pause(JNIEnv * env, jobject obj)
{
	onPause();
}
示例#27
0
void PlayLayer::doneTruckReversed() {
    
	game_result = GAME_FAILED;
    onPause();
}
示例#28
0
void NuPlayer::Renderer::onMessageReceived(const sp<AMessage> &msg) {
    switch (msg->what()) {
        case kWhatDrainAudioQueue:
        {
            int32_t generation;
            CHECK(msg->findInt32("generation", &generation));
            if (generation != mAudioQueueGeneration) {
                break;
            }

            mDrainAudioQueuePending = false;

            if (onDrainAudioQueue()) {
                uint32_t numFramesPlayed;
                CHECK_EQ(mAudioSink->getPosition(&numFramesPlayed),
                         (status_t)OK);

                uint32_t numFramesPendingPlayout =
                    mNumFramesWritten - numFramesPlayed;

                // This is how long the audio sink will have data to
                // play back.
                int64_t delayUs =
                    mAudioSink->msecsPerFrame()
                        * numFramesPendingPlayout * 1000ll;

                // Let's give it more data after about half that time
                // has elapsed.
                postDrainAudioQueue(delayUs / 2);
            }
            break;
        }

        case kWhatDrainVideoQueue:
        {
            int32_t generation;
            CHECK(msg->findInt32("generation", &generation));
            if (generation != mVideoQueueGeneration) {
                break;
            }

            mDrainVideoQueuePending = false;

            onDrainVideoQueue();

            postDrainVideoQueue();
            break;
        }

        case kWhatQueueBuffer:
        {
            onQueueBuffer(msg);
            break;
        }

        case kWhatQueueEOS:
        {
            onQueueEOS(msg);
            break;
        }

        case kWhatFlush:
        {
            onFlush(msg);
            break;
        }

        case kWhatAudioSinkChanged:
        {
            onAudioSinkChanged();
            break;
        }

        case kWhatPause:
        {
            onPause();
            break;
        }

        case kWhatResume:
        {
            onResume();
            break;
        }

        default:
            TRESPASS();
            break;
    }
}
示例#29
0
void GameScreen::updateInputRunning()
{
    for (std::vector<TouchEvent>::iterator itr = m_touchEvents.begin(); itr != m_touchEvents.end(); itr++)
    {
        touchToWorld((*itr));

        switch (itr->getTouchType())
        {
        case DOWN:
            if (m_backgroundElements->isUpgradeSellMenuShowing())
            {
                if (m_backgroundElements->isTouchInTowerSelectionMenuArea(*m_touchPoint))
                {
                    handleTouchDownInUpgradeSellMenu();
                }
                else
                {
                    m_backgroundElements->setUpgradeSellMenuShowing(false);
                    m_touchCursor->setVisibility(false);
                }
            }
            else
            {
                // handle the user selecting a tower
                if (m_backgroundElements->isTouchInTowerSelectionMenuArea(*m_touchPoint))
                {
                    int selectedTowerCost;
                    if ((selectedTowerCost = m_backgroundElements->handleTouchDownInTowerSelectionMenu(*m_touchPoint)) > 0)
                    {
                        setAdjustFundsText(selectedTowerCost, false);
                    }
                }
            }
            continue;
        case DRAGGED:
            if (m_backgroundElements->isUpgradeSellMenuShowing())
            {
                if (m_backgroundElements->isTouchInTowerSelectionMenuArea(*m_touchPoint))
                {
                    handleTouchDownInUpgradeSellMenu();
                }
            }
            else
            {
                if (m_backgroundElements->isTowerSelected())
                {
                    m_backgroundElements->setSelectedTowerPosition(*m_touchPoint);
                    World::getInstance()->updateTowerCursor(m_backgroundElements->getSelectedTowerCursor());
                }
            }
            continue;
        case UP:
            if (m_backgroundElements->isUpgradeSellMenuShowing())
            {
                if (m_backgroundElements->isTouchInTowerSelectionMenuArea(*m_touchPoint))
                {
                    handleTouchUpInUpgradeSellMenu();
                }
            }
            else
            {
                if (m_backgroundElements->isTowerSelected())
                {
                    if (World::getInstance()->placeTower(m_backgroundElements->getSelectedTowerCursor()))
                    {
                        m_iFunds -= TowerCostMapper::getCostForTowerType(m_backgroundElements->getSelectedTowerCursor().getTowerType());
                        updateFundsTextAndTowerCursors();
                        m_backgroundElements->reset();
                    }

                    m_adjustFundsText->setText("");
                    m_backgroundElements->reset();
                }
                else
                {
                    updateAndHandleTouchCursor();

                    if (m_touchCursor->isTowerLockAcquired())
                    {
                        m_backgroundElements->setUpgradeSellMenuShowing(true);
                        adjustUpgradeTowerButtonColor();
                        adjustUpgradeSellTexts();
                    }
                    else
                    {
                        if (World::getInstance()->handleTouchUp(*m_touchPoint))
                        {
                            waveCompleted();
                            waveSpawned();
                        }
                        else if (m_timeButton->isTouching(*m_touchPoint))
                        {
                            if (m_timeButton->handleTouch(*m_touchPoint))
                            {
                                onPause();
                            }
                        }
                    }
                }
            }
            return;
        }
    }
}
示例#30
0
void TimerThread::onSuspend() {
	onPause();
}