1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
|
/*
This file is part of StroQ, Copyright (C) 2005 Luc Vo Van
StroQ is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
StroQ is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with StroQ; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Class : PlayArea
Author : Luc Vo Van
Original Date : 18.05.2005
Description : The QCanvasView on which the player plays and inputs
most commands.
*/
#include <qcanvas.h>
#include <qpainter.h>
#include <qmessagebox.h>
#include <qinputdialog.h>
#include <qvalidator.h>
#include <qpoint.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qsettings.h>
#include <qfile.h>
#include <vector>
#include "playarea.h"
#include "playsquare.h"
#include "puzzle.h"
#include "stroqconst.h"
#include "images/classic/background.xpm"
#include "images/classicsquare/background.xpm"
#include "images/oceanbarbeq/background.xpm"
QPixmap* PlayArea::m_qpmBackground = NULL;
PlayArea::PlayArea(QCanvas *c, QWidget* parent, const char* name, WFlags f)
: QCanvasView(c, parent, name, f)
{
m_ppOriginalPuzzle = NULL;
m_ppPlayPuzzle = NULL;
m_psHighlightedSquare = NULL;
m_bButtonPressed = false;
m_bEditMode = false;
m_cCanvas = c;
changeTheme(0);
m_cCanvas->setBackgroundPixmap(*m_qpmBackground);
m_cCanvas->update();
}
PlayArea::~PlayArea()
{
if(m_ppOriginalPuzzle)
delete m_ppOriginalPuzzle;
if(m_ppPlayPuzzle)
delete m_ppPlayPuzzle;
if(m_qpmBackground)
delete m_qpmBackground;
}
void PlayArea::contentsMousePressEvent(QMouseEvent* e)
{
// We're in PLAY mode.
if(!m_bEditMode)
{
// If we were in gameover state, this click will reset the
// puzzle.
if(m_bGameOver)
{
resetGrid();
m_bGameOver = false;
}
if (e->button() == 1)
{
// Pick the Square that was under the click and
// select it.
QPoint p = inverseWorldMatrix().map(e->pos());
QCanvasItemList l=m_cCanvas->collisions(p);
QCanvasItemList::Iterator it;
for (it=l.begin(); it!=l.end(); ++it)
{
// We check the cast of it into a PlaySquare.
if (dynamic_cast<PlaySquare*>(*it) != NULL)
{
selectPlaySquares((PlaySquare*)(*it));
}
}
m_bButtonPressed = true;
}
else if (e->button() == 2)
{
// Unlinks all the squares in the stroke and clears
// the stroke when the right mouse button is clicked.
resetGrid();
}
}
// We're in EDIT mode.
else
{
// We just toggle white to black and vice versa.
QPoint p = inverseWorldMatrix().map(e->pos());
QCanvasItemList l=m_cCanvas->collisions(p);
QCanvasItemList::Iterator it;
for (it=l.begin(); it!=l.end(); ++it)
{
// We check the cast of it into a PlaySquare.
if (dynamic_cast<PlaySquare*>(*it) != NULL)
{
((PlaySquare*)(*it))->toggle();
emit puzzleChanged(m_ppPlayPuzzle,
sizeHint());
}
}
m_bButtonPressed = true;
}
}
void PlayArea::contentsMouseMoveEvent(QMouseEvent* e)
{
if (!m_bEditMode)
{
// Pick the Square that was under the cursor and highlight it.
QPoint p = inverseWorldMatrix().map(e->pos());
QCanvasItemList l=m_cCanvas->collisions(p);
if (l.size() > 0) {
QCanvasItemList::Iterator it;
for (it=l.begin(); it!=l.end(); ++it)
{
if (dynamic_cast<PlaySquare*>(*it) != NULL)
{
PlaySquare *ps = (PlaySquare*)(*it);
highlightPlaySquare(ps);
}
// If we're already holding the button, make
// this square the selected square.
if (m_bButtonPressed)
{
selectPlaySquare((PlaySquare*) (*it));
}
}
}
else
{
// No square under the cursor, dehilight the last
// hovered cursor.
if (m_psHighlightedSquare)
{
m_psHighlightedSquare->setHighlight(false);
m_psHighlightedSquare = NULL;
}
}
}
else
{
/*
* What would be nice here would be to be allowed to toggle the tiles
* LIVE when holding the mouse button and in edit move. The problem
* implementing that is that we have to store when we leave the
* square, we can't just toggle on every move event :
*/
// Edit mode.
// if(m_bButtonPressed)
// {
// // We just toggle white to black and vice versa.
// QPoint p = inverseWorldMatrix().map(e->pos());
// QCanvasItemList l=m_cCanvas->collisions(p);
// QCanvasItemList::Iterator it;
// for (it=l.begin(); it!=l.end(); ++it)
// {
// // We check the cast of it into a PlaySquare.
// if ( dynamic_cast<PlaySquare*>(*it) != NULL )
// {
// ((PlaySquare*)(*it))->toggle();
// emit puzzleChanged(m_ppPlayPuzzle,
// sizeHint());
// }
// }
// }
}
}
void PlayArea::contentsMouseReleaseEvent (QMouseEvent* e)
{
if (e->button() == 1)
m_bButtonPressed = false;
}
void PlayArea::contentsMouseDoubleClickEvent(QMouseEvent* e)
{
if (!m_bEditMode && e->button() == 1)
{
QPoint p = inverseWorldMatrix().map(e->pos());
QCanvasItemList l=m_cCanvas->collisions(p);
QCanvasItemList::Iterator it;
for (it=l.begin(); it!=l.end(); ++it)
{
// We check the cast of it into a PlaySquare.
if (dynamic_cast<PlaySquare*>(*it) != NULL)
{
// Is it the last square in the stroke?
if (((PlaySquare*)(*it))->getGridPos() ==
m_vStroke[m_vStroke.size()-1]->getGridPos())
toggleStroke();
}
}
}
}
void PlayArea::highlightPlaySquare(PlaySquare *playSquare)
{
// We're on a square.
// Dehilight the previously selected square (if any).
// Highlight the new one.
if (m_psHighlightedSquare)
{
if (playSquare == m_psHighlightedSquare)
return;
m_psHighlightedSquare->setHighlight(false);
}
m_psHighlightedSquare = playSquare;
playSquare->setHighlight(true);
}
void PlayArea::selectPlaySquares(PlaySquare *playSquare)
{
int i;
if (m_vStroke.size() == 0 ||
playSquare->getLink() != PlaySquare::None)
{
selectPlaySquare(playSquare);
return;
}
PlaySquare* last = m_vStroke[m_vStroke.size()-1];
if (getAlignment(playSquare, last) == ROW_ALIGNED)
{
// Check if any already linked PlaySquares are in the way.
i = last->getGridPos().x();
if (i < playSquare->getGridPos().x()) i++;
else i--;
while (i != playSquare->getGridPos().x())
{
// Do we encounter an already linked square?
if (((PlaySquare*) m_ppPlayPuzzle
->getSquareAt(i, playSquare->getGridPos().y()))
->getLink() != PlaySquare::None)
return;
// Get closer to last.
if (i < playSquare->getGridPos().x())
i++;
else
i--;
}
// Selects the squares on the way.
i = last->getGridPos().x();
if (i < playSquare->getGridPos().x()) i++;
else i--;
while (i != playSquare->getGridPos().x())
{
// Do we encounter an already linked square?
selectPlaySquare((PlaySquare*) m_ppPlayPuzzle
->getSquareAt(i, playSquare->getGridPos().y()));
// Get closer to last.
if (i < playSquare->getGridPos().x())
i++;
else
i--;
}
selectPlaySquare(playSquare);
}
else if (getAlignment(playSquare, last) == COLUMN_ALIGNED)
{
// Check if any already linked PlaySquares are in the way.
i = last->getGridPos().y();
if (i < playSquare->getGridPos().y()) i++;
else i--;
while (i != playSquare->getGridPos().y())
{
// Do we encounter an already linked square?
if (((PlaySquare*) m_ppPlayPuzzle
->getSquareAt(playSquare->getGridPos().x(), i))
->getLink() != PlaySquare::None)
return;
// Get closer to last.
if (i < playSquare->getGridPos().y())
i++;
else
i--;
}
// Selects the squares on the way.
i = last->getGridPos().y();
if (i < playSquare->getGridPos().y()) i++;
else i--;
while (i != playSquare->getGridPos().y())
{
// Do we encounter an already linked square?
selectPlaySquare((PlaySquare*) m_ppPlayPuzzle
->getSquareAt(playSquare->getGridPos().x(), i));
// Get closer to last.
if (i < playSquare->getGridPos().y())
i++;
else
i--;
}
selectPlaySquare(playSquare);
}
}
void PlayArea::selectPlaySquare(PlaySquare *playSquare)
{
// Checks if playSquare is selectable by verifying the last PlaySquare
// of the stroke.
if (m_vStroke.size() > 0) // Is there something in the stroke?
{
// Is this PlaySquare already part of the stroke? We just
// check its link to know!
if (playSquare->getLink() != PlaySquare::None
&& (*playSquare != (*m_vStroke[m_vStroke.size()-1])))
{
std::vector<PlaySquare*>::const_iterator i;
for (i = m_vStroke.begin() +
playSquare->getStrokePosition()+1;
i!=m_vStroke.end(); i++)
(*i)->unsetLink();
// Resizes the stroke to go only up to playSquare.
m_vStroke.resize(playSquare->getStrokePosition());
canvas()->setAllChanged();
canvas()->update();
}
// If playSquare's position is not a valid neighbour, don't
// do a thing.
else
{
PlaySquare* last = m_vStroke[m_vStroke.size()-1];
if (getAlignment(playSquare, last) == NOT_ALIGNED)
return;
if (!(abs(playSquare->getGridPos().x() -
last->getGridPos().x()) == 1
|| abs(playSquare->getGridPos().y() -
last->getGridPos().y()) == 1))
return;
}
}
m_vStroke.push_back(playSquare); // Add to the stroke.
playSquare->setStrokePosition(m_vStroke.size()-1);
if (m_vStroke.size() == 1)
playSquare->setStrokeEnd();
else
updateStrokeLinks();
emit strokeLengthChanged((int) m_vStroke.size());
}
void PlayArea::loadPuzzle(Puzzle *puzzle) {
if (m_ppOriginalPuzzle)
{
// printf("Deleting m_ppOriginalPuzzle\n");
delete m_ppOriginalPuzzle;
}
m_ppOriginalPuzzle = puzzle;
m_cCanvas->resize((puzzle->getWidth() + 2) * DEFAULT_SIDE +\
DEFAULT_BORDER,
(puzzle->getHeight() + 2) * DEFAULT_SIDE +\
DEFAULT_BORDER);
emit puzzleChanged(m_ppOriginalPuzzle, m_cCanvas->size());
resetGrid();
}
void PlayArea::resetGrid() {
emit clearStroke();
m_psHighlightedSquare = NULL;
m_bGameOver = false;
viewport()->setMouseTracking(false);
// Copies qvlOriginalPuzzle into qvlPlayPuzzle replacing all Squares
// by PlaySquares.
if (m_ppPlayPuzzle)
delete m_ppPlayPuzzle;
setCanvas(0);
m_ppPlayPuzzle = new Puzzle(m_ppOriginalPuzzle, m_cCanvas);
viewport()->setMouseTracking(true);
m_cCanvas->update();
setCanvas(m_cCanvas);
}
void PlayArea::toggleStroke()
{
// Toggles the stroke.
for (unsigned int i = 0; i < m_vStroke.size(); i++)
m_vStroke[i]->toggle();
// Runs the puzzle.
int row, col, countwhite, countblack;
bool win = true;
for (row = 1; row <= m_ppOriginalPuzzle->getHeight(); row++)
{
countwhite = 0;
countblack = 0;
for (col = 1; col <= m_ppOriginalPuzzle->getWidth(); col++)
{
if (m_ppPlayPuzzle->getSquareAt(col, row)->getState()
== Square::White)
countwhite++;
else
countblack++;
}
// Row cleared, one color was absent, the other color filled
// the row.
if (!(countwhite == 0 || countblack == 0))
win = false;
}
m_cCanvas->setAllChanged();
m_cCanvas->update();
if (win)
{
QMessageBox::information(this, tr("Congratulations"),
QString(tr("You solved this puzzle "\
"with a %1 strokes!")
.arg((int) m_vStroke.size())),
QMessageBox::Ok);
// Store the success in the settings.
QSettings settings;
settings.setPath("thelemmings.net", "StroQ");
QString settingkey = "/puzzles/" +
m_ppOriginalPuzzle->getCode();
// Save the length of the solution, if this one is shorter.
int solutionLength = settings.readNumEntry(settingkey, -1);
if (solutionLength == -1
|| (int) m_vStroke.size() < solutionLength)
{
settings.writeEntry(settingkey,(int)m_vStroke.size());
}
emit loadNextPuzzle();
}
else
QMessageBox::information(this, tr("Sorry"),
tr("The run was unsuccessful," \
" reset it to try again!"),
QMessageBox::Ok);
m_bGameOver = true;
m_cCanvas->update();
}
void PlayArea::clearStroke()
{
std::vector<PlaySquare*>::const_iterator i;
for (i = m_vStroke.begin(); i!=m_vStroke.end(); i++)
(*i)->unsetLink();
m_vStroke.clear();
emit strokeLengthChanged(0);
canvas()->setAllChanged();
canvas()->update();
}
void PlayArea::updateStrokeLinks()
{
if (m_vStroke.size() <= 1)
return;
else if (m_vStroke.size() == 2)
{
// Determine the link of the second PlaySquare in the stroke.
if (getAlignment(m_vStroke[0], m_vStroke[1]) == ROW_ALIGNED)
{
// Horizontal alignment.
if (m_vStroke[0]->getGridPos().x() <
m_vStroke[1]->getGridPos().x())
{
m_vStroke[0]->setLink(PlaySquare::LeftRight);
m_vStroke[1]->setLink(PlaySquare::LeftRight);
}
else
{
m_vStroke[0]->setLink(PlaySquare::RightLeft);
m_vStroke[1]->setLink(PlaySquare::RightLeft);
}
}
else
{
// Vertical alignment.
if (m_vStroke[0]->getGridPos().y() <
m_vStroke[1]->getGridPos().y())
{
m_vStroke[0]->setLink(PlaySquare::UpDown);
m_vStroke[1]->setLink(PlaySquare::UpDown);
}
else
{
m_vStroke[0]->setLink(PlaySquare::DownUp);
m_vStroke[1]->setLink(PlaySquare::DownUp);
}
}
m_vStroke[1]->setStrokeEnd();
}
else
{
PlaySquare* secondlast = m_vStroke[m_vStroke.size()-2];
PlaySquare* last = m_vStroke[m_vStroke.size()-1];
/* printf("secondlast:%d,%d last:%d,%d\n",
secondlast->getGridPos().x(),
secondlast->getGridPos().y(),
last->getGridPos().x(),
last->getGridPos().y()
); */
// Horizontal neighbours.
if (getAlignment(last, secondlast) == ROW_ALIGNED)
{
if (secondlast->getLink() == PlaySquare::RightLeft)
last->setLink(PlaySquare::RightLeft);
else if (secondlast->getLink() ==
PlaySquare::LeftRight)
last->setLink(PlaySquare::LeftRight);
else if (secondlast->getLink() == PlaySquare::DownUp)
{
if (secondlast->getGridPos().x() <
last->getGridPos().x())
{ // secondlast is left of last.
secondlast->setLink(PlaySquare::DownRight);
last->setLink(PlaySquare::LeftRight);
}
else
{ // secondlast is right of secondlast.
secondlast->setLink(PlaySquare::DownLeft);
last->setLink(PlaySquare::RightLeft);
}
}
else if (secondlast->getLink() == PlaySquare::UpDown)
{
if (secondlast->getGridPos().x() <
last->getGridPos().x())
{ // secondlast is left of secondlast.
secondlast->setLink(PlaySquare::UpRight);
last->setLink(PlaySquare::LeftRight);
}
else
{ // secondlast is right of secondlast.
secondlast->setLink(PlaySquare::UpLeft);
last->setLink(PlaySquare::RightLeft);
}
}
else // Second last is a 'turn' in the stroke, this
// is possible when going back in the stroke
// (reclicking on a part of the stroke. We
// don't change second last, only last.
{
if (secondlast->getGridPos().x() <
last->getGridPos().x())
{ // secondlast is left of secondlast.
last->setLink(PlaySquare::LeftRight);
}
else
{ // secondlast is right of secondlast.
last->setLink(PlaySquare::RightLeft);
}
}
}
else // Vertical alignment.
{
if (secondlast->getLink() == PlaySquare::UpDown)
last->setLink(PlaySquare::UpDown);
else if (secondlast->getLink() == PlaySquare::DownUp)
last->setLink(PlaySquare::DownUp);
else if (secondlast->getLink() ==
PlaySquare::LeftRight)
{
if (secondlast->getGridPos().y() <
last->getGridPos().y())
{ // last is below secondlast.
secondlast->setLink(PlaySquare::LeftDown);
last->setLink(PlaySquare::UpDown);
}
else
{ // last is above secondlast.
secondlast->setLink(PlaySquare::LeftUp);
last->setLink(PlaySquare::DownUp);
}
}
else if (secondlast->getLink() ==
PlaySquare::RightLeft)
{
if (secondlast->getGridPos().y() <
last->getGridPos().y())
{ // last is below secondlast.
secondlast->setLink(PlaySquare::RightDown);
last->setLink(PlaySquare::UpDown);
}
else
{ // last is above secondlast.
secondlast->setLink(PlaySquare::RightUp);
last->setLink(PlaySquare::DownUp);
}
}
else
{
if (secondlast->getGridPos().y() <
last->getGridPos().y())
{ // last is below secondlast.
last->setLink(PlaySquare::UpDown);
}
else
{ // last is above secondlast.
last->setLink(PlaySquare::DownUp);
}
}
}
// Sets the ends.
secondlast->unsetStrokeEnd();
last->setStrokeEnd();
}
}
int PlayArea::getAlignment(Square* s1, Square* s2)
{
if (s1->getGridPos().x() == s2->getGridPos().x())
return COLUMN_ALIGNED;
else if (s1->getGridPos().y() == s2->getGridPos().y())
return ROW_ALIGNED;
return NOT_ALIGNED;
}
bool PlayArea::getEditMode()
{
return m_bEditMode;
}
void PlayArea::toggleEditMode()
{
// Switch the mode
m_bEditMode = !m_bEditMode;
// Switched TO edit mode, resets the puzzle to its original state
if(m_bEditMode)
resetGrid();
// Switched FROM edit mode, use the play puzzle as an original puzzle
else
loadPuzzle(new Puzzle(m_ppPlayPuzzle));
// Updates the mainwindow
emit puzzleChanged(m_ppPlayPuzzle, sizeHint());
}
void PlayArea::invertPuzzle()
{
m_ppOriginalPuzzle->invert();
m_ppPlayPuzzle->invert();
m_cCanvas->setAllChanged();
m_cCanvas->update();
}
void PlayArea::editModeSetDimensions()
{
bool ok;
QString dims = QInputDialog::getText(tr("Dimensions"),
tr("Enter the desired "\
"dimensions for your "\
"puzzle [width]x[height]"\
" (eg: 10x5)"),
QLineEdit::Normal,
QString::null, &ok, this );
// Cancel pressed.
if (!ok)
return;
QStringList ql = QStringList::split(QChar('x'), dims);
// There has to be exactly two dimensions.
if (ql.count() != 2)
{
QMessageBox::warning(this, tr("Invalid dimensions"),
tr("The format of the dimensions must "\
"be [width]x[height] (eg: 10x5)"));
return;
}
QRegExp rx("[0-9]{1,2}");
int pos = 0;
QRegExpValidator v( rx, 0 );
if (v.validate( ql[0], pos ) && v.validate( ql[1], pos ))
{
int width = ql[0].toInt();
int height = ql[1].toInt();
loadPuzzle(new Puzzle(width, height, QPoint(0, 0),
QPoint(0, 0), Square::Black));
}
else
{
QMessageBox::warning(this, tr("Invalid dimensions"),
tr("The dimensions you provided are "\
"invalid"));
return;
}
}
void PlayArea::printStroke()
{
std::vector<PlaySquare*>::const_iterator i;
printf("Stroke: ");
for (i = m_vStroke.begin(); i!=m_vStroke.end(); i++)
printf("%d:[%d, %d]; ", (*i)->getStrokePosition(),
(*i)->getGridPos().x(),
(*i)->getGridPos().y());
printf("\n");
}
void PlayArea::changeTheme(int themenum)
{
// The background image.
switch(themenum)
{
case 0:
m_qpmBackground = new QPixmap();
break;
case 1:
m_qpmBackground = new QPixmap(classicsquare_background);
break;
case 2:
m_qpmBackground = new QPixmap();
break;
}
PlaySquare::changeTheme(themenum);
}
|