Exemplo n.º 1
0
//[5]
void GameField::showField()const
{
    showGreeting();

    /* upper border */
    std::cout << "   ";

    for(int i = 0; i < DEFAULT_FLDSIZE; ++i)
        std::cout << "##";

    std::cout << std::endl;

    /* field + side borders */
    for(int i = 0; i < DEFAULT_FLDSIZE; ++i)
    {
        std::cout << "  #";

        for (int j = 0; j < DEFAULT_FLDSIZE; ++j)
            std::cout << gameField[i][j] << ' ';

         std::cout << "#" << std::endl;
    }

    /* bottom border */
    std::cout << "   ";

    for(int i = 0; i < DEFAULT_FLDSIZE; ++i)
        std::cout << "##";

    std::cout << std::endl;

    showScore();
    showLevel();
}
Exemplo n.º 2
0
void Game::showInfos()
{
	showNextPiece();
	showHoldPiece();
	showScore();
	showLevel();
	showLinesCompleted();
	showBestScore();
}
Exemplo n.º 3
0
void GameLayer::update(float delta)
{
	_controlLayer->update(delta);
	_enemyAI->update(delta);
	if (_playerTank[0] != NULL)
	{
		_playerTank[0]->update(delta, _controlLayer->getRetation());
	}
	showLevel();
	showEnemy();
	showIpLifeCount();
}
Exemplo n.º 4
0
void LevelSwitchLayer::init_Create()
{
	auto backColor = LayerColor::create(ccc4(0, 0, 0, 225));
	this->addChild(backColor);

	showLevel();
	this->scheduleOnce(schedule_selector(LevelSwitchLayer::startGame),2.0f);


	

	
}
Exemplo n.º 5
0
void GameLayer::init_Create()
{
	_enemyCount = enemyTanksCount[_level];
	_leveString = NULL;
	_iplifeString = NULL;
	_enemyCountString = NULL;

	SpriteFrameCache::getInstance()->addSpriteFramesWithFile("blast.plist");
	_listen_TankDeath = EventListenerCustom::create("tankdeath", CC_CALLBACK_1(GameLayer::onEventCustom_TankDeath, this));
	this->_eventDispatcher->addEventListenerWithFixedPriority(_listen_TankDeath, 1);//添加到事件分發器
	_listen_Gameover = EventListenerCustom::create("gameover", CC_CALLBACK_1(GameLayer::onEventCustom_GameOver, this));
	this->_eventDispatcher->addEventListenerWithFixedPriority(_listen_Gameover, 1);//添加到事件分發器
	CreateMapLayer();
	showLevel();
	showEnemy();
	showIpLifeCount();
	this->scheduleUpdate();
	
}
Exemplo n.º 6
0
        /**
         * This function is called when a new message is ready to be
         * written to screen, disk, or stream. 'logline' or 'remotestream'
         * contain a single log message. Time and location is prepended.
         */
        void logit(std::ostream& (*pf)(std::ostream&))
        {
            // only on Logger::nl or Logger::endl, a time+log-line is written.
            os::MutexLock lock( inpguard );
            std:: string res = showTime() +" " + showLevel(inloglevel) + showModule() + " ";

            // do not log if not wanted.
            if ( maylogStdOut() ) {
#ifndef OROSEM_PRINTF_LOGGING
                *stdoutput << res << logline.str() << pf;
#else
                printf("%s%s\n", res.c_str(), logline.str().c_str() );
#endif
                logline.str("");   // clear stringstream.
            }

            if ( maylogFile() ) {
#ifdef OROSEM_FILE_LOGGING
#if     defined(OROSEM_LOG4CPP_LOGGING)
                category.log(level2Priority(inloglevel), fileline.str());
#elif   !defined(OROSEM_PRINTF_LOGGING)
                logfile << res << fileline.str() << pf;
#else
                fprintf( logfile, "%s%s\n", res.c_str(), fileline.str().c_str() );
#endif
#ifdef OROSEM_REMOTE_LOGGING
                // detect buffer 'overflow'
                if ( messagecnt >= ORONUM_LOGGING_BUFSIZE ) {
                    std::string dummy;
                    remotestream >> dummy; // FIFO principle: read 1 line
                    --messagecnt;
                }
                remotestream << res << fileline.str() << pf;
                ++messagecnt;
#endif
#if defined(OROSEM_FILE_LOGGING) || defined(OROSEM_REMOTE_LOGGING)
                fileline.str("");
#endif
#endif
            }
Exemplo n.º 7
0
void loadLevel(int level) {    
    voff = 0;
    hoff = 0;

    showLevel(level);
}