Exemple #1
0
GameScreen::GameScreen(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::GameScreen)
{
    ui->setupUi(this);
    tmp = new QMainWindow(this);
    paddleIcon = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/paddle.png");
    ballIcon = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/white_ball.png");
    gameOverIcon = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/gameover.png");
    gameOverlay = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/background.jpg");
    gameWonIcon = new QPixmap("C:/Users/TAYLOR/Documents/C++ Files/BrickBreak/youwin.jpg");
    overlayLbl = new QLabel(this);
    overlayLbl->setPixmap(*gameOverlay);
    overlayLbl->setGeometry(0, ui->menuBar->height(), this->width() - (this->width() - ui->rightLine->pos().x()), this->height() - (this->height() - ui->bottomLine->pos().y()));

    connect(this, SIGNAL(eventTriggered(QString)), this, SLOT(writeEvent(QString)));
    connect(this, SIGNAL(gameEnded()), this, SLOT(gameOver()));

    diff = EASY;
    level = 1;
    newLevel(level);
    createActions();
    createMenus();
    createPaddle();
    createBall();
    numLives = 3;

    time = new Timer(this, "time");
    connect(time, SIGNAL(timeout()), this, SLOT(decrementTimer()));
    cheatModeActive = false;
    spacePressed = false;
    score = 0;
    createBlocks();
    eventLogFullSizePos = new QPoint(310, 10);
    eventLogHalfSizePos = new QPoint(310, 200);
    hideCheatMode();
    setLivesText(numLives);
    setTimeText(timeLeft);
    setLevelText(level);
    setScoreText(score);
}
//---------------------------------------------------------------------------
void TGJVEditFrame::calcLoc( )
{
   String gridref = LocEdit->Text.Trim();

   if ( stricmp( gridref.c_str(), oldloc.c_str() ) != 0 )
   {
      oldloc = gridref;
      locValid = true;
      double latitude;
      double longitude;
      double dist;
      int brg;

      int locValres = lonlat( gridref.c_str(), longitude, latitude );
      if ( ( locValres ) != LOC_OK )
         locValid = false;

      ScreenContact &sct = screenContact;
      if ( ( sct.contactFlags & MANUAL_SCORE ) &&
           !( sct.contactFlags & DONT_PRINT ) )
      {
         int thisscore = sct.contactScore;
         setScoreText( thisscore, false, sct.contactFlags & XBAND );
         BrgSt->Caption = "MANUAL";

      }
      else
         if ( ( locValid
                || ( locValres == LOC_PARTIAL ) )
              && contest->locValid )
         {
            contest->disbear( longitude, latitude, dist, brg );

            if ( locValid )  	// just 4CHAR not enough
            {
               sct.bearing = brg;

               if ( !( sct.contactFlags & ( MANUAL_SCORE | NON_SCORING | LOCAL_COMMENT | COMMENT_ONLY | DONT_PRINT ) ) )
               {
                  sct.contactScore = dist;
               }

            }

            TEMPBUFF( rev, 10 );
            strcpy( rev, ( MinosParameters::getMinosParameters() ->getMagneticVariation() ) ? "M" : "T" );
            int vb = varBrg( brg );
            if ( TContestApp::getContestApp() ->reverseBearing )
            {
               vb = normBrg( vb - 180 );
               strcat( rev, "R" );
            }
            setScoreText( ( int ) dist, ( locValres == LOC_PARTIAL ), sct.contactFlags & XBAND );
			AnsiString brgbuff;
            if ( locValres == LOC_PARTIAL )
            {
			   brgbuff.printf( "(%d\xB0%s)", vb, rev );
            }
            else
            {
               brgbuff.printf( "%d\xB0%s", vb, rev );
            }
            BrgSt->Caption = brgbuff;
         }
         else
         {
            DistSt->Caption = "";
            BrgSt->Caption = "";
            sct.contactScore = -1;
            sct.bearing = -1;
         }
   }
}
Exemple #3
0
void GameScreen::decScore(int i)
{
    score -= i;
    setScoreText(score);
}
Exemple #4
0
void GameScreen::incScore(int i)
{
    score += i;
    setScoreText(score);
}